At 21:04 +0100 2002.05.27, Alan Fry wrote: >At 12:19 pm -0400 27/05/02, Chris Nandor wrote: >> This works fine, with embedded spaces: >> >> my $f = "Bourque:Desktop Folder:file.txt"; >> open F, $f or die $!; >> print scalar readline F; >> >>This does not: >> >> my $f = "Bourque:Desktop Folder:file.txt "; >> open F, $f or die $!; >> print scalar readline F; > >For the life of me, and please believe I am not being picky, I can't >see the difference between the two. What am I missing?
Sorry! Space at the end of the filename. ":file.txt " <-- space here. >>The third is to specify your open sign ('>', '<', etc.) and add a >>trailing null: >> >> my $f = "Bourque:Desktop Folder:file.txt "; >> open F, '<' . $f . "\0" or die $!; >> print scalar readline F; >> >>The greater danger with C< open F, $f > is that the filename might begin >>with a ">" or somesuch. Both three-arg open, and the method above with >>"\0", solve both problems; but the latter method works in any version of >>perl. I am not a big fan of three-arg open, but I have to admit it looks a >>lot nicer. :-) > >Frankly a lot of problems would disappear would they not, if spaces >in folder/file names were simply banned for ever to outer darkness? :) -- Chris Nandor [EMAIL PROTECTED] http://pudge.net/ Open Source Development Network [EMAIL PROTECTED] http://osdn.com/