Thanks Jim. I see my error now. I didn't realize you could just backtick in a for like that.
On Feb 8, 2010, at 7:06 PM, Jim Gibson wrote: > On 2/8/10 Mon Feb 8, 2010 3:55 PM, "Curt Shaffer" <cshaf...@gmail.com> > scribbled: > >> OK. So I have tried some things. I guess the largest issue that I can't find >> an answer for elsewhere is how to evaluate variables to be >, = or <100 in >> one >> evaluation. >> >> Before I get there, obviously I need to get the variables. >> >> Here is what I am trying to do for that: >> >> @hping_array = (); >> $hcount = 1; >> for (; $hcount < 5;){ >> >> system ("sudo hping3 $domain -S -p 80 -c 1|awk '{print $5}'"); >> chomp; >> push hping_array, $_; >> $hcount++; >> } >> print "@hping_array\n"; >> >> So the code is trying to run the hping3 command against $domain. I am awking >> for $5 which is the IPID value in the response. I am trying to push it into >> the array @hping_array. This should happen 5 times. >> >> Then I'm printing @hping_array. I'm only getting one value and it is actually >> the whole response from hping. It seems to not respect the awk. > > The system function does not return the output of the external command to > the callsign Perl program. > > See perldoc -q "output of a command" > "Why can't I get the output of a command with system()? > > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/