Re: substitute all but the last

2006-03-22 Thread Tom Phoenix
On 3/22/06, tom arnall <[EMAIL PROTECTED]> wrote: > could you explain in detail what the stuff in parens is about, i.e., > '?=.*\.' ? When the first thing inside the parentheses is a question mark, it's a sign that the parentheses are doing something special. s/\.(?=.*\.)/_/gs The perlre m

Re: substitute all but the last

2006-03-22 Thread tom arnall
Tom, John, could you explain in detail what the stuff in parens is about, i.e., '?=.*\.' ? thanks, tom arnall north spit, ca On Wednesday 22 March 2006 12:41 pm, Tom Phoenix wrote: > On 3/22/06, S.A. Birl <[EMAIL PROTECTED]> wrote: > > Im looking to subtitute all but the last . into _ > >

Re: substitute all but the last

2006-03-22 Thread S.A. Birl
On Mar 22, John W. Krahn ([EMAIL PROTECTED]) typed: > $ perl -e' > my @files = qw[ filename.jpg.pgp filename.2.jpg.pgp file._.jpg.pgp ]; > for my $file ( @files ) { > print "$file --> "; > $file =~ s/\.(?=.*\.)/_/g; > print "$file\n"; > } > ' > filename.jpg.pgp --> filename_jpg

Re: substitute all but the last

2006-03-22 Thread Tom Phoenix
On 3/22/06, S.A. Birl <[EMAIL PROTECTED]> wrote: > Im looking to subtitute all but the last . into _ > ie: filename.jpg.pgp --> filename_jpg.pgp > ie: filename.2.jpg.pgp --> filename_2_jpg.pgp > ie: file._.jpg.pgp --> file__.pgp There are many ways to do this

Re: substitute all but the last

2006-03-22 Thread John W. Krahn
S.A. Birl wrote: > Im doing some file renaming. > > Im looking to subtitute all but the last . into _ > ie: filename.jpg.pgp --> filename_jpg.pgp > ie: filename.2.jpg.pgp --> filename_2_jpg.pgp > ie: file._.jpg.pgp --> file__.pgp > > > Ive tried about 10 different