in reply to (tye)Re3: Functions
in thread Functions
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re4: Functions
by tye (Sage) on Jan 30, 2001 at 02:42 UTC | |
by KM (Priest) on Jan 30, 2001 at 02:55 UTC |