Hi,
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.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to