in reply to Special Variable help
It looks like you never assigned $line to anything, and are searching its contents, which are undefined. You may be getting confused about how Perl's default $_ is used in pattern matching. The program would do what you want if you left off the variable my $line and changed the if statement to read:
if ( /A-Za-z/ )... since $_ has the line data in it, not $line. Or conversely you could put the line data into the variable like this...
while( my $line = <FH> ) { if ( $line =~ m/A-Za-z/ ) { .... } } close FH
|
|---|