drock has asked for the wisdom of the Perl Monks concerning the following question:
In my situation I have a string like so:
and I want to rearrange it to look like: 05162005, so I tried:my $string = '20050516';
But my problem is: it's leaving 2005 in the beginning of the string to look like 200505162005 when all I need is 05162005 thx derekmy $newstring = substr($string,0,8).substr($string,0,4).substr($string +,8,0);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: rearranging a string.new
by ikegami (Patriarch) on Nov 21, 2005 at 19:19 UTC | |
Re: rearranging a string.new
by VSarkiss (Monsignor) on Nov 21, 2005 at 20:48 UTC | |
Re: rearranging a string.new
by davidrw (Prior) on Nov 21, 2005 at 19:25 UTC | |
Re: rearranging a string.new
by Corion (Patriarch) on Nov 21, 2005 at 19:20 UTC | |
Re: rearranging a string.new
by ptum (Priest) on Nov 21, 2005 at 19:20 UTC |
Back to
Seekers of Perl Wisdom