reaper9187 has asked for the wisdom of the Perl Monks concerning the following question:
I get the error.. "Cant use string "Mon" as array ref while strict refs in use ... "use Data::Dumper; use strict; our (@a,$c,$key,$bar); #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Tk; use Tk::Chart::Lines; my $mw = MainWindow->new( -title => 'Tk::Chart::Lines example', -background => 'white', ); my $chart = $mw->Lines( -title => 'My graph title', -xlabel => 'X Label', -ylabel => 'Y Label', )->pack(qw / -fill both -expand 1 /); @a = qw/Mon Tue Wed Thurs/; foreach $key(@a) { push(@{${$key}[0]},1,33); push(@{${$key}[0]},22,11); push(@{${$key}[1]},2,5); push(@{${$key}[2]},3,4); } $c ="Mon"; # Add a legend to the graph my @legends = ( 'legend 1', 'legend 2', 'legend 3' ); $chart->set_legend( -title => 'Title legend', -data => \@legends, -titlecolors => 'blue', ); # Add help identification $chart->set_balloon(); print Dumper(@$c); # Create the graph $chart->plot( @$c ); MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cant use string(_) as array ref..!!
by choroba (Cardinal) on Jan 24, 2013 at 09:17 UTC | |
|
Re: Cant use string(_) as array ref..!!
by Anonymous Monk on Jan 24, 2013 at 09:14 UTC | |
|
Re: Cant use string(_) as array ref..!!
by thundergnat (Deacon) on Jan 24, 2013 at 14:33 UTC | |
|
Re: Cant use string(_) as array ref..!!
by reaper9187 (Scribe) on Jan 24, 2013 at 09:22 UTC | |
by vinoth.ree (Monsignor) on Jan 24, 2013 at 10:14 UTC |