in reply to Re^3: 3par data acquistion
in thread 3par data acquistion
"my" variable %parvalues masks earlier declaration in same scope at ./ +3par-test2.pl line 23. "my" variable $parkeys masks earlier declaration in same statement at +./3par-test2.pl line 24. "my" variable %parvalues masks earlier declaration in same statement a +t ./3par-test2.pl line 24. "my" variable $parkeys masks earlier declaration in same statement at +./3par-test2.pl line 24. syntax error at ./3par-test2.pl line 22, near "$parvalues{" Global symbol "$parelement" requires explicit package name at ./3par-t +est2.pl line 22. Execution of ./3par-test2.pl aborted due to compilation errors.
#!/usr/bin/perl use strict; use warnings; use IO::Pipe; my @systems = ('3par-S400','3par-E200'); my $system = undef; my $output = undef; my $command = undef; foreach $system (@systems) { $output = run_command($system); while (<$output>) { next if (m/^$/); last if (m/^Press.*/); #print $_ . "\n"; my $parvalues{$parelement} = ($_ .=~/(.*?)\t+/g) { foreach my $parkeys (sort keys %parvalues){ print $parkeys, "\t", $parvalues{$parkeys}, "\n"; } } } close($output); } sub run_command { my $system = shift; my $protocol = 'ssh'; my $command = "statvv -ni"; my $space = " "; #The following is bad but it works for now.. my $do_command = $protocol . $space . $system . $space . $command; my $cmd = new IO::Pipe; $cmd->reader($do_command); return $cmd; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: 3par data acquistion
by callmeavis (Novice) on Aug 27, 2010 at 18:26 UTC |