Xavier Noria schreef: > On Jan 23, 2007, at 9:55 AM, Dr.Ruud wrote: >> [thread repaired] Saravana Kumar:
>>> I am trying to remove the extension from the a list of filenames >>> and manipulate the names further. >>> >>> Tried to doing this: >>> $file=~ s/\..*//; >>> >>> The above works fine. I get the result 'filename' if the filename is >>> filename.ext. >>> >>> There are some files whose names are like file.name.ext and the >>> result i get for this is 'file' while the desired result is >>> 'file.name'. Is there a way to fix this? >> >> Use an anchor and a negated character set: >> >> s/\.[^.]*$// > > That solution is broken, think "/foo/bar.baz/woo". Correct regexps > and other approaches have already been posted. Paths were not involved. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/