Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Need help with this Perl Script ( missing Array )

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

==> CMS.LAN.db -v Internal

Can't use an undefined value as an ARRAY reference at /local/bin/ line 110, <> line 1709.

Can anyone have a look to see whats the issue?
Question by:richsark
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
LVL 28

Expert Comment

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.

Author Comment

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

Expert Comment

ID: 39969281
What is your expected output?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 28

Accepted Solution

FishMonger earned 2000 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


Author Comment

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

Expert Comment

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.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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

688 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