On Jan 27, 2014, at 11:32 PM, Luca Ferrari <fluca1...@infinito.it> wrote:
> Hi all, > often I find myself writing something like the following to get the > "human" date: > > my ($day, $month, $year) = (localtime())[3..5]; > $month++, $year += 1900; > print "\nToday is $month / $day / $year \n"; > > > I was wondering if there's a smarter pattern to get the right value in > one single line. At least there's no simple "map" I can think of. The localtime() function in scalar context returns a string containing the date and time. See ‘perldoc -f localtime’ for details. For example, here’s what I put at the beginning of my program to print out the date and time the run started: print “Run started at “, scalar localtime(), “\n”; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/