you can use

$outstring=`ping -a $hostname | cut -c20-30`;

----- Original Message ----- From: "Wiggins d Anconia"
<[EMAIL PROTECTED]>
To: "Werner Otto" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 7:46 PM
Subject: Re: String Variable


> > hi there,
> >
> > I've got the following example:
> >
> > system ("ping -a $hostname | cut -c20-30");
> >
> > how do I get the following result which is (is alive) into a string
> > variable as I keep on getting 0
> >
> > Please help.
> >
>
> Seems like you might want to post these types of things to
> [EMAIL PROTECTED] as they don't have a lot to do with CGI.
>
> 'system' returns a combination of exit values from the command. The 0
> indicates that the command was successful.
>
> perldoc -f system
>
> For more on parsing return values.
>
> Since you are looking for the output from the command you should
> consider using backticks also known as the qx operator,
>
> perldoc perlop (search for qx)
>
> Additionally you may want to read through,
>
> perldoc perlipc
> perldoc IPC::Open3
>
> If you are still stuck as it introduces Open3/Open2, etc.
>
> Point your additional questions to the beginners group, lots of people
> there ready to help.
>
> HTH,
>
> http://danconia.org
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to