1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lesya [120]
3 years ago
10

Make a program that prints each line of its input that mentions fred. (It shouldn’t do anything for other lines of input.) Does

it match if your input string is Fred, frederick, or Alfred? Make a small text file with a few lines mentioning "fred flintstone" and his friends, then use that file as input to this program and the ones later in this section.
Computers and Technology
1 answer:
Vitek1552 [10]3 years ago
8 0

Answer:

See Explaination

Explanation:

This assume that input is a file and is given on command line. Please note this will ot print lines with frederick as thats what I feel question is asking for

#!/usr/bin/perl -w

open(FILE, $ARGV[0]) or die("Could not open the file $ARGV[0]");

while ($line = <FILE>){

if($line=~/\s+fred\s+/)

{

print $line;

}

}

close(FILE);

You might be interested in
Consider the following code: public static void mystery(int a) { System.out.println("A"); } public static void mystery(double a)
Feliz [49]

Answer:

The output is "A"

Explanation:

public class Solution {

   public static void main(String args[]) {

     mystery(7);

   }    

   public static void mystery(int a) { System.out.println("A"); }    

   public static void mystery(double a) { System.out.println("B"); }    

   public static void mystery(int a, double b) { System.out.println("C"); }    

   public static void mystery(double a, int b) { System.out.println("D"); }

}

In the code above; mystery is defined in four different ways called method overloading. Method overloading is when same method is defined with different parameters.

In the first case; mystery will be called if the argument is int.

In the second case; mystery will be called if the argument is double.

In the third case; mystery will be called if the arguments are int and double.

In the fourth case; mystery will be called if the arguments are double and int.

When mystery(7) is called; the mystery method requiring only int will be called and the output is "A".

3 0
3 years ago
What happens when you press Ctrl Alt Delete twice?
Iteru [2.4K]
The same thing as if you do it once
6 0
3 years ago
Which three features can be configured in the BIOS settings to secure a computer?
Vladimir79 [104]
Passwords, TPM, and Drive Encryption.

Hope this helps. :)
8 0
3 years ago
Your manager asks you to calculate the sale price if the product is marked down 20 percent. You enter the original price in cell
padilas [110]
The answer is =A2*.80
7 0
3 years ago
Read 2 more answers
Proszę daje wszystko potrzebuje tego
Stolb23 [73]
I’m sorry I do not speak that
5 0
3 years ago
Read 2 more answers
Other questions:
  • Whichof the following is not a standard method called as part of the JSPlife cycle?jspInit()jspService()_jspService()jspDestroy(
    12·1 answer
  • A(n) _____ allows a user to choose specific files to back up, regardless of whether or not the files have been changed.
    9·1 answer
  • What kinds of online behaviors could be considered cyberbullying?
    7·2 answers
  • Which two technologies support the building of single-page applications? and are two technologies helpful in building single pag
    12·1 answer
  • Linda subscribes to a cloud service. The service provider hosts the cloud infrastructure and delivers computing resources over t
    10·1 answer
  • Why is it so important to have employees who can critically think?
    7·2 answers
  • Can anyone please help me to solve this question?
    10·1 answer
  • Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string,
    9·1 answer
  • What are spreadsheets in a excel workbook called? A. pages B. notepads C.graphs D.worksheets
    10·1 answer
  • Who is katie and why is she deleting my answers
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!