Asif Iqbal wrote:
>
> I am trying to relace any 7 digit number to to a new 7 digit number of
> which last two digits are 9
>
> lets pick a random 7 digit number as 1347236.
>
> so I want 1347236 --> 1347299 using perl
>
> I can do it with sed
>
> NUMBER=1347236
> NUMBER=`echo $NUMBER | sed 's/\([0-9]\{5\}\)[0-9]\{2\}/\199/'`
> so now $NUMBER is 1347299

Hi Asif.

  my $number = 1347236;
  $number =~ s/\d\d$/99/;
  print $number, "\n";

**OUTPUT

  1347299

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to