TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:21227] Newbie perl question
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+