in reply to element of an array of arrays

this pushes one joined line

DB<103> push( @Records, join ',', ( "AAA", 20130610, 730, 1015, "\n" + ) ); => 1 DB<104> \@Records => ["AAA,20130610,730,1015,\n"]

you rather want something like

DB<106> push @Records, [ "AAA", 20130610, 730, 1015 ]; => 1 DB<107> \@Records => [["AAA", 20130610, 730, 1015]] DB<108> $Records[0][2] => 730

see perldsc#ARRAYS OF ARRAYS

Cheers Rolf

( addicted to the Perl Programming Language)

UPDATES

extended code examples

Replies are listed 'Best First'.
Re^2: element of an array of arrays
by JockoHelios (Scribe) on Jun 17, 2013 at 02:28 UTC
    The joins were an attempt to correct the problem I was initially running into.

    Without the joins, that syntax produced a similar error. But it was stating that I couldn't use the string "20130610" as an array reference. Using the joins produced the error with the entire row as the string I couldn't use.

    Dyslexics Untie !!!
      Sorry I don't understand you!

      Could you plz give me an code example reproducing this other error?

      Maybe the problem is connected to the fact that you are trying to print the AoA in a whole

      print  @array

      ... this will result in a list of stringified array-refs.

      ARRAY(0x8bfc3f8) ...

      Better use Data::Dumper Dumper like kcott showed you or print the single subarrays to get the leaf-elements stringified.

      print "@$_\n" for @array;

      HTH

      Cheers Rolf

      ( addicted to the Perl Programming Language)