On Tue, 28 Jan 2014 08:32:20 +0100 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. I tend to use DateTime to manipulate dates, so I'd say something like DateTime->now->dmy('/'); It's a bit of a slow and heavyweight way to go about it if you're not already planning to use DateTime, though :) -- David Precious ("bigpresh") <dav...@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/