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 ;
In reply to "strict" violation on "sort" command with perl 5.10 by mstet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |