jmaya has asked for the wisdom of the Perl Monks concerning the following question:
------------ end code -------------#!/usr/bin/perl use strict; use warnings; my $program = 'netstat -a'; my @lines; my ($protocol, $localAddress, $foreignAddress, $state); open NETSTAT, "$program|" or die "Cannot open netstat $!\n"; @lines = <NETSTAT>; close NETSTAT; foreach (@lines) { /(\w+)\s+(\w+:\w+)\s+(\d+\.\d+\.\d+\.\d+):\w+\s+(\w+)/; if($1, $2, $3, $4) { $protocol = $1; $localAddress = $2; $foreignAddress = $3; $state = $4; print "$protocol, $localAddress, $foreignAddress, $state\n"; } }
Useless use of a variable in void context at netstatReader.pl line 2 +6. Useless use of a variable in void context at netstatReader.pl line 2 +6.
20030818 Edit by Corion: Fixed formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with warnings!!!
by liz (Monsignor) on Aug 18, 2003 at 20:02 UTC | |
|
Re: Help with warnings!!!
by Thelonius (Priest) on Aug 18, 2003 at 20:25 UTC | |
|
Re: Help with warnings!!!
by dragonchild (Archbishop) on Aug 18, 2003 at 20:02 UTC | |
|
Re: Help with warnings!!!
by tcf22 (Priest) on Aug 18, 2003 at 20:04 UTC | |
by jmaya (Acolyte) on Aug 18, 2003 at 20:14 UTC |