use strict my @baz = 'hello there' # this is a list print @baz[0] # => h print @baz[6] # => t my @foo = [ 'hello', 'there' ] # this is a list of 2 lists @foo = split ' ', @baz # so is this? print @foo # => "hellothere" print len @foo # => 2 print @foo[0][1,3,4] # => "elo" print @foo[1][3..5] # => "ere" push @foo, 'how', 'are', 'you?' @foo[0,3] = [ 'goodbye', 'were' ] # # Why would you "emulate" a hashmap using lists? # Would a list of pairs work? # Sorting a hash automagically sorts by keys? # my @bar = { 'a' => 1, 'b' => 2, 'c' => 3 } # # is perhaps translated to the access-inefficient: # # my @bar = [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ] # # do we assume hash access looks the same? print @bar{a} # => 1 @foo = @bar{a,b,c} # => [ 1, 2, 3 ] print @foo # => 123 print join ',', @foo # => 1,2,3 print join ',', @bar # => ???