Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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.

Fix:

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831294]
help
Chatterbox?
[LanX]: YM: BTW learn to mute your humanity
[Your Mother]: Cumin? Now I want tacos...
[Eily]: there should be an option in grep for fuzzy order of the letters in the pattern
[Eily]: as in "I might have inverted two, but my eyes misread in the some order as my fingers mistype"
[LanX]: can't find a definition for the sound

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (13)
As of 2017-03-27 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.