I'd have to say that while your code logic is sound, I probably would opt for using
File::Find instead of this sort of hand-coded solution. The reason for this is that your code is fairly sensitive to changes in the file structure and expected layout - It doesn't allow for the likelihood of other sub-directories within your directories (and is trying to open them as files), ignores files which may start with a period (
grep(!/^\./, readdir(DIRHANDLE))) and while, probably more beyond the scope of the problem, doesn't check file permissions before trying to access the file.
These are all small(-ish) things I know, but if you take this code and extend it into a recursive search of directories, you could end up with some very nasty results with directory cross-links (especially to higher level directories). This is where widely tested modules offer the greatest advantage whereby you can to a certain extent rely on the testing and ground-work provided by others.
Just a few random thoughts that this code provoked
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
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.