----- Original Message -----
From: "chen li" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: <beginners@perl.org>
Sent: Sunday, August 20, 2006 2:20 PM
Subject: String or numbers in AoA?
Dear all,
I try to read some records in one file. Each record
consists of several column which are separated by tab
and ends by "\n". What I would like to do is that to
build an array of array so that each record is a
reference to an anonymous array.
Here is the format in the file:
1 2 3
1 2 3
I would like to get this output:
@AoA=(
[1,2,3],
[1,2,3],
)
or
$VAR1 = [
1,
2,
3,
];
$VAR2 = [
1,
2,
3,
];
But when I use Data::Dumper to check the result I get
the following output, which are not what I want.
$VAR1 = [
'1 2 3'
];
$VAR2 = [
'1 2 3'
];
Any comments will be appreciated.
Li
########code############
#!c:/Perl/bin/perl.exe
use warnings;
use strict;
use Data::Dumper;
my $file_name="data.txt";
open (FH,$file_name) or die " cant' open
$file_name$!";
my @AoA;
while (my $line=<FH>) {
chomp $line;
my @temp=split(/t/, $line);
my @temp=split(/\t/, $line);
^
push @AoA, [EMAIL PROTECTED];
}
print Data::Dumper->Dump([EMAIL PROTECTED]);
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>