Solved

Need help with this Perl Script ( missing Array )

Posted on 2014-03-31
6
242 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
  • 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

785 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