Link to home
Start Free TrialLog in
Avatar of blnukem
blnukem

asked on

Regex fix

Hi all

I need this fixed it works as long as  $PintedDiscount doesn't end with "0" example 10, 20, 30, 40, 50


DONT WORK: $PintedDiscount = 0.20;


WORKS: $PintedDiscount = 0.25;


$PintedDiscount =~ s/^[0\.]+//;

print "$PintedDiscount%";

Avatar of Adam314
Adam314

What are you trying to do?

Maybe you should just multiply $PintedDiscount *100
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
$PintedDiscount =~ s/^[0\.]+(.*[1-9])$/$1/;
Avatar of blnukem

ASKER

Thanks Tintin