zakishah has asked for the wisdom of the Perl Monks concerning the following question:
Hi, monks i want to save result of traceroute in different files, and i am using for loop, how can i do that , my code seems to be not working. Any help will be appreciated. my code is ....
#use strict; #use warnings; open FILE, '<', "dns.txt" or die $!; my @dude; while (my $line = <FILE>) { my ($ip) = $line =~ /(\d+\.\d+\.\d+\.\d+)/; push(@dude,$ip); } my $num = @dude + 1; for(my $o = 0; $o<$num; $o++){ system ("ssh a.AS1 traceroute @dude[$0] > file"+"$0.txt "); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to save result in multiple files using for loop in perl
by davido (Cardinal) on Aug 27, 2012 at 22:31 UTC | |
|
Re: how to save result in multiple files using for loop in perl
by linuxer (Curate) on Aug 27, 2012 at 22:23 UTC | |
|
Re: how to save result in multiple files using for loop in perl
by jethro (Monsignor) on Aug 27, 2012 at 22:33 UTC | |
|
Re: how to save result in multiple files using for loop in perl
by ww (Archbishop) on Aug 27, 2012 at 23:48 UTC | |
|
Re: how to save result in multiple files using for loop in perl
by Rudolf (Pilgrim) on Aug 27, 2012 at 22:28 UTC |