in reply to Difference of localtime

perl -e "my $now = localtime time; print \"It is now $now \"; my $re= scalar localtime; print \"It is now $re \";" on Windows...

or, for a nix-ish OS...

perl -e 'my $now = localtime time; print "It is now $now"; my $re= scalar localtime; print "It is now $re";'

Go ahead. Try it. In fact, you can often answer your own questions, by such trials.

Or did you mean to ask a question that's not evident, such as "Does using scalar make a difference in the output? (Answer: not here) or "Does changing the variable's name make a difference?" (Answer: $now is certainly easier to understand than $re) or "Will one be quicker than the other?" (Answer: Benchmark it.)

And please, you've been here long enough to know that code -- even snippets like these -- should be wrapped in <c>...</c> tags.

Update: Fixed missing </p> tag; clarified phrasing of first question.

Replies are listed 'Best First'.
Re^2: Difference of localtime
by Anonymous Monk on Feb 24, 2009 at 08:34 UTC
    Or for both
    perl -e warn-localtime(time);warn-localtime -Tue Feb 24 00:35:27 2009 at -e line 1. -Tue Feb 24 00:35:27 2009 at -e line 1.