Solved

Demilter without string tokenizer

Posted on 2006-11-01
4
223 Views
Last Modified: 2010-03-05
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
Comment
Question by:basirana
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
Perl_Diver earned 500 total points
Comment Utility
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
 
LVL 8

Expert Comment

by:Perl_Diver
Comment Utility
Please explain what's the urgency? Are you sitting in class taking a test?
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility

($word1,$word2,$word3)=split for " THIS IS THE STRING"
0
 
LVL 8

Expert Comment

by:Perl_Diver
Comment Utility
I guess it was really urgent......
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Perl count the hash for print 4 155
perl match and sort unique result 2 122
Perl efficient DB Call 8 75
quoting a comma separated list 20 63
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now