Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Use of uninitialized value $_ in pattern match (m//)

by toolic (Bishop)
on Mar 09, 2016 at 17:45 UTC ( [id://1157194]=note: print w/replies, xml ) Need Help??


in reply to Use of uninitialized value $_ in pattern match (m//)

You should delete all elements of the array each time through the loop, not assign the value undef to the 1st element. Change:
@net_configs = undef;
to:
@net_configs = ();

Tip #4 from the Basic debugging checklist: Data::Dumper

Replies are listed 'Best First'.
Re^2: Use of uninitialized value $_ in pattern match (m//)
by perlfan (Vicar) on Mar 09, 2016 at 17:52 UTC
    For that matter, initialize

    my @net_configs = ();

      ... initialize my @net_configs = ();

      Why? What would  @net_configs look like if one were to depend on the default initialization of a newly-created lexical array?


      Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1157194]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found