I sometimes see folks using this syntax for calling subroutines:
use Module::Foo;
Module::Foo::do_something();
rather than
use Module::Foo qw/do_something/;
do_something();
I prefer the latter in almost all cases. I think it avoids a lot of mostly unneccesary clutter.
If the method is only used once in the module or script, then I can see a justification for the former syntax, and it does make it very clear where the function is coming from, but for the most part, I don't think it's worth the extra clutter.
I am curious what other folks think. Which syntax do you prefer, and why? I thought I'd seen something about this in perldoc perlstyle, but I can't find it - is there a community consensus?
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.