in reply to (bbfu) (another way) Re: print and return...
in thread print and return...

I beg to differ. The do will always work, it's just the print and return that could fail if print fails but as you say how often does that happen? return print "preturn" if $arg does not suffer from this problem and also works. So there are at least 4 idioms to do this.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

  • Comment on Re: (bbfu) (another way) Re: print and return...

Replies are listed 'Best First'.
Re: Re: (bbfu) (another way) Re: print and return...
by bbfu (Curate) on Sep 27, 2001 at 22:20 UTC

    I didn't mean to imply that the do wouldn't work, of course. I only meant that you also used the print and return form and that it might fail even inside a do block. Update: Erp. I just re-read your post and saw that the actual code you suggested did not use and so it, of course, wouldn't suffer from that problem. Mea culpa!

    You're right about return print "bar" if $foo, of course. That's probably the "best" way to do it, in that it never has a chance of failing but it's a little less clear what's going on... *shrug*

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.