On Fri, 23 Aug 2013 17:06:41 +0100
jet speed <speedj...@googlemail.com> wrote:

> my @check = (fc3/23, fc10/1, fc3/14, fc12/12);

my @check = qw( fc3/23 fc10/1 fc3/14 fc12/12 );

> 
> my $f2 = 'out.txt';
> for my $element(@check) {
> open my $fh2, '<', $f2 or die "could not open $f2: $!";
> while (my $line = <$fh2>) {
> chomp $line;

# put the for loop inside the while
open my $fh2, '<', $f2 or die "could not open $f2: $!";
while (my $line = <$fh2>) {
    chomp $line;
    for my $element(@check) {
        if( $line =~ /^\Q$element\E\s/ ){
            print "$line \n";
            last;
        }
    }
}



-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to