in reply to Correct syntax to access an array slice within a hash within a hash

Just as a sidenote to the advice already given by the others, be sure to note the use of @ to do the slice. EVEN WHEN IT'S A HASH SLICE.

This is because technically, the slice is a list, and in Perl we use @ to indicate a list.

A short example:

# array slice @arr = qw(zero one two three); @arr[1,2] = (2,3) # hash slice %hash = ( one => 1, two => 2, three => 3, four => 4, ); @hash{'two','three'} = qw(two three);
This is done without references, so be sure to dereference your hash ref in your code.

Hope that helps.




Amel
This is my cool %SIG
  • Comment on Re(Amel): Correct syntax to access an array slice within a hash within a hash
  • Download Code