in reply to Re: Question about warn statement
in thread Question about warn statement

...but then $x is still undefined outside the do{} block (which may or may not be a problem).

my $x; open (FILE, ">temp") || do { warn "error message"; $x = 1; } print "\$x is $x";

dave

Replies are listed 'Best First'.
Re: Re: Re: Question about warn statement
by vek (Prior) on Aug 22, 2003 at 16:57 UTC

    You're right but (as you mentioned) the fact that $x is undefined may not be a problem at all.

    my $x; open (FILE, ">temp") || do { warn "error message"; $x = 1; }; if ($x) { # so something }
    -- vek --
Re: Re: Re: Question about warn statement
by Not_a_Number (Prior) on Aug 22, 2003 at 17:01 UTC

    Ooops sorry, my bad. Please ignore the above.

    dave