in reply to scalar in list context
Maybe you mean the context of the assignment?
@array = ( "one", "two", "three" ); ($len) = @array; $len1 = @array; print "1 - ", $len, "\n"; print "2 - ", $len1, "\n";
Where the first will print "one" and the second will print "3", since (IIRC) assignment forces the context of the LHS onto the RHS.
Update: See ikegami's post below for the correct explanation of what I was trying to say.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: scalar in list context
by ikegami (Patriarch) on Jan 26, 2010 at 22:41 UTC |
In Section
Seekers of Perl Wisdom