Gossamer Forum
Home : General : Perl Programming :

arrays, letters, sentences...

Quote Reply
arrays, letters, sentences...
Hi folks,

How would I split up a sentence into letters and put them into an array? I would also like to include spaces, maybe replacing them with "space" or something?

Say the sentence was:

$sentence = "The quick brown fox...";

I want an array like:

$letter = ("T","h","e","space","q","u", etc, etc...

Cheers,
adam
Quote Reply
Re: arrays, letters, sentences... In reply to
Or just:

@sentance = split //, $sentance;

will do the trick.

Cheers,

Alex
Quote Reply
Re: arrays, letters, sentences... In reply to
I'm not really sure, but there is a tutorial that tells you exactly how to do that at http://www.cgi-center.com/learn/index.html

------------------
Patrick Chukwura
Nytesoft WebSolutions
nytesoft.hypermart.net