Review Questions for next quiz:


Know your grep!!!

1) Suppose we have a text file that will be read into a perl program using I/O redirection.
Write a complete perl program that will print out all lines that:

a) begin with a 3 digit number (not 2 , not 4)
b) end with a 3 digit number (again, not 2, not 4)
c) contains the name "Bob" or "Alice"
d) does not contain any vowels (upper or lower case)
e) does not contain any digits

2) What changes would you need to make to your program in question 1, so that it also printed out the line number
of matching lines?

3) What is the output of the following program?

#!/usr/bin/perl
use strict;

my @ar=qw<tom dick harry>;
my $a;

$a=3 + @ar;
print "A is $a\n";