Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Array Problem

by Necos (Friar)
on Jul 08, 2005 at 16:45 UTC ( [id://473495]=note: print w/replies, xml ) Need Help??


in reply to Array Problem

Well, I wrote a similar test program for my linux machine to test the status of our network printers. It's a simple snippet of code.
#!/usr/bin/perl -w use strict; my $ip = '10.195.16'; open( 'FH' , ">printer_ping"); for ( 30 .. 200 ) { my $test = join('.',$ip,$_); print "Now pinging $test\n"; my $output = `ping -c 2 $test`; print $output; print FH $output; }
The nice thing about this code is that it prints both to standard output, and to file, and can be easily modified to print anywhere else.
Theodore Charles III
Network Administrator
Los Angeles Senior High
email->secon_kun@hotmail.com
perl -e "map{print++$_}split//,Mdbnr;"

Replies are listed 'Best First'.
Re^2: Array Problem
by wanderinweezard (Initiate) on Jul 08, 2005 at 18:54 UTC
    That's great, it works really well. I'm trying to simplify the output into basically IP Address: Result... So, I was wanting to, using your example, pass $output through a check and see if it contains either the word "Reply" or the word "Request"... Is it possible to do something like this?

    I am not sure how to make the (m/Reply/) check if that is inside the $output variable?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-03-28 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found