At 09.40 -0500 1999.01.28, Ero Brown wrote: >I get an error when performing the following operation on >a file that has trailing spaces in its name: > > open(THEFILE, "<$theFileName") > >e.g., $theFileName = "Problem File "; > >What am I doing wrong? You aren't reading the documentation on open. :) Beginning and trailing whitespace in filenames is deleted. Trailing whitespace can be protected with a \0: open(F, "< $file\0") or die $!; Beginning whitespace can be protected with a current directory notation, like: open(F, "< :$file") or die $! But the safest way is this: use Fcntl; sysopen(F, $file, O_RDONLY) or die $!; Then use F as a normal filehandle, since that is what it is. :) Remember that open() is magic, and it tries to emulate Unix shells in some ways. So it is best to simply not have files with beginning whitespace for sure, since that is hard to deal with, and trailing whitespace is usually bad, too, although a \0 will fix it. So don't use bad characters in filenames if you can help it. But sysopen() bypasses the magic, so get to know it. -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch