Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

localtime(time()) function in header

by pugsly62 (Novice)
on Feb 17, 2005 at 15:34 UTC ( #431976=perlquestion: print w/replies, xml ) Need Help??
pugsly62 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I would like to put the 'localtime(date())' function results in my report header - how do I do that? i.e., I made a header using 'STDOUT_TOP =' I would like to put the date in my header. Thanks! Scott

Replies are listed 'Best First'.
Re: localtime(time()) function in header
by Roy Johnson (Monsignor) on Feb 17, 2005 at 15:51 UTC
    What's the actual problem? Do you know how to fetch the date/time value you want into a variable? Do you know how to include a variable in a format? That's all you need to know.

    Caution: Contents may have been coded under pressure.
Re: localtime(time()) function in header
by dReKurCe (Scribe) on Feb 17, 2005 at 17:35 UTC
    Here's one possible solution :
    #! /usr/bin/perl use Time::localtime; $day=localtime->yday(); $month=localtime->mon(); $year=localtime->year() ; $month=+1; $year +=1900; $string="Spacley"; @date=("$day","$month","$year" ); write(); format STDOUT_TOP= Spacely Sprockets Report Beta 1 @##@##@#### $day ,$month,$year . format STDOUT= @<<<<< @<<<<<<<< @<<<<<<< $string,$string,$string .
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://431976]
Approved by jfroebe
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2018-10-16 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (84 votes). Check out past polls.

    Notices?