in reply to How can I timestamp each printed statement?

There are a whole bunch of logging modules on CPAN. Log::Dynamic looks suitable to my undiscerning eye.

Update: You can get the effect you want — having $now implicitly call localtime — by tie-ing it:

package Now; require Tie::Scalar; our @ISA = qw(Tie::StdScalar); sub FETCH {scalar localtime} package main; tie my $now, 'Now'; print "The time is $now\n"; sleep 3; print "The time is $now\n";
It's probably not what you really want to do, though.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: How can I timestamp each printed statement?
by johnnybongo (Initiate) on Mar 06, 2008 at 19:43 UTC
    THANK YOU VERY MUCH!!! That is doing just what I needed it to. Now each line item of my output that contains $now is returning an accurate timestamp for that action. Thanks again for the quick and useful response!