Saravana Kumar schreef: > 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? > > TIA, > SK
Use an anchor and a negated character set: s/\.[^.]*$// -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/