Hi :-),
this was a pretty cool read! I learned a lot from it. Thanks.
One question though: I don't really get this little piece of code:
$\ = $/; # ORS = IRS = "\n"
$, = ":"; # OFS = ","
while (<PASSWD>) {
chomp; # removes $/ from $_
my @f = split $,; # splits $_ on occurrences of $,
# fool around with @f
print MOD @f;
}
Why would it put a newline to the end of each line during the print? You say that "$\ goes where you put a \n in your print()" but you're
chomp()ing the newlines.
What do I miss here?
Hmm, now looking at it I get even more questionmarks on my forehead:
- What's the point of assigning a colon to $, when split doesn't use it by default?
- Why do you have to assign $\ with $/? Aren't they supposed to have the same value anyway?
- Why don't we have an abbrev like <c> for the code-Tag, since it is really much to type *grin*?
Still, as I said above: good read!
| Regards... |
Stefan
|
|
you begin bashing the string with a +42 regexp of confusion
|
ps: a typo in your article:
$ARGV this holds the input source currently begin read from
should probably be "being read from", er?
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.