following the example in the perldsc (data structures cookbook), i wrote this 
piece of code to create an array of arrays from a data file :  


#!/usr/bin/perl -w
use strict ;

my @AofA ; # array of arrays of file contents
open (fh1, "</path/to/filename/filename.txt") or die ("no can do") ;
while (<fh1>) {
    push @AofA, (split /\t/) ;
}

close (fh1) ;

print $AofA[0] ; 
print "\n" ;
# this gives me "cho" when what i wanted was "cho   249   837"
# later, i was hoping to use $AofA[0][0] to access "cho"

an example of the file follows (fields are separated by tabs in "real life")
cho     249    837
abc     123    456
abc     984    235
nurb    246    973


it appears the problem is where i am doing the "push" while reading the file.

suggestions?

thanks

joe


-- 
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