Kevin Meltzer writes ..

>On Fri, Apr 27, 2001 at 08:32:21AM -0400, Timothy Kimball 
>([EMAIL PROTECTED]) spew-ed forth:
>> 
>> grep() will do it easily:
>> 
>> @lines = grep { ! /\.txt$|\.scc$/ } @lines;
>> 
>> or do it when you read the file:
>> 
>> @lines = grep { ! /\.txt$|\.scc$/ } <INFO>;
>
>You are making the RE engine do a log of work there.


if you want to get that particular about performance - then you shouldn't be
using regex at all .. regular expressions are considerably slower for
literal string comparisons that the string comparison operators


  #!perl -w
  use strict;

  open INFO, 'flashimage.txt' or die "Bad open: $!";
  my @lines = map {
                    my $s = substr $_, -5, 4;     # grab the extension
                    $s ne '.txt' and $s ne '.scc' # compare literally
                      and $_                      # and return it
                  } <INFO>;

  print @lines;

  __END__


-- 
  jason king

  In Georgia, you have the right to commit simple battery if provoked
  by "fighting" words. - http://dumblaws.com/

Reply via email to