in reply to Re^2: if ($2) behaves differently than if (defined $2)
in thread if ($2) behaves differently than if (defined $2)

Apparently, in Lisp, this is referred to as a semi-predicate problem.

The very fact that you are using
if ($2)
followed by
$price = $1 . "." . $2
shows that you are using $2 as a semi-predicate, i.e. to show validity and to hold value.

Next time, whenever you use if ($var), you should consider if $var needs to be a full-predicate, i.e. strictly a boolean to only show true-or-false.