Even if you found a fix that seems to make it work, do not ignore the good advices GrandFather (and others) gave you. To add to them:
my $temp; my $code; my $info; my $count = 0;
Generally variables should be declared in the innermost lexical scope in which they're actually needed rather than all at the top.
my $length = scalar@contents;
no need for that explicit scalar. And as a matter of style, Perl is a free form language: try to adjust whitespace to improve readability. (Or to degrade it - but only if you're playing obfu!)
for(my $i=0;$i<=$length;$i++) {
As a general rule, there are situations in which C-style for loops are preferrable. But they're rare! more commonly it is recommendable to use Perl-style ones, and in particular in this case I don't see what the former buys you over the latter.
if($temp == 1) { $tier = "WEB"; } if($temp == 2) { $tier = "APP"; } if($temp == 3) { $tier = "DB"; } if($code1 != 0) { $severity = 1; } if($code1 = 0) { $severity = 5; }
These smell like you may save some complexity and use a hash instead. That would make the code more maintainable as well: you'd just have to add/remove/modify keys accordingly.
In reply to Re^2: the variable is not getting assigned
by blazar
in thread the variable is not getting assigned
by s_gaurav1091
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |