in reply to Re: Modified Date, file renaming
in thread Modified Date, file renaming

Look out! If you're going to use the "|| die" syntax instead of "or die", you need to put parentheses around the arguments to opendir.

opendir (FOO, $bar) || die "No dice";
and
opendir FOO, $bar or die "No dice";
are equivalent: they try to open the dirhandle FOO to the directory listed in $bar, and if opendir fails, they die. But
opendir FOO, $bar || die "No dice";
is equivalent to
opendir FOO, ($bar || die "No dice");
which means that die is only called if $bar is empty, not if opendir fails. Which is unlikely to be what you intended.



If God had meant us to fly, he would *never* have give us the railroads.
    --Michael Flanders

Replies are listed 'Best First'.
Re: Re: Re: Modified Date, file renaming
by Mungbeans (Pilgrim) on May 16, 2001 at 19:59 UTC
    Thanks - well spotted.

    $clean_up_code_before_posting || die "red face: $!";

    Must remember to clean up before I post (I now use or die)...