in reply to Re: open splutters and fails
in thread open splutters and fails

The 2-arg form of open strips leading and trailing spaces from the filename.
Except... for trailing whitespace: when the string ends in a null character ("\0") (optionally followed by more whitespace). The null character is stripped (or just ignored), but anything further inward, is left alone, including spaces.

At least, that's how I recall it (not tested today).

Nevertheless... thank goodness for 3 argument open, no?

p.s.AFAIK, there no equivalent trick for the front of the filename.

Replies are listed 'Best First'.
Re^3: open splutters and fails (prespace)
by tye (Sage) on Jun 03, 2007 at 02:48 UTC
    AFAIK, there no equivalent trick for the front of the filename.

    A bit outside of the original box but open FOO, "> ./ foo \0" works (replace with File::Spec magic to slightly increase portability. (:

    - tye