On Thu, 12 Apr 2007 05:56:14 -0500, Paul Archer wrote: > A cleaner way to do it is: > printf "%s, %s %s %s %s\n", (split ' ', localtime)[0,2,1,4,3]; > Or, if you want to save it to a variable: > my $dateout = sprintf "%s, %s %s %s %s\n", (split ' ', localtime)[0,2,1,4,3]; >> >> On 4/9/07, Gregg O'Donnell <[EMAIL PROTECTED]> wrote: >>> All, >>> I use this line of code: >>> my $datetime = join ' ', (split ' ', localtime)[0,2,1,4,3]; >>> >>> To create this result: >>> Mon 9 Apr 2007 09:15:05 >>> >>> How can I add a comma to this result to get: >>> Mon, 9 Apr 2007 09:15:05
Personally, I find this more maintainable and readable: use POSIX qw(strftime); my $datetime = strftime "%a, %d %b %Y %T", localtime; -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/