On May 31, Pedro A Reche Gallardo said:

>How can I split  a  string of caracters -any but blank spaces-   into
>the individual caracters?

So you want to split "what's up, doc?" into

  @chars = qw( w h a t ' s u p , d o c ? );

That is, every character except spaces?

First, remove spaces from the string:

  $string =~ tr/\n\r\f\t //d;  # translate whitespace to nothing

Then, split the string into characters:

  @chars = split //, $string;

You could also take an approach like:

  @chars = $string =~ /\S/g;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to