> Hi, Howdy
> you can use split for this sort of thing. For example: > > my $string = "hello there"; > > # add an extra '.' for every character you want > my @pairs = split(/(..)/, $string); > > The only thing you want to be careful about is empty > quotes/nothing (e.g. ''). For example, if we wanted to print > the character pairs: > > foreach(@pairs) > { > # we'll skip on the empty elements > if($_ eq '') > { > next; > } > > # print each pair, preceded by a * > # you could push onto another array instead > print "*$_"; > } > > Can't think of anything more code efficient at the moment but > I hope this helps. How about this instead of a zillion lines? for(split(/(..)/, $string)) { print "*$_" if $_; } Although wouldn't that mean every second pair of characters would be missing? But as for efficiency or just plain, one line sexxyness that look swell to me! HTH Dmuey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]