Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
but it s not working. I check my logs and apparently $_ is undefined.$foo->baz('abe'=>&linc, map {"$_" => sub {return '<H1>'.$_.'</H1>'}; } '1'..'5'
How'd that happen?
I fixed it by saying
which kinda worked but not really ($b didn't change). finally after i've said my($a,$b) it all worked out as planned.map { $a = $b = $_; $a => sub {'<H1>'.${b}.'</H1>'} } 1..5,
I remember this being a scope issue (it's documented), but that doesn't explain what happened to $_?
Can somebody confirm/deny/shed some light on this?
(i'm running Win32 ActivePerl v5.6.1 build 631)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: funky $_ with map {}
by jeffa (Bishop) on Mar 02, 2002 at 13:59 UTC | |
by Anonymous Monk on Mar 02, 2002 at 20:37 UTC | |
by Juerd (Abbot) on Mar 02, 2002 at 23:31 UTC | |
|
Re: funky $_ with map {}
by Juerd (Abbot) on Mar 02, 2002 at 15:12 UTC | |
|
Re: funky $_ with map {}
by jlongino (Parson) on Mar 02, 2002 at 20:18 UTC | |
by rjray (Chaplain) on Mar 02, 2002 at 20:25 UTC | |
|
Re: funky $_ with map {}
by shotgunefx (Parson) on Mar 02, 2002 at 21:13 UTC | |
|
Re: funky $_ with map {}
by Anonymous Monk on Mar 03, 2002 at 03:52 UTC | |
by Juerd (Abbot) on Mar 03, 2002 at 10:40 UTC |