On Sat Dec 10 11:51:52 2011, sprout wrote: > On Sat Dec 10 09:55:36 2011, fany@cpan.org wrote: > > > > This is a bug report for perl from fany@cpan.org, > > generated with the help of perlbug 1.39 running under perl 5.14.2. > > > > > > ----------------------------------------------------------------- > > [Please describe your issue here] > > > > > > When I use a function which expects a codeblock as first > > argument, like List::Util::first(), within a "given" block, > > then $_ within that codeblock does not work properly, but > > keeps the value of the $_ from the "given" block. > > > > Or, in other words, the test script below will output the > > following: > > > > 1 - 2 - 3 - grep OK! > > 1 - first OK! > > 1 - fpp OK! > > 1 - 2 - 3 - grep within given OK! > > 0 - 0 - 0 - > > 0 - 0 - 0 - > > > > Kind regards, > > fany > > This is a known issue, #67694. given does an implicit ‘my $_’. See > also ticket #90018 and ticket #53186 (marked as resolved, even though it > isn’t). BTW, the easiest workaround is to use ‘for’ instead of ‘given’. You can still use ‘when’ inside ‘for’. -- Father ChrysostomosThread Previous