in reply to Re: Confusion in naming variables in subroutines
in thread Confusion in naming variables in subroutines

Ditto. I generally start all but the most trivial (and often even those) scripts something like:
#!/usr/bin/perl use strict; use warnings; exit !main(@ARGV); sub main { my $fname = shift; # etc... foo() or return; # Will lead to a non-zero (i.e. unsuccessful) exit-code return 1; # All went well (will lead to a successful exit code of 0) } sub foo { }
And the reason for this is at least in part to avoid having unintentional whole-file-scope for the lexical variables in the 'main' code. Having the 'exit' in there too means one doesn't have to eyeball the entire file looking for executable code at file scope. (It does mean that if you want any file-scope lexicals, you need to put them before the call to 'main', but to me that's actually a feature.)