I for some reason am getting the following error from my perl program I am trying to use to gather info from our 3par units.

"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.


Could someone please explain why these "my" variable are not correctly declared?

#!/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; }


thank you monks for all your help so far!

In reply to Re^4: 3par data acquistion by bluethundr
in thread 3par data acquistion by bluethundr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.