in reply to Re^4: perlcritic and MCE::Loop
in thread perlcritic and MCE::Loop
That's obvious.
Defining an anonymous sub won't execute it but return the code-ref.
DB<39> p sub { print "run @_" } # returns ref CODE(0x2e80a90) DB<40> sub{ print "run @_" }->(1..3) # calls ref run 1 2 3 DB<41>
Though I'm a bit surprised, my muscle memory wanted brackets around the ref for precedence:
( sub{ print "run @_" } )->(@_)
this could still be needed in other contexts. (or - more likely - it's just cargo cult from JS ;)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|