I wish / ... / that there was some other way to detect no arguments without forcing the 1st argument into a reference.
There is, kind of.
This will make $_[0] become aliased with $_ if foo was called with &foo and without the parenthesis. Personally I wouldn't use this. It will only lead to trouble.sub foo { (caller(0))[4] or return foo($_); ...; }
lodin
In reply to Re^3: Is silent use of $_ for empty argument lists reasonable for "shortcut" functions? (E2CUTE) (&foo;)
by lodin
in thread Is silent use of $_ for empty argument lists reasonable for "shortcut" functions?
by Wyrdweaver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |