I guess what I'm trying to say is that you have to be able
to break a problem down. I guess I'm biased, already knowing
HOW to do this, but I'll use your "print a number padded with
0's" comment. How would I find a way to do this?
- well, decimal numbers don't start with 0's, unless it's
just the number 0
- decimal numbers CAN start with a "0." followed by 0's,
so I could divide the number by some power of ten, and then
remove the leading "0."
- I'm really trying to turn a number into a string with
some leading 0's to make it a string of a certain length
- is there some function that will allow me to format a
string to my demands?
At that point, I might not know about sprintf and printf. So
I would ask: "I want to pad a number with zeroes. Is there
a function I can use to format a number like that?" I might
be scolded for not checking the documentation and the FAQs,
but at least I was able to think through my problem.
But again, I'm biased. Maybe I was just ranting out against
all the times something has been so very obvious to me and
not to someone else. Perl has given me very clear vision,
and I have trouble not expecting everyone else to have such
clarity of mind.
$_="goto+F.print+chop;\n=yhpaj";F1:eval
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.