"M.V.Johnson" wrote: > > I am familiar with grep in the shell. Will that grep line work in the > context of a perl script? > > The code is looking at a directory full of .txt files. I want to parse a > line in the .txt file only if the file does NOT contain the line "CLASS IC"
Perhaps something like this (untested): #!/usr/bin/perl use warnings; use strict; my @files = glob 'dir/*.txt'; for my $file ( @files ) { open my $fh, '<', $file or do { warn "Cannot open $file: $!"; next; } my $result; while ( <$fh> ) { if ( something ) { $result = parse_line( $_ ); } if ( /CLASS IC/ ) { $result = undef; last; } } close $fh; do_something_with_result( $result ) if defined $result; } __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]