#!/usr/bin/perl -w use strict; use vars qw($sub); #exit main(); # Useless use of closure below if called like this # BEGIN block would be needed in this case. { my $time = time(); $sub = sub {time - $time}; } exit main(); # No problem, no BEGIN needed. sub main { print &$sub; sleep 2; print &$sub; return 0; }
Cheers,
KM
In reply to Re: (tye)Re3: Functions
by KM
in thread Functions
by fgcr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |