Path: utzoo!attcan!uunet!snorkelwacker!apple!rutgers!psuvax1!news From: flee@guardian.cs.psu.edu (Felix Lee) Newsgroups: comp.lang.perl Subject: Re: address sniffing hack Message-ID: Date: 27 Jul 90 05:11:02 GMT References: Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 16 Nntp-Posting-Host: guardian.cs.psu.edu > # sniff addresses out of an input text. Here's my one-line equivalent... $/='@'; <>; grep(/^\w+(\.\w+)+/ && !$u{$&}++ && print("$&\n"), <>); It's curious that this one line came to mind without thought. Writing a while loop would have taken more effort. I feel like I'm stuck using particular idioms, writing in a specific dialect of perl. Randall would probably have used an "s///eg" expression. Hmm. s/@(\w+(\.\w+)+)/$u{$1}++ || print("$1\n")/eg while (<>); Not the type of code I'd like to maintain. Oh well. -- Felix Lee flee@cs.psu.edu