I have use Perl in the past but I am by no means a proficient user. I have a small script which reads in a file and loads two multidimensional arrays. The problem I am having is that when I try to load an array element I get the following error: Can't use string ("ClearCase0102201907") as an ARRAY ref while "strict refs" in use at test.pl line 67. The following is a snippet of the code where the error occurs. above the snippet is where I initialize my variables and below is where I try to print the arrays. When I don't use strict it runs however the printout of the array is wrong. I may need help on why however, I am hoping that it is because I did not fix this error. I placed multiple pound signs (e.g. #########) at the end of the line for the error. I believe it is actually complaining about the line above.
my $mtab; my $mtab1; my @mtab = (); my @mtab1 = (); open (TMP2, ">C:\\SCCI\\scci_clearcase\\temp2_out\.txt"); open (TMP3, "<C:\\SCCI\\scci_clearcase\\temp3_out\.txt"); # # Load Metrics table # while ($str = <TMP3>) { $product=""; $date=""; $hour=""; $user=""; $day=""; $dum1=""; $dum2=""; $i=0; $j=0; $k=0; $l=0; chomp $str; ($dum1,$dum2) = split(/ /,$str,2); ($i,$j,$k,$l) = split(/,/,$dum1,4); ($product,$date,$hour,$user)=split(/,/,$dum2,4); $tmpval=$product.$date.$hour; if ($product ne $old_product) { $old_product = $product; $ii++; $jj = -1; } $jj++; $mtab1[$ii]=$tmpval; $mtab1[$ii][$jj]=$user; ############# This is the line reference +d for the error print TMP2 "ii = $ii \t jj = $jj mtab product = $mtab1[$ii] \t mta +b user = $mtab1[$ii][$jj]\n"; $mtab[$i]=$product; $mtab[$i][$j]=$date; $mtab[$i][$j][$k]=$hour; $mtab[$i][$j][$k][$l]=$user; print TMP2 "$i, $j, $k, $l user = $user mtab = $mtab[$i][$j][$k][ +$l]\n"; } close(TMP3);
In reply to Why am I getting Can't use string (<string value>) as an ARRAY ref wile "strict refs" in use by 5NOMAD7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |