Aaron Sherman:
>     perl -MNet::Ping -nle 'print "Ghost DHCP lease: $1"
>       if /lease\s+(\d\S+)/ &&
>       ! Net::Ping->new("icmp")->ping($1)' \
>       /var/state/dhcp/dhcpd.leases
   
This becomes
     perl -MNet::Ping -nle 'print "Ghost DHCP lease: $1"
        if /lease\s+(\d\S+)/ &&
        ! Net::Ping.new("icmp").ping($1)' \
        /var/state/dhcp/dhcpd.leases

Look, it's even shorter! :)

>       nice du -a | sort -n | tail -300 | tac | perl -nle '
>               die "Require non-zero disk size!\n" unless $ENV{DF};
>               if ($. == 1) {
>                       $total = $_ + 0;
>                       next;
>               }
>               ($size,$rest) = split /\s+/, $_, 2;
>               if ($rest =~ /^\.\/([\w.\-]+)\//) {
>                   next if $count{$1}++ >= 3;
>               }
>               printf "%5.1f%% %5.1f%% %11s %s\n", $size/$ENV{DF}*100,
>                       $size/$total*100, $size, $rest;' |\
>               head -100

This doesn't change at all. 

-- 
Ever wake up feeling like a null pointer? -Allan Pratt

Reply via email to