• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

Demilter without string tokenizer

Hi

I am looking for sample code that will file spaces and get the words in the sentance.
Problem is I cannot use string tokenizer.

example: " THIS IS THE STRING"
$word1 = THIS
$word2 = IS
$word3 = THE
...

It is very urgent. It would be great if you can get me sample code...

Thanks
0
basirana
Asked:
basirana
  • 3
1 Solution
 
Perl_DiverCommented:
This might be too blunt but your example string shows only words seperated by spaces

my $string = 'THIS IS THE STRING';
my @words = $string =~ /(\S+)/g;
print "$_\n" for @words;
0
 
Perl_DiverCommented:
Please explain what's the urgency? Are you sitting in class taking a test?
0
 
ozoCommented:

($word1,$word2,$word3)=split for " THIS IS THE STRING"
0
 
Perl_DiverCommented:
I guess it was really urgent......
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now