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

Re: Replacing matches within string without splitting.

by NetWallah (Abbot)
on Jan 02, 2013 at 06:44 UTC ( #1011214=note: print w/ replies, xml ) Need Help??


in reply to Replacing matches within string without splitting.

Typically, leading zero printing, and other formatting is done using sprintf and friends:

perl -E '$x="2,42,1,3"; printf "%.2d ",$_ for eval("($x)") ; print +"\n"' 02 42 01 03
Update: Replaced with better example.

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius


Comment on Re: Replacing matches within string without splitting.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2015-07-31 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls