[ale] OT: one for the Perl Guru's

Robert L. Harris Robert.L.Harris at rdlg.net
Tue Apr 29 14:38:06 EDT 2003



Problem with this grep is that I have a sentance such as

<Header crap> File Foo changed size while backups wile running on host Bar

There's a couple other variations but I'd like it to next if they're
there also.  The keys are pretty much 3-4 word phrases.



Thus spake Fletch (fletch at phydeaux.org):

> >>>>> "Robert" == Robert L Harris <Robert.L.Harris at rdlg.net> writes:
> 
>     Robert>  Say I have an array containing the phrases "foo bar"
>     Robert> "this one" and "one more here" named @IgnoreArray.  Then I
>     Robert> have lines of text being read into 3 variables.  I want to
>     Robert> do something like:
> 
>     Robert>   next if (grep(/@IgnoreArray/, $text));
> 
>     Robert> What's the best syntax for this.  I can make it work if I
>     Robert> were to do a for loop instead of @IgnoreArray but that's
>     Robert> visibly ugly to read.
> 
> OUTER:
> while( $whatever ) {
> 
>   # set sources $foo, $bar, and $baz
> 
>   for( $foo, $bar, $baz ) {
>     next OUTER if grep /$_/, @IgnoreArray;
>   }
> 
> }
> 
> 
> -- 
> Fletch                | "If you find my answers frightening,       __`'/|
> fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
> 770 294-0820 (m)      |  scary questions." -- Jules                =(___)=
>                       |                                               U
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

:wq!
---------------------------------------------------------------------------
Robert L. Harris                     | PGP Key ID: E344DA3B
                                         @ x-hkp://pgp.mit.edu 
DISCLAIMER:
      These are MY OPINIONS ALONE.  I speak for no-one else.

Diagnosis: witzelsucht  	

IPv6 = robert at ipv6.rdlg.net	http://ipv6.rdlg.net
IPv4 = robert at mail.rdlg.net	http://www.rdlg.net

 PGP signature




More information about the Ale mailing list