title: Date formatting in Perl
body: <p>I have a variable which contain value "20140720". I need to change it to the  format "20/07".</p>
  
  <p>My code is shown below.</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  use Time::Piece;
  
  my $date = '20140720';
  
  my $date_format = Time::Piece-&gt;strptime($date, '%d/%m');
  my $new_date = $date_format-&gt;strftime('%d/%m');
  print $new_date;
  </code></pre>
  
  <p>I get following error during execution.</p>
  
  <blockquote>
    <p>Error parsing time at /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/Time/Piece.pm line 470.</p>
  </blockquote>