>>>>> "Tim" == Tim Rayner <[EMAIL PROTECTED]> writes:

Tim> if ( $data =~ /$match/){
Tim>     $replace = "$3-$1-$2 $4:$5:$6";   # do variable subs explicitly after the
Tim> pattern match
Tim>     $data =~ s/$match/$replace/e;
Tim>     print $data, " replaced!\n";
Tim> }else{
Tim>     print $data, " failed to replace.\n";
Tim> }

Ewww...  If you're already matching, then just *do* the replace:

if ($data =~ s/$match/$3-$1-$2 $4:$5:$6/) {
  print "Fixed! $data\n";
} else {
  print "$data didn't match $match\n"
}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to