Re: baby perl to get the right date

2014-01-30 Thread Jim Gibson
On Jan 27, 2014, at 11:32 PM, Luca Ferrari 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

Re: baby perl to get the right date

2014-01-29 Thread SSC_perl
On Jan 28, 2014, at 8:59 PM, Rob Dixon wrote: > It is probably best to use the Time::Piece module, which has been part of > core Perl 5 since version 10 Side question: does anyone know why the Perl team chose Time::Piece over Date::Time to be bundled with Perl? I've known about Date::Ti

Re: baby perl to get the right date

2014-01-28 Thread Luca Ferrari
On Wed, Jan 29, 2014 at 5:59 AM, Rob Dixon wrote: > It is probably best to use the Time::Piece module, which has been part of > core Perl 5 since version 10 so you shouldn't need to install it. > Thanks, I was not aware of it. And it does what I need. Luca -- To unsubscribe, e-mail: beginners-

Re: baby perl to get the right date

2014-01-28 Thread Rob Dixon
On 28/01/2014 07:32, Luca Ferrari 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

Re: baby perl to get the right date

2014-01-28 Thread David Precious
On Tue, 28 Jan 2014 08:32:20 +0100 Luca Ferrari 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 wonde

Re: baby perl to get the right date

2014-01-28 Thread Dr.Ruud
On 2014-01-28 08:32, Luca Ferrari wrote: 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

Re: baby perl to get the right date

2014-01-27 Thread marcos rebelo
hi If you would like to work with a cleaner perl, try: http://search.cpan.org/~mschwern/perl5i-v2.12.0/lib/perl5i.pm it is slower but it is beautiful. other way is to use Classes like DateTime directly Best Regards MArcos On Tue, Jan 28, 2014 at 8:32 AM, Luca Ferrari wrote: > Hi all, > ofte

Re: baby perl to get the right date

2014-01-27 Thread Chankey Pathak
Hi Luca, Check this: http://stackoverflow.com/questions/11020812/todays-date-in-perl-in-mm-dd--format On 28 January 2014 13:02, Luca Ferrari wrote: > Hi all, > often I find myself writing something like the following to get the > "human" date: > > my ($day, $month, $year) = (localtime())[3

baby perl to get the right date

2014-01-27 Thread Luca Ferrari
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.