Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Use of uninitialized value in array element

by Fastolfe (Vicar)
on Jul 12, 2002 at 15:56 UTC ( #181321=note: print w/replies, xml ) Need Help??

in reply to Use of uninitialized value in array element

What if one of these conditions fails:
my ($ts,$cat) = $vals[0] =~ /TS(\d+)(.+)$/; ... for(0..$#cats) { if ($cats[$_] =~ /$cat/) { $j = $_ } } for(@{$groups[0]}) { if ($ts == $_) { $i = 0 } } for(@{$groups[1]}) { if ($ts == $_) { $i = 1 } } for(@{$groups[2]}) { if ($ts == $_) { $i = 2 } }
It looks like somehow, somewhere, either $i or $j is left undefined. Add some print statements in your loops that print out the values of your various variables and check that your assumptions are valid here. Could there be an empty line in your input?

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://181321]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2023-02-06 20:51 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (36 votes). Check out past polls.