C
craig.carl
All -
I am following the instructions in Programming Perl (270-271) almost
to the letter, but I still cannot get this to work. I get these errors:
Can't use string ("1") as a symbol ref while "strict refs" in use at
collect2.pl line 11.
or
Can't use string ("") as a symbol ref while "strict refs" in use at
collect2.pl line 11.
data.txt looks like this;
string11, string12, string13
string21, string22, string23
string31, string32, string33
string41, string42, string43
#!/usr/bin/perl
use strict;
use warnings;
my(@AoA) = { };
my($file) = "";
my($line) = "";
#OR next line can read - open(@AoA, "/data.txt") - different error.
open($file, "/data.txt");
while (<>)
{
push @AoA, [split /,/];
}
for $line (@AoA) {
print "@$line\n";
}
I am trying to print out the contents of the array.
Thanks,
C
I am following the instructions in Programming Perl (270-271) almost
to the letter, but I still cannot get this to work. I get these errors:
Can't use string ("1") as a symbol ref while "strict refs" in use at
collect2.pl line 11.
or
Can't use string ("") as a symbol ref while "strict refs" in use at
collect2.pl line 11.
data.txt looks like this;
string11, string12, string13
string21, string22, string23
string31, string32, string33
string41, string42, string43
#!/usr/bin/perl
use strict;
use warnings;
my(@AoA) = { };
my($file) = "";
my($line) = "";
#OR next line can read - open(@AoA, "/data.txt") - different error.
open($file, "/data.txt");
while (<>)
{
push @AoA, [split /,/];
}
for $line (@AoA) {
print "@$line\n";
}
I am trying to print out the contents of the array.
Thanks,
C