title: Quickly getting to local time YYYY-mm-dd HH:MM:SS in Perl?
body: <p>i want to get local time and formatted as YYYY-mm-dd HH:MM:SS (say 2009-11-29 14:28:29).,
  How can i get date in this format YYYY-mm-dd HH:MM:SS ?</p>
  
  <p>i have try </p>
  
  <pre><code>my $format = "%4u-%02u-%02u %02u:%02u:%02u";
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
  printf "$format\n", $year+1900, $mon+1, $mday, $hour, $min, $sec;
  </code></pre>
  
  <p>the print output is that i want ,but how to designed the output to a variable ??</p>