in reply to Filehandle open or not - WTF? :(

You're trying to do too much on one line:

open ( LOG, $log ) || warn " Couldn't open log\n" if ($debug);

Here's how it deparses:

$ perl -MO=Deparse,-p -e 'open F, shift || warn $! if $debug' ($debug and open(F, (shift(@ARGV) || warn($!))));

In other words, you only try to open the filehandle if $debug is true.

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

Replies are listed 'Best First'.
Re: Re: Filehandle open or not - WTF? :(
by Rhodium (Scribe) on Mar 11, 2003 at 23:20 UTC
    Hey Thanks a lot!!

    Would you mind telling me where you found that little nugget of gold called Deparse? I would love to know and is there more info on it?

    Thanks again

    Rhodium

    The <it>seeker</it> of perl wisdom.

      See perldoc perlmodlib to find out which modules are included with your installation of Perl and perldoc perllocal to see which modules have been installed in addition to the core ones.

      Makeshifts last the longest.