in reply to Re^3: Data::Dumper is returning empty
in thread Data::Dumper is returning empty

Sorry, I used a 5.10 construct. Change
map $_ // '[undef]'
to
map defined($_) ? $_ : '[undef]'

Update:

Concerning the code you posted, you introduced numerous errors:

for my $nic (networkInfo()) { print "Device: $nic->{device} has IP Address $nic->{ip}\n" . "\tMask: $nic->{mask}\n" . "\tBroadcast: $nic->{bcast}\n"; print "Device: $nic->{device} also IPv6 address $nic->{ip6}\n" if defined($nic->{device}); }

Replies are listed 'Best First'.
Re^5: Data::Dumper is returning empty
by MikeDexter (Sexton) on Jan 19, 2010 at 19:47 UTC

    Using the following code gives a different error about scoping

    Global symbol "%nic" requires explicit package name

    for my $nic (networkInfo()) { print "Device: $nic{device} has IP Address $nic{ip}\n" . "\tMask: $nic{mask}\n" . "\tBroadcast: $nic{bcast}\n"; print "Device: $nic{device} also IPv6 address $nic{ip6}\n" if defined($nic->{device}); }
      Copy and paste error on my part. The hash is accessed via the ref in $nic, so $nic needs to be derefed. Fixed in grandparent.

        what does fixed in grandparent mean?

Re^5: Data::Dumper is returning empty
by MikeDexter (Sexton) on Jan 19, 2010 at 19:38 UTC

    Much closer. I had to add a comma to end of that line. Now when it runs I get use of uninitialized value in pattern match (m//) lline 55 and 127 error.

    Are you sure you would like to delete all *.bak files that exist in: /emc/cccadm/scripts/perl/etc-test yes/no yes No files were found >>> Oper Sys: linux >>> Platform: RedHat >>> Hostname: ccasec1.centera.lab.emc.com Use of uninitialized value in pattern match (m//) at ./sec-test.pl line 55 (#1) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl tells you what operation you used the undefined value in. Note, however, that perl optimizes your program and the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program. Use of uninitialized value in pattern match (m//) at ./sec-test.pl line 127 (#1)

      The posted code doesn't have nearly that many lines.

        I posted only section because the script is getting long now<\p>

        line 51 if ($opsys_in =~ /linux/) { and line 123 if ($platform =~ /RedHat/) {

        If you want the entire script should I put it here?