On Wed, Mar 21, 2001 at 09:57:53PM -0800, Vicki Brown wrote: > So, can it be done in one line, (without calling localtime more than once)? > sub GetToday2 { > my (undef,undef,undef,$mday,$mon,$year) = localtime(time); > > sprintf("%4d%02d%02d", $year + 1900, $mon+1, $mday); > > } > # incorrect for years below 1000. :) sub today3{sprintf("%d%02d%02d",(@_=(localtime)[5,4,3],$_[0]+=1900,$_[1]++,@_))' # canonical sub today4{POSIX::strftime("%Y%m%d",localtime)} # unix only sub today5{`date +%Y%m%d`} -- Neil Kandalgaonkar Web App Developer, ActiveState ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe