in reply to expanding a PDL matrix

Hi,
how about this:
#!/usr/bin/perl -w use strict; my @line; my $k = 0; while (<DATA>) { chomp; $line[++$k] = [ split(/\s+/) ]; } my $output = ''; for (my $i = 1; $i <= 35; ++$i) { for (my $j = 1; $j <= 35; ++$j) { if ( $line[$i][$j] ) { $output .= $line[$i][$j] . "\t"; } else { $output .= "0\t"; } } $output .= "\n"; } print $output; __DATA__ 2.8017 0 0 0 0 0 0 0 1.2969 0 0 0 0 0 0 0 0.5495 0 0 0 0 0 0 0 0.2329 0 0 0 0 0 0 0 0.1953 0 0 0 0 0 0 0 0.1723 0 0 0 0 0 0 0 0.0959
Cheers,
Sven