Solved

Need help with this Perl Script ( missing Array )

Posted on 2014-03-31
6
248 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Six Sigma Control Plans

635 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