#!/usr/bin/perl
# w4.13.pl   The match operator

require("mylib.pl");
@twinkle = &get_lines("twinkle.txt"); 

print ("Try one: \n");
foreach (@twinkle){
   $count++;
   if (/star/) {print("Found star at line $count\n");} 
   if (/Star/) {print("Didn't find cap Star\n");} 
   if (/Star/i) {print("Case insensitive Star\n");} 
   if (/ar/i) {print("Found \"ar\" at line $count\n");} 
   if (/\bar/) {print("Didn't find \"ar\" as a separate word\n");}
   }

$count = 0;				#reinitialize count
print ("\n\nTry two:\n");
foreach (@twinkle){
   if (/[aou]/) {print("$count: $_");}
   }

print ("\n\nTry three:\n");
foreach (@twinkle){
   if (/w[ih]/i) {print("No wonder:  $_");}
   }

$count = 0;				#reinitialize count
print ("\n\nTry four:\n");
foreach $this_line (@twinkle){
   $count++;
   if ($this_line =~ /H.*wonder/) {print("$count: $this_line");}
   if ($this_line =~ /^twinkle/) {print("won't find beginning lc t\n");}
   if ($this_line =~ /twinkle$/) {print("won't fine ending without comma\n");}
   if ($this_line =~ /twinkle,$/) {print("Ends with comma:  $this_line");}
   if ($this_line =~ /tt/) {print("$count: $this_line");}
   }

__END__
