Hi list,

I'd like to ask explaination/help regarding this:

1)perl -e '%hash; for (`arp`) {($addr,$mac) = (split(/\s+/))[0,2]; 
$hash{$addr}= $mac } foreach (keys %hash) { print "\t $_ => $hash{$_}\n";}'
  it emits the output which i'm hoping to see ex: wrkstation => MACADDR;
but this:
2)
#!/usr/bin/perl

use strict;
use warnings;

my %macs;

for (`arp`) {
        my($addr,$mac) = (split(/s+/))[0,2];
        $macs{$addr} = $mac;
        }

foreach my $key (keys %macs) {
        print "\t $key => $macs{$key}\n";
        }

It's a doesn't produce the same thing, why?

Again thanks in advance.

/joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to