You have correctly used use strict
and use warnings
, and one of the benefits is that Perl will warn you if you use a variable you haven't declared. The error message
Global symbol "$tabbb" requires explicit package name at mix.pl line 8.
is saying that, because you are using strict
, you cannot refer to a variable called $tabbb
that hasn't been declared. Your line
print @$tab;
is dereferencing the scalar variable $tab
as an array, and since you haven't declared a $tab
I imagine that is what the error message means. However you do have an array variable @tab
that contains the contents of the file you opened, so write
print @tab;
instead.
Best of all, read the file line-by-line and write
use strict;
use warnings;
open my $fh, '<', 'seeds.data' or die $!;
while (<$fh>) {
print;
}