dynamo has asked for the wisdom of the Perl Monks concerning the following question:
And here's how I think it should be able to work:#!/usr/bin/perl sleep 4; BEGIN { $anon = time } print "timespan: " . (time - $anon); # shows 4
But I get this error:#!/usr/bin/perl sleep 4; print "timespan: " . (time - BEGIN{time}); # should show 4
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can / Do BEGIN blocks return their evaluated content?
by Fletch (Bishop) on Dec 21, 2007 at 18:35 UTC | |
Re: Can / Do BEGIN blocks return their evaluated content?
by Roy Johnson (Monsignor) on Dec 21, 2007 at 18:49 UTC | |
Re: Can / Do BEGIN blocks return their evaluated content?
by shmem (Chancellor) on Dec 22, 2007 at 00:17 UTC | |
Re: Can / Do BEGIN blocks return their evaluated content?
by jhourcle (Prior) on Dec 21, 2007 at 20:57 UTC | |
by dynamo (Chaplain) on Dec 22, 2007 at 01:51 UTC | |
Re: Can / Do BEGIN blocks return their evaluated content?
by ikegami (Patriarch) on Dec 22, 2007 at 06:14 UTC |