in reply to open splutters and fails

The 2-arg form of open strips leading and trailing spaces from the filename. Use the 3-arg form instead:
open FILE, '<', $x[0] or die ....

Dave.

Replies are listed 'Best First'.
Re^2: open splutters and fails
by bart (Canon) on Jun 03, 2007 at 01:34 UTC
    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.

      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