in reply to Creating a string for a date stamp
i'd recommend sprintf here:
or the brief version:sub get_time_stamp() { my @tan=Today_and_Now(); my $stamp= sprintf '%d%02d%02d%02d%02d', @tan[0..4]; return $stamp; }
this will keep all all the potential 1 or 2 digit fields padded with a zero. cheers, - danboosub get_time_stamp() { sprintf '%d%02d%02d%02d%02d', (Today_and_Now())[0..4]; }
|
---|
In Section
Seekers of Perl Wisdom