http://qs1969.pair.com?node_id=100164

deprecated has asked for the wisdom of the Perl Monks concerning the following question:

foreach my $stat (readdir ISSUE) { next if $stat =~ m/^0\./; # ignore 0.tiff et cetera next if $stat =~ m/^\.\.?/; # ignore current and parent direct +ory next unless defined $stat; warn "$stat\n" if $debug; if ($stat =~ m/tiffcheck/) { # line 50 open TIFF, "$logdir/$issue/$stat" or die "could not open $logdir/$issue/$stat: $!\n"; foreach my $line (<TIFF>) { next if $line =~ m/Starting/; next unless defined $line; if (($line =~ m/Completed/) and !$tiffcheck) { $tiffcheck = (split / /, $line)[2]; } else { $tiffcheck = "E"; } } close TIFF or warn "error closing $logdir/$issue/$stat: $!\n +"; }
produces this warning:
Use of uninitialized value in pattern match (m//) at summarizePg.pl li +ne 50.
This code has been removed from its context, so please ignore missing curlies and stuff. I provided the additional code for an idea of what is being done here. What has baffled me here <!- i dont want to hear it, tilly... -> is that i feel like I have taken every precaution against undefined and uninitialized values in this snippet -- and yet the m// is finding it uninitialized? How can this be? Is there a difference between "uninitialized" and "undefined" and perhaps "false" (i.e., 0 or "0")?

I am completely at a loss as to what is wrong here.

Thanks,
brother dep.

update:

tye and MeowChow were right. I was missing a ~ about 70 lines later in my code at an elsif. Damn difficult bug to track down!

--
Laziness, Impatience, Hubris, and Generosity.