XP is just a number | |
PerlMonks |
Re: Regex and leading zeros in numbersby QM (Parson) |
on Mar 24, 2004 at 18:42 UTC ( [id://339504]=note: print w/replies, xml ) | Need Help?? |
If the numeric suggestions above don't solve your problem, read on... Matching usually involves the m// operator, while substitution usually involves the s/// operator. While it is often useful and efficient to use the s/// operator in an if{} statement, when starting out you might go a little slower. Assuming you have 2 variables, and you want to match the one (without leading zeros) to the other (with leading zeros), you might be looking for this: which yields: To be more helpful, we need to know more about your problem. For instance, are you reading each value from different files? Do the values have exactly 5 interesting digits? -QM
In Section
Seekers of Perl Wisdom
|
|