Modulemy %p = ( outputdir => undef, rptfmt => 'html', rptname => undef, rptfile => '', title => undef, headers => [], data => [], stdout => 0, ); .... cut ..... my $rpt = Report->new($p{title}, $p{headers}, $p{data});
The module fails on the last line shown. The error is: Can't use string ("9") as an ARRAY ref while "strict refs" in use at .//Report.pm line 72. I am following an example I was given so it must be outside the module that is wrong.. Any ideas?sub new { my ($class,$title,$head,$data,$info) = @_; my $self = {}; bless ($self, ref ($class) || $class); $title ||= ""; $head = [] if !$head || ref $head ne 'ARRAY'; $data = [] if !$data || ref $data ne "ARRAY"; #$rows = $#{@$data} if $data || ref $data eq "ARRAY" || ref $$data +[0] ne "ARRAY"; my ($cols,$rows,@justify) = ($#{@$head},$#{@$data});
In reply to Cannot find error : Can't use string ("9") as an ARRAY ref while "strict refs" ... by smoky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |