in reply to Re^7: Can't use string as an ARRAY ref
in thread Can't use string as an ARRAY ref

I know, and that is the nature of my problem, I just don't don how to get around that.

Replies are listed 'Best First'.
Re^9: Can't use string as an ARRAY ref
by poj (Abbot) on Aug 24, 2015 at 16:13 UTC

    What are the structures returned by get_person().
    my ($princ, $type, $person) = get_person();
    poj

Re^9: Can't use string as an ARRAY ref
by Anonymous Monk on Aug 24, 2015 at 16:36 UTC
    The structures are in this format,I use "unshift" to add the header:
    $VAR1 = [ [ '12345', 'MONICA', '01/01/1900', '0X10' ], [ '000001', 'MARY L', '01/01/2000', '0111P' ], [ '8884', 'JOHN M.', '01/01/1932', '0OK8' ], ]; $VAR1 = [ [ 'Main', '1900', 'Red', ], [ 'APT', '1290', 'Blue', ], [ 'AVAL', '1921', 'Green', ], ]; $VAR1 = [ [ 'Q3.0', 'OK', '1900-01-01', 'N', 'O', 'O', 'X', 'Y' ], [ '12w', 'PL', '2000-01-02', 'N', 'P', 'O', 'X', 'A' ], ];

      I don't mean these structure

      my $princ = $just_data->{$member_number}{princ}; unshift @$princ,["Header 3a", "Header 3b", "Header 3c", "Header 3d"];

      I mean the ones used here

      foreach my $princ_row ( @{$princ} ) { my $member_number = shift @{ $princ_row }; push ( @{ $just_data->{$member_number}{princ} }, $princ_row); }

      There should be member_number common to all 3 structures (princ,type,person) in the first column.
      It's a bit confusing having the same variable name.

      poj
Re^9: Can't use string as an ARRAY ref
by Anonymous Monk on Aug 24, 2015 at 18:22 UTC
    Here is a sample, are these the structures you asked?
    $VAR1 = { 'first' => { 'princ' =>[ [ '12345', 'MONICA', '01/01/1900', '0X10' ], [ '000001', 'MARY L', '01/01/2000', '0111P' ], [ '8884', 'JOHN M.', '01/01/1932', '0OK8' ], ], 'type' =>[ [ 'Main', '1900', 'Red', ], [ 'APT', '1290', 'Blue', ], [ 'AVAL', '1921', 'Green', ], ], 'person' => [ [ 'Q3.0', 'OK', '1900-01-01', 'N', 'O', 'O', 'X', 'Y' ], [ '12w', 'PL', '2000-01-02', 'N', 'P', 'O', 'X', 'A' ], ] }, 'second' => { 'princ' =>[ [ '12345', 'MONICA', '01/01/1900', '0X10' ], [ '000001', 'MARY L', '01/01/2000', '0111P' ], [ '8884', 'JOHN M.', '01/01/1932', '0OK8' ], ], 'type' =>[ [ 'Main', '1900', 'Red', ], [ 'APT', '1290', 'Blue', ], [ 'AVAL', '1921', 'Green', ], ], 'person' => [ [ 'Q3.0', 'OK', '1900-01-01', 'N', 'O', 'O', 'X', 'Y' ], [ '12w', 'PL', '2000-01-02', 'N', 'P', 'O', 'X', 'A' ], ] } };

    Thanks!

      No, that looks like a dump of $just_data. I wanted a dump of these ($princ, $type, $person) = get_person(); that are used to build $just_data.

      poj
        Hi, these are the dump of ($princ, $type, $person) = get_person();
        $VAR1 = [ [ '12345', 'MONICA', '01/01/1900', '0X10' ], [ '000001', 'MARY L', '01/01/2000', '0111P' ], [ '8884', 'JOHN M.', '01/01/1932', '0OK8' ], ]; $VAR1 = [ [ 'Main', '1900', 'Red', ], [ 'APT', '1290', 'Blue', ], [ 'AVAL', '1921', 'Green', ], ]; $VAR1 = [ [ 'Q3.0', 'OK', '1900-01-01', 'N', 'O', 'O', 'X', 'Y' ], [ '12w', 'PL', '2000-01-02', 'N', 'P', 'O', 'X', 'A' ], ];