Use of uninitialized value in string eq at UOT_mississauga.pl line 40
If the line 40 in your posted code is the same as the line 40 in your script, that means that the marked line below is the source of the problem.
my @coursename; my @c_arr ;# Course array $mech->get($url); $html = $mech->content(); $stream->get_tag("option"); while(my $token = $stream->get_token()){ my $check = $token->[2]{name}; if($check eq "dept[]"){ while(my $token = $stream->get_token('option')){ #### THE LINE BELOW TRIGGERED THE FOLLOWING MSG #### #### Use of uninitialized value in string eq #### if($token->[1] eq "option"){ $course_num = $token->[2]{value}; $department = $stream->get_trimmed_text(); $dep{ $course_num } = [$department]; } } } }
If I have the right line, my guess is that the value of $token->[1] is undefined. To verify that $token->[1] (or any other variable you might care about) is undefined, you can insert code similar to the following code snippet.
# value surrounded with < > to make it easier to see # empty strings print STDERR "token[1]=<" . (defined($token->[1]) ? $token->[1] : 'undef') . ">\n";
In future posts, please mark the exact line mentioned in the error message along with the error message as I have done above. We have no way of knowing whether the line numbers of the posted code match the line numbers of your script and will be playing guessing games about where your error might be unless you mark it for us.
Best, beth
In reply to Re: Darn Hash refs
by ELISHEVA
in thread Darn Hash refs
by uni_j
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |