473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Process string.

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
Jul 19 '05 #1
3 2708
Hon Seng Phuah wrote:
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?


http://learn.perl.org/

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #2
Gunnar Hjalmarsson <no*****@gunnar.cc> wrote in message news:<S3********************@newsb.telia.net>...
Hon Seng Phuah wrote:
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?


http://learn.perl.org/


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
Jul 19 '05 #3
Hon Seng Phuah wrote:
Gunnar Hjalmarsson <no*****@gunnar.cc> wrote in message
news:<S3********************@newsb.telia.net>...
Hon Seng Phuah wrote:
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?

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
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JC | last post by:
I'm trying to create a GUI wrapper for dumpbin, and so I'm using the Process class to run the command-line application. The problem is that if I use Readline() to get the output from the...
4
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
4
by: Christian Billig | last post by:
Hi, well i've a problem and i don't know how to solve it. I wrote a function, which starts a Process for a user by using the API CreateProcessWithLogon. Afterwards i want to know if the...
7
by: Devron Blatchford | last post by:
Hi there, I am trying to develop a small menu application to run on an RF network, we are using a wavelink server to communicate with our rf scanners and run VB.NET applications on our server...
12
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
15
by: jcrouse | last post by:
Here is my code: Dim sw As StreamWriter = File.CreateText(Application.StartupPath & "\mameversion.bat") sw.WriteLine(lblMameExePath.Text & " -help >""" & Application.StartupPath &...
6
by: jcrouse | last post by:
This is kind of a continuation of another thread that was somewhat resolved: Well, the dilemma seems to be this. I want to be able to hide the DOS box AND pause the code until execution is...
0
by: =?Utf-8?B?Um9i?= | last post by:
I've a requirement to monitor when certain applications are started. I'm using WMI called from VS Stusio 2005 in VB to trap Excel and Word starting. I've written the following console application...
4
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.