in reply to Re: Append to file or create file depending on input filename.
in thread Append to file or create file depending on input filename.

I wasn't sure about the evaluation happening in the right order, but I tested it and it seems to work. :)

Well, I would be inclined to worry about that too, and unless I find the bit of perl documentation that actually spells out the "official policy" about evaluation order for arguments in a subroutine call, I would consider a successful run on my own machine to be no guarantee that it'll work on other machines, or on my machine after I upgrade to the next Perl release.

And rather than take the time to hunt down that (possibly obscure) snippet of documentation, it would be easier for me just to add one more line of code and one more variable, so I don't have to worry about it.

  • Comment on Re^2: Append to file or create file depending on input filename.

Replies are listed 'Best First'.
Re^3: Append to file or create file depending on input filename.
by bellaire (Hermit) on Nov 21, 2009 at 13:08 UTC

    This is a good point. I don't know how likely this behavior is to change in the future or between platforms, only that the rough rule of thumb is that evaluation happens left-to-right. However, as this mailing-list thread shows, that's a rule subject to many exceptions.

    And, as you might have suspected, the discussion there seems to indicate that the order of evaluation is not well-defined, so perl simply does what it does.