CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
perl bash commands problem

 



Xploit
Novice

Apr 18, 2011, 7:45 AM

Post #1 of 2 (331 views)
perl bash commands problem Can't Post

i am trying to just play with simple bash commands in for loop in perl i am using the following code:

#!/usr/bin/perl
use warnings;
use strict;

open FILE, "<ips.txt" or die $!;
my @file = <FILE>;

for (@file) {

system("ping -c 1 $_ |grep 'bytes from'");


}

everything works but the grep part. what am i doing wrong?


miller
User

Apr 18, 2011, 10:09 AM

Post #2 of 2 (325 views)
Re: [Xploit] perl bash commands problem [In reply to] Can't Post

There's nothing inherantly wrong with that code except for the fact that you're not using backticks to capture the results. http://perldoc.perl.org/functions/qx.html

- Miller

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives