$ time perl -e 'open my $fh, "<", "words.txt" or die; my @w = <$fh>; > my $c; > foreach $line(@w) { > if ($line =~ /s.*h/i) { > if ( ($line =~ /s.*s/i) || ($line =~ /h.*h/i) ) { > next; > } > $c++; > } > } > print "$c \n"; > ' 2834 real 0m0.138s user 0m0.093s sys 0m0.016s #### $ time perl -e 'open my $fh, "<", "words.txt" or die; > my $c; > foreach $line(<$fh>) { > if ($line =~ /s.*h/i) { > if ( ($line =~ /s.*s/i) || ($line =~ /h.*h/i) ) { > next; > } > $c++; > } > } > print "$c \n"; > ' 2834 real 0m0.120s user 0m0.093s sys 0m0.015s