Solved

Demilter without string tokenizer

Posted on 2006-11-01
4
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
Perl_Diver earned 500 total points
ID: 17851408
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
ID: 17851416
Please explain what's the urgency? Are you sitting in class taking a test?
0
 
LVL 84

Expert Comment

by:ozo
ID: 17851618

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

Expert Comment

by:Perl_Diver
ID: 17859244
I guess it was really urgent......
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

688 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