Ohh, 'now' is a term and therefore doesnt need parens... good :o) It is interesting in a way because you don't have to go back to a certain point of code to assign 'now' to a variable, you can you put that signle line anywhere in your code and get some measurement.
Imagine you've got a routine that you know is slow... yuo can either have several variables that record every step, or reassign to after every measurement, or you just put this whereever you want: say "$?FILE:$?LINE " ~ now - BEGIN now; Am 12.01.2015 um 10:36 schrieb Gabor Szabo: > > On Mon, Jan 12, 2015 at 10:35 AM, Tobias Leich <em...@froggs.de > <mailto:em...@froggs.de>> wrote: > > Also interesting might be the fact that BEGIN statements/blocks do > return a value: > > say now() - BEGIN now; # parens needed to there so that it does not > gobble args > > > Hmm, actually it does not let me put the parens there: > $ perl6 -e 'say now() - BEGIN now;' > > ===SORRY!=== Error while compiling -e > Undeclared routine: > now used at line 1 > > This works: > > $ perl6 -e 'say now - BEGIN now;' > 0.0467931 > > but I am not sure why is that interesting. Could you elaborate please? > > >> >> One of them counts leap seconds, the other doesn't. Instant >> is supposed >> to be a monotonic clock, the other isn't. >> > > Oh and Timo, I think, if I understand this correctly, they are both > monotonic in the mathematical sense. > Neither can decreases, can day? > The difference is that 'time' stops here-and-there and waits for a > leap second to pass before it resumes increasing. > > Gabor >