Process string.

H

Hon Seng Phuah

Hi all,

I am new to perl language and need someone to help me.

If I have three sentenses.

Too good to be true.
It is raining today.
They wanted the meeting to be on Thursday.

If I want to get the second of word of each sentense. How shall I
write a function in perl language?

Thanks and have a good day.
-HS Phuah
 
H

Hon Seng Phuah

Gunnar Hjalmarsson said:

Thanks for the url link. The url link examples are too simple and do
not help me to solve above problem. If you have an example to extract
the second word in each sentenses by using for or while, could you
please write your function and post it to this newsgroup.

Thanks and have a good day.
-HS Phuah
 
J

Jürgen Exner

Hon said:
The [...] examples are too simple and do
not help me to solve above problem. If you have an example to extract
the second word in each sentenses by using for or while,

You don't use a loop for that. Have a look at the split() function.
Depending upon how you define a word all you need to do is probably
splitting the string at space characters and then just take the second
element.

(undef, $word) = split / /, $sentence;
could you
please write your function and post it to this newsgroup.

Really, you are thinking way to complicated. Nobody would write a function
for that.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JavaScript String Syntax Checking 5
Inter-process locking 4
Help with code 0
Learning to programm 1
process do not join? 1
Help with code plsss 0
Can someone please help me 1
Help with my responsive home page 2

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top