On Wed, Sep 10, 2008 at 06:37:31PM -0500, Wagner, David --- Senior Programmer 
Analyst --- WGO wrote:
> > From: Noah [mailto:[EMAIL PROTECTED] 
> > 
> > could somebody please suggest some other ways to simplify the reading 
> > and perhaps make the following process quicker?
> > 
> > 
> > print CHANGE "what 1\n" unless ( grep (/what\s1/, @lines ) );
> > print CHANGE "what 2\n" unless ( grep (/what\s2/, @lines ) );
> > print CHANGE "what 3\n" unless ( grep (/what\s3/, @lines ) );
> > print CHANGE "what 4\n" unless ( grep (/what\s4/, @lines ) );
> > print CHANGE "what 5\n" unless ( grep (/what\s5/, @lines ) );
> > print CHANGE "what 6\n" unless ( grep (/what\s6/, @lines ) );
> > print CHANGE "what 7\n" unless ( grep (/what\s7/, @lines ) );
> > 
>       print CHANGE "what $1\n" unless ( grep (/what\s([1-7])/, @lines
> ) );

Not really.

  my @what;
  /what\s([1-7])/ && $what[$1]++ for @lines;
  $what[$_] || print CHANGE "what $_\n" for 1 .. 7;

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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


Reply via email to