in reply to selecting characters from a variable

It sounds to me as though you really want to do a split, parsing your string into tokens, delimited by the ':' character.

my @tokens = split /:/,$line;

If you really do want to split up the line into an array of characters, you can simply use the split without a delimiting argument, which will cause your string to be split into one-character array elements.

Update: As the man without a Pony indicates below, what I mean when I say 'without a delimiting argument' is this:

my @tokens = split //,$line;

No good deed goes unpunished. -- (attributed to) Oscar Wilde

Replies are listed 'Best First'.
Re^2: selecting characters from a variable
by Fletch (Bishop) on Jun 02, 2006 at 15:03 UTC

    You still need to give a pattern to split on which matches the null string (// or '') to split to characters; omitting both the pattern and what to split splits $_ on whitespace (at least in list context; in scalar context it splits $_ on whitespace into @_ and you'll get griped at as it's deprecated behavior). See the docs for split for more details.</pedant>