Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Novice surprise Message-ID: <11396@jpl-devvax.JPL.NASA.GOV> Date: 12 Feb 91 02:48:25 GMT References: <11393@jpl-devvax.JPL.NASA.GOV> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 20 In article fuchs@tmipi4.telematik.informatik.uni-karlsruhe.de (Harald Fuchs) writes: : lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: : : >I think that most people avoid the problem by not using filenames beginning : >with + or >. If you really want to write a bulletproof script, you might : >put the following before the initial loop: : : >for (@ARGV) { s#^([^/])#./$1#; s#$#\0#; } : >while (<>) {... : : Shouldn't that be : for (@ARGV) { s#^[^./]#./$&#; s#$#\0#; } : Note the period: ^ You can if it makes you feel better, but it doesn't hurt (much) to add an extra ./ on the front of any relative pathname (even those beginning with . or ..). The current directory will even be in the cache already, so there's no extra disk access. Larry