On 10/3/07, Mahurshi Akilla <[EMAIL PROTECTED]> wrote:
> is there an easy way (without iterating through the array) to get a
> specified column out of a 2d array?
snip

You need a loop of some form.  The map function works well here (this
is the sort of thing it was made for), but a for loop with some pushes
works as well.

#!/usr/bin/perl

use strict;
use warnings;

my @array = (
        [1,2,3,4],
        [5,6,7,8]
);

my @column_two = map { $_->[1] } @array;

print join(', ', @column_two), "\n"

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to