Re: Adding a comma to format localtime

2007-04-11 Thread Susheel Koushik
use this: $str = localtime; @fields = split/ /,$str; $str2 = "$fields[0]".","." $fields[2]"." $fields[1]"." $fields[4]"." $fields[3]"; print ("$str2\n"); 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

Re: Adding a comma to format localtime

2007-04-11 Thread John W. Krahn
Gregg O'Donnell wrote: > > 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 ( my $datetime = localtime ) =~ s{(\S+)\s+(\S+)\s+(\