> Bruce A. Burdick, Jr. wrote:
>
>> Anyone have any idea how this might be accomplished? :
>>
>> $data = '[03/12/2002:14:19:50]'; # to become: '2002-03-12 14:19:50'
>> $match = '\[(\d\d)\/(\d\d)\/(\d{4}):(\d\d):(\d\d):(\d\d)\]';
>> $replace = '\3-\1-\2 \4:\5:\6';
>>
>> unless ( $data =~ s/$match/$replace/ )
>> {
>> print $data, " failed to replace.\n";
>> }
>> else
>> {
>> print $data, " replaced!\n";
>> }
>
>
>
> Try changing $replace to:
> $replace = 'qq($3-$1-$2 $4:$5:$6)';
>
> and add a double evaluation to the substitution:
> $data =~ s/$match/$replace/ee
>
> Paul Grassie
> [EMAIL PROTECTED]
> Tom Christiansen Perl Consultancy
> http://training.perl.com
That did it!
I actually imported the replace string and then wrapped it before using it.
That way whoever writes my XML file doesn't have to assume Perl will be used
to parse it:
$replace = "qq{$replace}";
-B...