I offer:
use strict; use warnings; my %element; while (<DATA>){ my ($elem, $value) = split; $element{$elem}= $value; } print " "; print "$_ " for sort keys %element; print "\n"; for my $k1(sort keys %element){ print "$k1 "; for my $k2(sort keys %element){ my $val = $element{$k1} eq "X" ? 0 : $element{$k2} eq "X" ? 0 : 2; print $val . " "; } print "\n"; } __DATA__ A X B Y C Z D X E X
I hope life isn't a big joke, because I don't get it.
-SNL
In reply to Re^3: matrices and non-numerical values
by NetWallah
in thread matrices and non-numerical values
by thschhk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |