Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: rearranging a string.new

by ikegami (Patriarch)
on Nov 21, 2005 at 19:19 UTC ( [id://510528] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $newstring = substr($string, 4, 2)   # Month (was at 4 len 2)
                  . substr($string, 6, 2)   # Day   (was at 6 len 2)
                  . substr($string, 0, 4);  # Year  (was at 0 len 4)
    
  2. or download this
    my $newstring = substr($string, 4, 4)   # M+D  (was at 4 len 4)
                  . substr($string, 0, 4);  # Year (was at 0 len 4)