in reply to Re^3: Use of uninitialized value in pattern match (m//)
in thread Use of uninitialized value in pattern match (m//)

The part in parens produces an anonymous array that the "for" will iterate over, and the last element of that array the "undef" element from the last attempt to read from the file handle and encountering 'eof'. If you used a while loop instead, you wouldn't enter the block (lines 25 and 26 would not be reached) on that last attempt to read from the file.

um, none of that :) if the match fails $participant is undef , when you try to print var which is undef you get uninitialized warning

$ perl -MData::Dump -we " open $fake, q{<}, \qq{a\nb\nc\n\n}; for(<$fa +ke>){ dd($_); }" "a\n" "b\n" "c\n" "\n"

Replies are listed 'Best First'.
Re^5: Use of uninitialized value in pattern match (m//)
by graff (Chancellor) on Mar 18, 2015 at 01:36 UTC
    Thanks - that should teach me to avoid posting guesses...