zing has asked for the wisdom of the Perl Monks concerning the following question:
Hi all ,
I have this data file
b c a
a c d
d e b
And this code reads this data file into a 2d array.Now what I want is another array which reads only first two columns of the array @S.use strict; use warnings; use Data::Dumper; # use PDL; my @S; while (<>) { push @S, [ split ]; } print "-----TRIPLETS-------\n"; print Dumper \@S; print "\n$S[0][1]\n"; # Find the number of vertices my @L; for my $i ( 0 .. $#S ) { for my $j ( 0 .. $#{ $S[$i] } ) { #print "elt $i $j is $S[$i][$j]\n"; push (@L,$S[$i][$j]); } }
b c
a c
d e
|
---|
Back to
Seekers of Perl Wisdom