Hi, Ramprasad
use ( ) not { } in regexp.
$x=~s/^(.*?) (\d+)/ $2 . ( defined $hash{$2} ? $hash{$2} : 'NOTFOUND' ) /e;
在 2005-02-15 12:30:00 您写道:
>Hi
>
> I want to so a substititue a string Say
>
> my %hash = ( 1130, "a" , 2100, "b");
>
> $x = 'SOMEJUNK 1130';
>
> # I want $x to be '1130a'
>
> # This regex does not work
> $x=~s/^(.*?) (\d+)/ $2 . { defined $hash{$2} ? $hash{$2} :
>'NOTFOUND' } /e;
>
>Can someone fix the regex for me
>
>Thanks
>Ram
致
礼!
Xiaofang Zhou
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>