Shawn,
If there is one thing you might take to heart I say it should be passing lists and hashes, a generaly more sophisticated way of going about things.
No, I did not mean to suggest you use globals.
The best analogy for functional programming is to imagine a production line with people all working a product that gets
passed along. If you imagine each person is a suboutine/function then they get 'passed' some stuff, and they 'pass back/along' what they have done.
What you are saying is...
Bob, here's the spanner,
Bob, heres the screwdriver,
Bob, heres the hammer...
Instead of just passing Bob the whole toolkit.
If you pack all the items you want into a list, and pass
the function a reference to that list, you effectively pass the whole bunch of stuff in one go.
Of course the codes not bad, I jest. I've seen some _real_ horror in my time, if anything I see indications that you're a good coder limited by a few hangups. It's no worse than my perl code from not too long ago.
Initially I thought you had not written the code yourself,
and it was a cut n paste from a scripts site, but once I read it I realised you were struggling.
I also see your background is in C, the move to Perl asks that you 'unlearn' some stuff. It's very forgiving too, and what looks syntactically nice to a C hacker is sometimes ugly in Perl.
If you don't already have it I strongly recommend the Ram Book (cookbook), meshes perfectly with your level and need for practical snippets.
have fun
Andy
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.