How is the argument in sleep( 3 ) an lvalue?
In much the same way that
\3 is. Not a very good answer, I know, but it's the best I can do. Perl makes @_ an array of aliases to the arguments, as you know. That's much like taking a reference: it requires Perl to consider the arguments in an lvalue context. That aliasing may not happen on builtin functions like
sleep, though.
Another example of aliasing is a for loop. It also provides an lvalue context:
use warnings;
use strict;
my $x;
# @$x; # This will die if uncommented
for my $foo (@$x) {
print "Gar!\n";
}
While I'm certain that I read about the @_ lvalues phenomenon here on PM, I haven't been able to Super Search it up.
tye mentions it in
Re^5: Warnings not being thrown with DBI (nits).
Caution: Contents may have been coded under pressure.