Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I add commas to a number?

by Dodger (Novice)
on Jan 21, 2015 at 22:35 UTC ( [id://1114070]=note: print w/replies, xml ) Need Help??


in reply to How do I add commas to a number?

I know it's eons old but I just noticed this (when looking for if there was some easy one-liner for this); it's good that that was removed from that FAQ mentioned above in the first answer.

Since return() casts in list context:

return reverse $input;

will not work (at least not as expected), as it reverses the list of the result, e.g. ('098,765,432,1') to ('098,765,432,1') (it's a list of one).

What you'd need is:

return scalar reverse $input;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-23 23:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found