in reply to match array values to AoA values

Something like this?

my @a = ( [a1v1,a1v2,a1v3,a1v4], [a2v1,a2v2,a2v3,a2v4], [a3v1,a3v2,a3v3,a3v4], ); for my $rec ( @a ) { print join "\n", map{ ("f1","f2","f3","f4")[ $_ ] . ':' . $rec->[$_] } 0 .. 3; } f1:a1v1 f2:a1v2 f3:a1v3 f4:a1v4 f1:a2v1 f2:a2v2 f3:a2v3 f4:a2v4 f1:a3v1 f2:a3v2 f3:a3v3 f4:a3v4

Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.

Replies are listed 'Best First'.
Re^2: match array values to AoA values
by wfsp (Abbot) on Mar 11, 2005 at 10:34 UTC
    BrowserUk

    What an earth is going on in that map!

    I'd very much appreciate a pointer or two as to what is happening.

    Thanks in advance,

    John

    Update:

    ("f1","f2","f3","f4")[ $_ ]

    It was this that threw me. The list is operating as an array. When $_ == 0 it produces "f1". Another snippet for the toolbox.

    Thanks again.