in reply to where do you put your subs

My subs are always at the top. In my opinion, a sub should be in the file before the point where it's first used. If that isn't possible, for example when two subs call eachother, I put empty declarations above them. If you have subs before everything else, you don't have to wrap it in a BEGIN block if you need simple closures.

My sripts look like this:
#!/usr/bin/perl -w use Module::Foo; use Module::Bar; use Module::Baz qw(foo bar); use strict; sub first { # ... } sub second { # ... } # main code, if applicable


My modules look like:
package Module::Xyzzy use Module::Foo; use Module::Bar; use Module::Baz qw(foo bar); use base 'Exporter'; use Carp use strict; our @EXPORT_OK = qw(...); sub CONSTANT () { 1 } sub new { # I try to always put new before other methods } sub first { # ... } sub second { # ... } sub DESTROY { # If there's a DESTROY method, I put it at the end } # main code - that is: "1;" :) __END__ =pod That's right, I use __END__ and =cut, just to be sure. My documentatio +n is NOT mixed with the code. Whenever code is unclear, I comment it, but I dislike, +no I hate pod and code mixed. =cut


It's just a matter of taste

++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
    - Whreq