On Wed, 2008-09-10 at 18:14 -0700, Noah wrote:
> Hi there,
> 
> could somebody please suggest some other ways to simplify the reading
> and perhaps make the following process quicker?  I have a better example 
> now.
> 
> print CHANGE "not sure\n" unless ( grep (/not\ssure/, @lines ) );
> print CHANGE "could be\n" unless ( grep (/could\sbe/, @lines ) );
> print CHANGE "this line\n" unless ( grep (/this\sline/, @lines ) );
> print CHANGE "okay what\n" unless ( grep (/okay\swhat/, @lines ) );
> print CHANGE "daft punk\n" unless ( grep (/daft\spunk/, @lines ) );
> print CHANGE "no way\n" unless ( grep (/no\sway/, @lines ) );
> print CHANGE "wish there\n" unless ( grep (/wish\sthere/, @lines ) );

my @list = (
  {
    re => qr/not\ssure/,
    msg => 'not sure',
  },
  {
    re => qr/could\sbe/,
    msg => 'could be',
  },
  # etc.
);

for my $item ( @list ){
  print CHANGE "$item->{msg}\n" unless( grep( /$item->{re}/, @lines ) );
}



-- 
Just my 0.00000002 million dollars worth,
  Shawn

"Where there's duct tape, there's hope."
        Cross Time Cafe

"Perl is the duct tape of the Internet."
        Hassan Schroeder, Sun's first webmaster


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to