Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Unable to extract elements from a split. Kindly Help.

by Generoso (Prior)
on Dec 24, 2011 at 05:31 UTC ( [id://945016]=note: print w/replies, xml ) Need Help??


in reply to Unable to extract elements from a split. Kindly Help.

Since you do not say what is the expected result, my answer is guessing you want the element 3 from line 4.

Try this:

#!/usr/bin/perl use warnings; use strict; my @eachlinecmd = `ping 127.0.0.1`; my @eachwordcmd = split (/ /, $eachlinecmd[4]); print "@eachlinecmd\n"; print "@eachwordcmd\n"; print "$eachlinecmd[4]\n"; print "$eachwordcmd[3]\n";
perl "F:\perl_TK\perl1ping.pl" Process started >>> Pinging 127.0.0.1 with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 bytes=32 <<< Process finished. ================ READY ================

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://945016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-26 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found