[EMAIL PROTECTED] wrote:
> 
> I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
> contains .0 at the end then I want to remove that .0 but if any other
> digit is there other than .0 then don't do anything.
> 
> For example: if string is : OMS.FD.08.03.000.0 then regular expression
> should give OMS.FD.08.03.000
> 
> But if string is : OMS.FD.08.03.000.18 then don't do anything 

sub remdotzero {
  my $str = shift;
  $str =~ /(.*?)(?:\.0)?$/;
  return $1
}



Rob

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


Reply via email to