in reply to How do I drop leading zeros from a date like 07/04/2001 to read 7/4/2001??
Update:okay, i think that you can use the following code to get the desired results:
#!/usr/bin/perl -w use strict; use POSIX qw(strftime); my $date = strftime("%-m/%e/%Y", localtime);
the hyphen should flag that you do not want padding for the result of the month value of %m which by default will be padding in month represented by a single digit 1-9.
Update:It looks as though %m still pads the month with a zero. I'll start reading through POSIX::Strftime and see what I can find...
If you're using strftime, try using:
my $date = strftime("%m/%e/%Y",localtime);
humbly -c
|
---|
In Section
Seekers of Perl Wisdom