> Aditi Gupta wrote:
>> Hello Everybody,
> 
> Hello,
> 
>> We can get rows of a 2D array as
>> 
>> $aref = $AoA[$i];
>> print @$aref; #will print row 'i' as an array
>> 
>> How can I print column 'i' as an array using references? Is there any
>> other way which doesn't require two 'for loops' to print the columns?
> 
> print @{ $AoA[ $i ] };


Isn't this the same thing?  He wants to print the *columns*.

It's still a loop, but you can use this:

$i = 7;  # to print column 7
print map { $_->[$i-1] } @AOA;

- B




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


Reply via email to