Linux Expert wrote:
if( $!{ENOENT} ) # File doesn't exist { warn "\tTrying to make directory $dir...\n"; mkdir $dir, 0755; } elsif( $!{ENOSPC} ) # Full disk { ....SNIP.... My question is this: wouldn't the mkdir on line 4 reset the $! value, and also the %! hash if it failed? If so, the rest of the checks would be looking at the result from mkdir's failure, not the failure of the open, correct?
I think the answer is that in an if-elsif-else construct, Perl will execute only the first block whose conditional is true and then jump to the code that follows.
HTH, David -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/