in reply to Re: Values not printing.
in thread Values not printing.
stores the value of $vars[1] rather than the size of @vars[0,1]$hash3{$vars[2]} = (@vars[0,1]);
You can test this yourself by placing a print $hash3{$vars[2]} , "\n"; underneath the line that qball originally wrote.
(@vars[0,1]) is a list but not an array. When perl evaluates a list in scalar context it usually throws out everything except for the last element. The last element of the slice @vars[0,1] is $vars[1]. Hence, that is what perl stores.
The distinction between scalar and list contexts, and the implicit overloading of the two by most functions, is one of the key and distinctive elements of Perl. It may be that the genius of Larry Wall, and the success of Perl, all comes down to that critical distinction.
|
|---|