On 11/16/06, Jay Savage <[EMAIL PROTECTED]> wrote:
On 11/16/06, Andy Greenwood <[EMAIL PROTECTED]> wrote:
> I'm writing a script for work that will dig for DNS records for a
> given domain name and put the entries into an array. At the end of the
> digging, it outputs the array elements to the screen, asks if
> everything looks good, and if so, writes them out to the shell and
> builds a zone file. However, I've come across a wierd problem
[snip]
Not weird at all. Your problem is most likely right here:
> @digOut = `dig [EMAIL PROTECTED] $mx`;
take a look at the foreach section of the perlsyn (perl syntax) man
page. you should read the whole thing if you're having these kinds of
trouble (actually, you should read it anyway), but the relevant bit
for the moment is:
"If any part of LIST is an array, foreach will get very confused if
you add or remove elements within the loop body, for example with
splice. *So don't do that.*"
Or in this case, by replacing the entire array with new output from
dig in the subroutine.
Aha! thank you so much. using a different array var in the subroutine
did indeed fix it.
HTH,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org
values of β will give rise to dom!
--
I'm nerdy in the extreme and whiter than sour cream