in reply to Re^3: string manipulation
in thread string manipulation

Good catch with the reversed digits. I'm peeved with myself because I've done a similar thing before and should have remembered. Corrected code.

use strict; use warnings; my @testStrings = qw{ abc.1.0.1.0 bnnn.1.0.1.1 this.that.1.0.215.0 dots.a.plenty.here.1.0.21.1 }; foreach my $testString ( @testStrings ) { my( $rest, $digits ) = map { scalar reverse( $_->[ 4 ] ), join q{.}, reverse map { $_ = reverse } @$_[ 0 .. 3 ] } map { [ split m{\.}, $_, 5 ] } scalar reverse $testString; print qq{$rest -- $digits\n}; }

And output.

abc -- 1.0.1.0 bnnn -- 1.0.1.1 this.that -- 1.0.215.0 dots.a.plenty.here -- 1.0.21.1

Cheers,

JohnGG