Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Autovivification of scalars in sub calls

by Roy Johnson (Monsignor)
on Dec 08, 2005 at 18:47 UTC ( #515333=note: print w/replies, xml ) Need Help??

in reply to Re^2: Autovivification of scalars in sub calls
in thread Autovivification of scalars in sub calls

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515333]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2020-08-03 09:24 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (23 votes). Check out past polls.