in reply to find element in array, then advance to next element
use strict; use warnings; use Data::Dumper; use Getopt::Long; my $args = 'nmap -sS -iL ips.txt -p 1-1024 172.27.1.4'; @ARGV = split /\s+/, $args; my %opt; GetOptions(\%opt, 'sS', 'iL=s', 'p=s'); print 'opt hash ', Dumper(\%opt); print 'ARGV ', Dumper(\@ARGV); __END__ opt hash $VAR1 = { 'sS' => 1, 'p' => '1-1024', 'iL' => 'ips.txt' }; ARGV $VAR1 = [ 'nmap', '172.27.1.4' ];
Update: related node: search array for item, move to next item
|
|---|