[Chicago-talk] Using "@" to reference element in array
Randal L. Schwartz
merlyn at stonehenge.com
Thu Oct 1 16:05:58 PDT 2009
>>>>> "Jay" == Jay Strauss <me at heyjay.com> writes:
Jay> print @array;
Think of that as the same as @array[2..2], as in, a list that has
only one element. "print" prints a single element list in the same
way that it prints a scalar.
But let's put this on the left side of an assignent:
$array = @ARGV; # get the count of arguments into $array
@array[2..2] = @ARGV; # get the first argument ($ARGV) into $array
quite different reactions!
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the Chicago-talk