it report the error: "Use of uninitialized value in addition (+) at dup.pl line 6.." If I change that line code to "$dup{$row3}++", then it's all right. Who can tell me why this happened? Thanks.1 #!/usr/bin/perl -w 2 use strict; 3 my %dup; 4 while(<>){ 5 my @row=split(/\s+/,$_); 6 $dup{$row[3]}=$dup{$row[3]}+1; #if change to $dup{$row[3]}++, it w +ill run smoothly no error report 7 } 8 9 foreach my $id (keys %dup){ 10 if ($dup{$id}>1) { 11 print "$id\t$dup{$id}\n"; 12 } 13 }
In reply to why such an error? by lightoverhead
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |