InfiniteSilence has asked for the wisdom of the Perl Monks concerning the following question:
Note: Take out the local($_) call in the above example to see that the substitution will take place but will also actually change the contents of @foo.C:\>perl -e "@foo=('one','two'); %m=('1'=>'one', '2'=>' two'); @m_h= grep{local($_);s/tw/tr/g; /^t.*/ig} @foo; print @m_h; pri +nt @foo" onetwo
Celebrate Intellectual Diversity
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Localize $_ in grep
by Zaxo (Archbishop) on Sep 09, 2003 at 19:46 UTC | |
|
Re: Localize $_ in grep
by jeffa (Bishop) on Sep 09, 2003 at 19:35 UTC | |
by Anonymous Monk on Apr 19, 2012 at 04:00 UTC | |
|
Re: Localize $_ in grep (filter)
by tye (Sage) on Sep 09, 2003 at 20:08 UTC | |
|
Re: Localize $_ in grep
by ctilmes (Vicar) on Sep 09, 2003 at 19:39 UTC | |
|
Re: Localize $_ in grep
by hardburn (Abbot) on Sep 09, 2003 at 19:38 UTC |