--As of Thursday, September 9, 2004 9:24 AM -0500, Errin Larsen is alleged to have said:

Excellent!  Thank you.  I knew it was something easy, just hadn't
kick-started my brain yet this morning.  But I've got another one.
What if the user input, say, '007' on the command line?  How can I
strip that off?  I think I can check for it with something like this:

/^0?[1-9]/

But If I find it, how do I strip it off?

--As for the rest, it is mine.

Don't bother.  ;)

It's a number, after all. Perl will remove leading zeros for you, as long as there are only numbers. Strip out anything that isn't valid, and add the zero when you need it. (I suggest sprintf, personally.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to