http://qs321.pair.com?node_id=250225


in reply to •Re: mmv-like hack in perl?
in thread mmv-like hack in perl?

Thank you for your help. I think I'm still having a problem with the line:

s/$pattern/qq{$replace}/eeg;

Here's the snippet that's failing:

# get strings from GUI. my $old = my $new = $_->children->get; # get old filename my $pattern = $form->{'entry2'}->get_text(); # e.g. $pattern == "^(\d{2})\. (.*)$" after this my $replace = $form->{'entry1'}->get_text(); # e.g. $replace == "two-$2, one-$1" after this # is the following match necessary? $1, etc # need to be assigned somehow... if($old =~ /$pattern/) { $new =~ s/$pattern/qq{$replace}/eeg; print STDERR $old." => ".$new."\n"; }

After the $new =~ line, $new is empty, every time. Am I missing something? Thanks again