Re: s/// w/o intermediate variables?
Paul Makepeace <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
Je 2004-05-04 20:30:40 +0100, [email protected] skribis: > From: [email protected] (Randal L. Schwartz) > Date: 04 May 2004 09:26:52 -0700 > >>>>> "Greg" == Greg Allen <[email protected]> writes: > Greg> $tranformed = map {local $_=$_; s,::,/,g; $_} $package > > Ugh. I'd strangle someone who did that. > > $tranformed = do { local $_ = $package; s,::,/,g; $_ }; > > better? ($transformed = $package) =~ s,::,/,g; The expression evaluates as a whole differently (1, probably) but then you win by not being strangled. And spelling transformed correctly never hurts :-) Paul -- Paul Makepeace ................................ http://paulm.com/ecademy "If thomas power could not talk, then we cried 'til the cows came home." -- http://paulm.com/toys/surrealism/