Wijaya Edward wrote: > Hi John, Hello,
> I was testing your code below with this array: > > my @x = qw( * * A B C D ); > > but how come in the end it gives: > * XA * XB XC XD X > > instead of > * * XA XB XC XD I guess you didn't see Chris' posting. :-) $ perl -le' @x = qw( * * A B C D ); print @x . " @x"; for ( reverse 0 .. $#x ) { unshift @y, [ $_, splice @x, $_, 1 ] if $x[ $_ ] =~ /[^A-Z]/; } print @x . " @x"; @x = map "X$_", @x; print @x . " @x"; for ( @y ) { splice @x, $_->[0], 0, $_->[1]; } print @x . " @x"; ' 6 * * A B C D 4 A B C D 4 XA XB XC XD 6 * * XA XB XC XD John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>