Hey jw!
....I would disagree with your statement that I am using subroutines "incorrectly". I often use subroutines as a way of keeping different blocks of code separated logically. Which is why I'm not passing data to subroutines. Which is why I'm not returning any data from subroutines. Which is why I don't have any data local to the subroutines. Which is why I have everything of any consequence they might operate on declared globally up front. :)
I usually begin every program I write with a bunch of plain english statements that describe what I want the code to do. These statements end up being boiled down into subroutine names, just like what you see here. I've found it keeps code complexity to a minimum, makes debugging easier, and even prevents bloat/function creep in a way. It's a single-purpose, flat procedural script broken down into blocks for my own and others' readability, and just fleshed out as I go.. You'll notice that not only are most of the subroutines only called once, and a couple of the subroutines do next to nothing at all.
As for the
$temp[1]=~s/\/$//g; statement you pointed out, you are correct -- applying the regex globally is superfluous.
s/\/$//g is functionally identical to
s/\/$//. I probably had it match for something else earlier, changed it, and forgot to remove the g. :)
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.