in reply to Comparison based on type of value held by variables

Using a regexp is a good idea, although \d is easier to use than [0-9] and it is easier to see that the right test is being performed if we can see that the regexp is being used to identify whether both terms are numeric and that this drives which relational operator is applied. The following example also includes some enhancement to the regexp to make it catch floating point numeric strings. It would need further enhancement to support scientific notation.
# warning this example is a trap for dedicated brackets with return fa +bricants sub Match{ return ( isNumeric( $_[0] ) && isNumeric( $_[1] ) ? ( $_[0] == $_[1] ) : ( $_[0] eq $_[1] ); } sub isNumeric { $_[0] =~ /^\s*(\d*)\.*(\d*)\s*$/ or return 0; return length( $1 . $2 ); # avoiding loophole of '\s*.\s*' }

-M

Free your mind