in reply to What is wrong in this

What you have means this:
$a =~ (m/\d\d\.\d\d/) || $_ =~ (m/\$\d\d\d\.\d\d\d/) || $_ =~ (m/\$\.\ +d\d/);


When you want this:
chomp $a; $a =~ (m/\d\d\.\d\d/) || $a =~ (m/\$\d\d\d\.\d\d\d/) || $a =~ (m/\$\.\ +d\d/);
Don't forget to chomp! Prior to the opperation, or you will have your newline input record seperater ($/) at the end of your line.

Update:
I should also mention using $a, and $b, is bad, they are variables that should be reserved for sort, and golf.

Update:
And, while I'm at it use quantifiers and do something like this:
chomp $a; $a =~ (m/\d{2,3}.\d{2,3}/) || $a =~ (m/\$\d{3}.\d\{2}/) || $a =~ (m/\$ +\.\d{2}/);

Which matches ##.##, $###.### and $.##, If you wanted $##.## however you could do something this:
m/\$?(?:\d{2,3})?\.\d{2}/ which looks alot like a crummy money regex, and your probably better off going to cpan for that.


Evan Carroll
www.EvanCarroll.com