I just tried "empty @a" against my solution. The _ prototype forces scalar context on the first argument:
/opt/perl/bin/perl5.10.0 -M5.10.0 -e 'sub display(_){say $_[0]};@a=(); +display(@a);push@a,"x";display(@a)'
Whether that is considered to be unintuitive or not depends on the user I guess
In reply to Re^2: Is it possible to write a sub that understand default variables ?
by Corion
in thread Is it possible to write a sub that understand default variables ?
by bcarnazzi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |