in reply to rearranging a string.new
Can also use a regex or substitution...
Could also use a more robust regex if desired (trivial example is /(200[012345])(\d{4})/) and depending on context.my $string = '20050516'; my $newstring; $newstring = $2 . $1 if $string =~ /(\d{4})(\d{4})/; warn $newstring; (my $newstring = $string) =~ s/(\d{4})(\d{4})/$2$1/; warn $newstring;
In Section
Seekers of Perl Wisdom