[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] problem with open()



On Sun, 8 Nov 1998 22:20:33 +1100, Andy White wrote:
>
>Some apps create filenames with trailing spaces - I personally don't, but
I
>haven't read anywhere that MacOS dissallows this. Anyway, the following
>snippet fails to work for any such filenames:
>
>--------------
>#!perl -w
>
>foreach $filename (@ARGV) {
>
>chomp($filename); #problem exists whether chomp is used or not
>
>open(FILE,"<$filename") || die "open($filename) failed";
> ....
>--------------
>
>What does MP have against these filenames?

It's not MacPerl. You would have the same problem with any other Perl.
This is a documented feature of open; I assume you just missed it when you
read the docs before posting to the list. The solution is in the docs.
(Search for "magic open", but ignore the Unix specific ./ leader; the
equivalent on MacOS is to put a : in front of a relative path or use
absolute paths. But in this case with only trailing whitespace, this
doesn't matter. )

>--------------------------
>bibleBlack@starless.com.au
>
>
>



-------
Paul J. Schinder
schinder@pobox.com


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch