Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Can / Do BEGIN blocks return their evaluated content?

by Roy Johnson (Monsignor)
on Dec 21, 2007 at 18:49 UTC ( [id://658497]=note: print w/replies, xml ) Need Help??


in reply to Can / Do BEGIN blocks return their evaluated content?

Neither BEGIN nor INIT blocks evaluate to anything. The way to do what you want is probably to involve a do block and a variable:
sleep 4; print "timespan: " . (time - do { my $btime; BEGIN {$btime=time} $btime }); # should show 4

Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://658497]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-23 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found