[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Real World Perl (2)



On Wed, Mar 21, 2001 at 11:59:09PM -0800, Neil Kandalgaonkar wrote:
> Before someone else points them out...
> 
> 
> On Wed, Mar 21, 2001 at 11:41:22PM -0800, Neil Kandalgaonkar wrote:
> 
> > # incorrect for years below 1000. :)
> 
> # was always correct in all cases.
> sub today3{sprintf("%d%02d%02d",(@_=(localtime)[5,4,3],$_[0]+=1900,$_[1]++,@_))}
> 
> # canonical, added use() and s/::/'/
> sub today4{use POSIX;POSIX'strftime('%Y%m%d',localtime)}



sub {sprintf "%04d%02d%02d" => $_ [5] + 1900, $_ [4] + 1, $_ [3]} -> (localtime)



Abigail

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe