Is that the code you're actually running? I'm thinking your FIND constant is actually defined as 'MC9' so when you execute the following line, you just print the input_record_separator (which you earlier defined as FIND) once for each line your script reads in.
print IO::File->input_record_separator while $fh->getline;
I'm not familiar with IO::File but that's my best guess as to what you're seeing.
Something like this should work for your purposes:
use strict; use warnings; my $filename = 'search.txt'; my $find = 'MC9'; open(FILE, '<', $filename) or die "Cannot open file: $!"; while (my $line = <FILE>) { print $line if $line =~ /$find/; } close(FILE);
In reply to Re: reading and working with grow.out files
by Riales
in thread reading and working with grow.out files
by rmgzsm9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |