Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Why? uninitialized value in pattern match when using if (defined)

by pKai (Priest)
on Mar 22, 2006 at 21:29 UTC ( [id://538608] : note . print w/replies, xml ) Need Help??


in reply to Re: Why? uninitialized value in pattern match when using if (defined)
in thread Why? uninitialized value in pattern match when using if (defined)

Maybe so. Though we don't now by now, what the warning actually refers to.

The OP is not very clear about this, but the consensus in the replies seems to be that the offending operation takes place inside a block guarded with:

if ($factories{$tmpf})

If $factories{$tmpf} had been undef, perl would not have reached the inside of that conditional block.

Of course this is also pure guesswork, unless the OP succeds in posting some code to reproduce the problem. :-D

Replies are listed 'Best First'.
Re^3: Why? uninitialized value in pattern match when using if (defined)
by kwaping (Priest) on Mar 22, 2006 at 22:51 UTC
    Thank you for the reply, you make a good point that I didn't consider.

    ---
    It's all fine and dandy until someone has to look at the code.
      (Sorry for the delay in responding -- I thought I had written a reply, but apparently I haven't figured out the interface software, entirely, yet). Anyway, I've decided to rewrite the offending code. It appears as if the actual problem was something inside the block guarded by if ( defined $factories{ $tmpf}) -- cleaning that error up removed the warning. I'll try to post a more complete code snippet next time - I had intended to clean it up so it would be least confusing, and clearly went too far. Thanks to all who replied. I was rather surprised at the quantity (and helpfulness) of the responses.