in reply to How can I print out part of the matrix

How are you building your matrix? If you're using an array of arrays, simply loop through the outer array and print the data in the inner array:

#!/usr/bin/perl -w use strict; my @aoa = get_data; foreach my $row(@aoa) { print "$row->[$_] " for (1, 2, 3, 5, 9, 10, 38, 126); print "\n"; }

If you don't know what columns you need to print ahead of time, build an array of the indices you need and use

print "$row->[$_] " for @indices;

-Mike

Replies are listed 'Best First'.
Re: How can I print out part of the matrix
by Abigail-II (Bishop) on Jun 03, 2002 at 10:47 UTC
    But that means you're making many calls to print. Why not just:
    print "@{$_}[1, 2, 3, 5, 9, 10, 38, 126]\n" for @aoa;

    Abigail