As everyone knows, the numeric’s comparison uses different operators to string’s.
So Is there a generic way to do comparison both numeric and string in Perl ?
Should I always check the value is numeric or string before doing the comparison?
I am a freshman in Perl. Please help if you have some idea.
Thanks.
As everyone knows, the numeric’s comparison uses different operators to string’s. So Is there
Share
In addition to ways already mentioned, when using perl > 5.10.1, smart matching can be used. Specifically look at lines 29 .. 32 in the referenced table. If one operand look like a number, numeric comparison is used, otherwise fallback to string.