Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Breaking down whole number into digits

by ww (Archbishop)
on Nov 29, 2012 at 21:25 UTC ( #1006359=note: print w/replies, xml ) Need Help??


in reply to Breaking down whole number into digits

Ignoring (because you've given us no hint of how you plan to translate "Nov" to 11), you can, of course, use a regex to separate a number like "11" into separate digits:

>perl -E "my $foo=11; if ($foo =~ /(\d{1})(\d{1})/) { say \"$1 \t $2\" +;}" 1 1

Note that this is NOT a recommended approach since it doesn't deal with "1995" or with the ...say, second day of a month.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006359]
help
Chatterbox?
[erix]: but I guess there's no stopping the herd
[1nickt]: Thank you haukex and hippo. I'm thinking of using IPC::System:: Simple::capture instead. But will go reread Hauke's treatise first :-)
[1nickt]: herveus is so weird. Love his reply in that SQLite thread! Much more effective warning system to have diverse monks debunk on technical merits...
[haukex]: IPC::System:: Simple does all the $? handling for you, and does it well
[erix]: weird problem btw (that SQLite question) - I asked astroboy to let us know if he finds the cause
[hippo]: The syntax is warning enough to me.
[1nickt]: hippo lately I can tell just by the fact that Anonymous posts a reply after some hours that it is more than likely That Monk.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-12-13 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (360 votes). Check out past polls.

    Notices?