Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Regex and leading zeros in numbers

by Roy Johnson (Monsignor)
on Mar 24, 2004 at 16:23 UTC ( [id://339451]=note: print w/replies, xml ) Need Help??


in reply to Regex and leading zeros in numbers

Have you tried numeric comparison? Is that what you want?
my ($s1, $s2) = qw(20055 020055); print(($s1 == $s2) ? "equal\n" : "not equal\n");
If you want to strip leading zeroes:
s/^0*//;

The PerlMonk tr/// Advocate

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://339451]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (10)
As of 2024-04-18 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found