in reply to How do I detect if a number has a minus sign?

To convert a fraction to decimal equivalent (or approximation, if the fraction doesn't divide out cleanly):
if ($fraction =~ /^((-) ?)?((\d+) )?(\d+) ?\/ ?(\d+)$/) { $fraction = ($2 ? -1 : 1) * ($4 + $5 / $6); }
To test for a negative:
if ($fraction =~ /^((-) ?)?((\d+) )?(\d+) ?\/ ?(\d+)$/ && $2) { #run if negative... }