Solved

Need help with this Perl Script ( missing Array )

Posted on 2014-03-31
6
243 Views
Last Modified: 2014-04-03
Hello , I have this script that when I run it against this zone file I get this error


==> ms-fix-ad-rrs.pl CMS.LAN.db -v Internal

Can't use an undefined value as an ARRAY reference at /local/bin/ms-fix-ad-rrs.pl line 110, <> line 1709.

Can anyone have a look to see whats the issue?
ms-fix-ad-rrs-.txt
CMS.LAN.txt
0
Comment
Question by:richsark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 28

Expert Comment

by:FishMonger
ID: 39968371
The error message is telling you that $rrs{$zone} is undefined.

More specifically, CMS.LAN (which is what $zone resolves to) is not a key of the %rrs hash.
0
 
LVL 1

Author Comment

by:richsark
ID: 39968415
Ok. So what can I do to make this work ?
0
 
LVL 28

Expert Comment

by:FishMonger
ID: 39969281
What is your expected output?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Accepted Solution

by:
FishMonger earned 500 total points
ID: 39969334
Perl is case sensitive, so a hash key of 'CMS.LAN' is not the same key as 'cms.lan'.  Your %rrs hash does have a 'cms.lan' key.

So, maybe all you need to do is lowercase $zone either when it's being assigned or when you use it in the join statement on line 110.

my $dclist = join ( ", " , @{ $rrs{lc $zone} } );

Open in new window

0
 
LVL 1

Author Comment

by:richsark
ID: 39970181
Ok. Just want it to run without an array issue. Can that me done ? Or have the script compensate for capital letters ?
0
 
LVL 28

Expert Comment

by:FishMonger
ID: 39970213
My #39969334 post shows how to compensate for capital letters in $zone.

However, since you haven't explained what your output expectation is, I can't say if there are any other adjustments that will be need to be applied.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Utilizing an array to gracefully append to a list of EmailAddresses
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question