Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: map-like hash iterator

by ikegami (Pope)
on Mar 26, 2010 at 23:11 UTC ( #831294=note: print w/ replies, xml ) Need Help??

in reply to Re: map-like hash iterator
in thread map-like hash iterator

One further note: this uses the package variables $a and $b to communicate the current key and value to the callback. Therefore, this code must be included (e.g. via "require") in each and every namespace where you want to use it.

No, not good enough. The package used is the package in which the source code was found.


sub hasheesh(&\%) { my( $c, $h ) = @_; local( $a, $b ); { no strict 'refs'; *{caller().'::a'} = \$a; *{caller().'::b'} = \$b; } }

Comment on Re^2: map-like hash iterator
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831294]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2015-03-27 04:35 GMT
Find Nodes?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:

    Results (597 votes), past polls