If you have a subroutine and you want to return "nothing", meaning not "undef", not "zero", I mean absolutely "nothing", what do you do?
This little gem, is on page 136 of "Effective Perl". It passes without even a comment!! Whoa!
Lets say that we have:
@output = map{zoomy_function}@input;
Map{} is a critter that processes each @input and spews out an @output (map{} is a transformation operator).
But, what would happen if for example the zoomy_function within map{} decides that it wants to "throw a value away". How do you do that? In Perl you can't even just exit a sub. The value of the last statement in a Perl sub is gonna get returned. What is that return value gonna be? "undef","0","-1"?
In Perl, you can return (), which means that NOTHING is returned! Something can just come into the func and no result ever comes out. The "black hole" of map().
In reply to Re^3: reset particular variable
by Marshall
in thread reset particular variable
by abubacker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |