#!/usr/bin/perl -w use strict; use Data::Dumper; my @x= qw(1 2 3 4); my @y= qw(7 8 9 10 11 12 13 14); my $num = $y[@x]; # @x evaluates here to the number "4"!!! # the number of elements in @x # As said before this is a VERY unusual # formulation!!! # It looks weird because it is weird. # As mentioned above more normal would be # $y[@x-1] or $y[$#x] # I'm not saying that $y[@x] cannot have a defined, # value but just that it is "strange" absent other # context and would be worthy of a comment in the # code. print "The number in y is: $num\n"; #the 5th thing in @y!! WHOA! #print $x[@y]; # ERROR: Use of uninitialized value in print # this is because: $x[8] is undefined! # However consider this: # here [@x] means something completely different push @y, [@x]; # this means: assign new memory, # copy @x into that new memory , # push a reference to that memory # onto @y print Dumper \@y; __END__ The number in y is: 11 ### the 5th thing in @y $VAR1 = [ '7', '8', '9', '10', '11', '12', '13', '14', [ '1', '2', '3', '4' ] ];