mstet has asked for the wisdom of the Perl Monks concerning the following question:
The code below works on perl 5.8.1, but gives the error "can't use string ("13") as an ARRAY ref while 'strict refs' in use" when executuing the sort command at the bottom with version 5.10. Help would be appreciated
my $filename = shift; my $refdataarr = shift; my $rows; my $cols; my $Excel; my $Book; my $Sheet; my @files; my @title = (qw/File QAC_off QAC_nod Lvl_9 Lvl_8 Lvl_7 Lvl_6 Lvl_5 L +vl_4 Lvl_3 Lvl_2 Lvl_1 Lvl_0 Sum/ ); my $total_cols = @title; # 14 if ( -f $filename ) { if (! unlink($filename) ) { printf("Can not delete '%s'. Excel file not created!\n", $fi +lename); return; } } $Excel = Win32::OLE->new("Excel.Application",sub {$_[0]->Quit;}) or die "Oops, cannot start Excel"; $Book = $Excel->Workbooks->Add; $Sheet = $Book->Worksheets(1); @files = sort { lc(${@$a}[0]) cmp lc(${@$b}[0]) } @$refdataarr ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "strict" violation on "sort" command with perl 5.10
by jettero (Monsignor) on Apr 28, 2009 at 19:42 UTC | |
by ikegami (Patriarch) on Apr 28, 2009 at 19:51 UTC | |
by AnomalousMonk (Archbishop) on Apr 28, 2009 at 22:36 UTC | |
by ikegami (Patriarch) on Apr 29, 2009 at 00:01 UTC | |
|
Re: "strict" violation on "sort" command with perl 5.10
by jwkrahn (Abbot) on Apr 28, 2009 at 20:01 UTC |