On Fri, Mar 6, 2009 at 9:41 AM, Gaal Yahas wrote:
> Another is near the top of the file to say:
>
> main() if !caller;
> sub main {
> # ...
> exit 0;
> }
>
By wrapping the main body of the file in a subroutine of itself you've
restricted the scope of the (lexical) $filename to no longer be
file-wide, thus causing a compilation error (vs. the previous run-time
error) when $filename is called inside print_filename.
This much I understand.
But what does "if !caller" have to do with it?
--
Offer Kaye
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl