in reply to Re: how to write a modified return() call?
in thread how to write a modified return() call?

I don't find that very readable. It makes me wonder whether the parens are a list, or whether they are just there for precedence. And it makes me wonder if perl couldn't evaluate the return before the warn.

I would write it as:

my $start_with = another_value or do { warn "Could not get another value"; return; };
Alternatively,
do { warn "Could not get another value"; return; } unless my $start_with = another_value;
but that focusses on the exception, not on the action, so I'll be far less likely to write it that way.

Replies are listed 'Best First'.
Re^3: how to write a modified return() call?
by ikegami (Patriarch) on Jul 14, 2009 at 15:13 UTC
    wow! I can't imagine why you're so afraid of using ",". You need to use it for just about every function call!

      Maybe you and JavaFan just have different preferences for coding style? I don't think he was criticizing you as much as stating what works for her/him.

      I also doubt you meant to come across as belittling, but "why you're so afraid..." does have that effect to some ears, even those who want to give you the benefit of the doubt.

      Best, beth

        I wasn't questioning his style, just the comments he made regarding the code I posted. He said he wondered if (1,2,3,4) could return (4,3,1,2)! He knows better than that.