S
sbk
hi,
i'm using a module which returns a reference to a blessed hash, and i'm
having trouble figuring out how to pull apart this data structure.
guru% cat test
#!/usr/bin/perl
use strict;
use warnings;
use Data:
umper;
use Net::NBName;
my $ip = "10.1.2.3";
my $nb = Net::NBName->new;
my $ns = $nb->node_status($ip);
print Dumper($ns);
guru% ./test
$VAR1 = bless( {
'mac_address' => '8C-6B-20-5C-00-00',
[...]
but of course, i don't want use Dumper in my real program ... i want to
extract the values in this blessed hash and do useful things with them.
i haven't figured out the syntax i would need to do this.
the following seemed reasonable to be ... but they didn't work ... so
much for my sense of reasonableness:
my $temp = $ns->mac_address;
print "$temp\n";
or
my $temp = $ns->{'mac_address'};
print "$temp\n";
would anyone be willing to offer me alternate syntax?
--sk
stuart kendrick
fhcrc
i'm using a module which returns a reference to a blessed hash, and i'm
having trouble figuring out how to pull apart this data structure.
guru% cat test
#!/usr/bin/perl
use strict;
use warnings;
use Data:
use Net::NBName;
my $ip = "10.1.2.3";
my $nb = Net::NBName->new;
my $ns = $nb->node_status($ip);
print Dumper($ns);
guru% ./test
$VAR1 = bless( {
'mac_address' => '8C-6B-20-5C-00-00',
[...]
but of course, i don't want use Dumper in my real program ... i want to
extract the values in this blessed hash and do useful things with them.
i haven't figured out the syntax i would need to do this.
the following seemed reasonable to be ... but they didn't work ... so
much for my sense of reasonableness:
my $temp = $ns->mac_address;
print "$temp\n";
or
my $temp = $ns->{'mac_address'};
print "$temp\n";
would anyone be willing to offer me alternate syntax?
--sk
stuart kendrick
fhcrc