file script and cmd script difference
- From: jbtacuyan@xxxxxxxxx (Joseph)
- Date: Thu, 29 Jun 2006 14:50:01 +0800
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
.
- Follow-Ups:
- Re: file script and cmd script difference
- From: John W. Krahn
- RE: file script and cmd script difference
- From: Jeff Peng
- Re: file script and cmd script difference
- Prev by Date: Re: Windows XP ppm and perldoc problems
- Next by Date: cscope for perl?
- Previous by thread: dbi not installing
- Next by thread: RE: file script and cmd script difference
- Index(es):
Relevant Pages
|