TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:21227] Newbie perl question
Sorry, I would not have suggested it seeing John's suggestion, but I did
not see it in time as my email seems to be on the slow boat today (to
and from).
:-)
Dave Sherohman wrote:
>
> Troy A. Johnson said:
> > Could you do this:
> >
> > @addrlist = grep(!/$addr/, @addrlist);
>
> John Trammell suggested
>
> @addrlist = grep { $_ ne $addr } @addrlist;
>
> which, if I understand correctly, is roughly equivalent, but the { ne }
> version will match the full text only, while the /$addr/ version will match
> substrings also. (And we don't want bad input of "@" to remove all email
> addresses!)
>
> @addrlist = grep !/^$addr$/, @addrlist;
>
> seems to work, though.
>
> --
> "Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
> "So does syphillis. Good thing we have penicillin." - Matthew Alton
> Geek Code 3.1: GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
> !K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org
--
Troy Johnson mailto:john1536@tc.umn.edu http://umn.edu/~john1536/
To stay young requires the unceasing cultivation of the ability to
unlearn old falsehoods.
-- Lazarus Long