Hey!
With regard to $#ARGV versus @ARGV... I was working with indexes at that point in the code, and didn't think to switch gears mentally and make the check look more readable. You are correct, it is a little obfuscated to an outside observer, since element 0 is the beginning of the argument list in ARGV versus 1 with 0 being the command itself. Thats what $0 is for, as you probably know. Good catch, btw.
Blocking things off into subroutines right off the bat is sort of a style quirk of mine. For strict procedural things, you're right, it's sort of pointless...But it helps if I have to revisit the code later and make changes, which is a frequent occurence here where I work. It's kind of funny, we have sort of a generic "grandfather" script we use over here as sort of a template for "watch this, do this, and notify this person" tasks...This script wasn't derived from it, specifically, but I can think of at least half a dozen scripts we use that
were, and it came in handy to have things already compartmentalized like that. spinDownRoutine() is a good example. Everything I write has a spinUp/Down routine. Sometimes they come in handy, other times they're just withered limbs.
As for the typo, that's an artifact of the cut/paste process to get it posted here on PerlMonks. :)
Cheers,
Bowie
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.