Re: Substitute Regex with 'e'

2005-02-15 Thread John W. Krahn
Ramprasad A Padmanabhan wrote: Hi Hello, 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} : 'NOTFOUN

Re: Substitute Regex with 'e'

2005-02-14 Thread Xiaofang Zhou
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

Substitute Regex with 'e'

2005-02-14 Thread Ramprasad A Padmanabhan
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