in reply to problems dereferencing an array of arrays as a hash value

How about a new array reference, like this?

case /packetclassifierlist/ { $tlvHash{pktClassList} = [ @pktClassL +ist ] }

Replies are listed 'Best First'.
Re^2: problems dereferencing an array of arrays as a hash value
by jasonl (Acolyte) on Nov 23, 2009 at 17:14 UTC
    Thanks! That did it, but I'm not quite clear why. Can you explain a little what's going on there?

      The brackets [] create a reference to an anonymous array. With an array inside the brackets like [ @pktClassList ], the contents of the @pktClassList array are copied into the new anonymous array.

      There is a different way to get the same effect, but which avoids the second copy. If the @pktClassList array is a local variable in a subroutine, which gets used only once before going out of scope, then you could have used the @pktClassList array directly like this:

      case /packetclassifierlist/ { $tlvHash{pktClassList} = \@pktClassLi +st }

      The key is the scope of the original @pktClassList array - when the variable goes out of scope, it becomes an anonymous array by virtue of being referenced by the %tlvHash hash. Quite unlike the C language.

      See perlref for more info on references. Anonymous arrays are addressed early in the document.