Nevermind I got it!
my @a=(); my $e=0; my $res = Net::DNS::Resolver->new; my $query = $res->query(".ohnet", "NS"); if ( $query != 0 or $query != undef or $query != ' ' ) { foreach ($query->answer) { if ( $_->type eq 'NS' ) { #next unless $_->type eq "A"; #print $_->nsdname,"\n"; foreach ($_->nsdname) { push (@a,$_) if $_ =~ "svr"; $e++; } } else { warn "query failed: ", $res->errorstring, "\n"; } } print $a[0],"\n"; print $a[1],"\n"; } Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams 614-566-4145 Derek Smith/Staff/OhioH ealth To Perl Beginners <beginners@perl.org> 03/01/2005 02:17 cc PM Subject assigning data to array, but only element 0 is getting the data my @a=(); my $res = Net::DNS::Resolver->new; my $query = $res->query(".ohnet", "NS"); if ( $query != 0 or $query != undef or $query != ' ' ) { foreach ($query->answer) { if ( $_->type eq 'NS' ) { #next unless $_->type eq "A"; #print $_->nsdname,"\n"; foreach ($_->nsdname) { push @a,$_; $a++; } print $a[1]; }else{ ..... } } } The end output looks like svrqip01 svrqip02 svgqip01 svgqip02 svvqip01 svvqip02 and in the end all I want is svrqip 01 and 02 which is why I am assigning $_->nsdname to an array, but the only element that is getting any data is 0??? thank you, derek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>