Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hello Monks

I need help on an perl warning. I am looking at the code for hours but I can't figure out the problem

Perl is complaining about the useless use of a private variable in void context on line 157 (#2) (W void)

Here the code:
Its a sub for parsing the content of a map-file.
Line number 157 is marked by a comment.

Any help is welcome!!!

sub ProcessMapFile { my $self = shift; my $MapFile = $_[0]; my $PlaceToPutInformation = $_[1]; #Each config profile defines its own way how to parse the map-file +. my $iterator = $ProfileInformation->{'StartLine'}; #Process map-file for ( $iterator ; $iterator < @$MapFile ; $iterator++ ) { if ( $MapFile->[$iterator] =~ m! ^ #Begin with.. (\S+) #matiching non space character: START Memory \s+ #space characters (\S+) #matiching non space character: END Memory \s+ #space characters (\S+) #matiching non space character: Size \s+ #space characters (\S+) #matiching non space character: Symbol (g = glob +al, l = static) \s+ #space characters (\S+) #matiching non space character: Name \s+ #space characters (\S+) #matiching non space character: Memory \s+ #space characters (\S+) #matiching non space character: Output Section \s+ #space characters (\S+) #matiching non space character: Input Section \s+ #space characters (\S+) #matiching non space character: Input Object !x ) { #Process Zero sized (uninitialized) memory $PlaceToPutInformation->{'Maps'}{'HIGHTEC'}{$5} = { 'Start' => $1, 'End' => $2, 'Size' => $3, 'Symbol' => $4, 'Memory' => $6, 'OutputSection' => $7, 'InputSection' => $8, 'InputObject' => $9, }; $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'OverallSize'} = + 0 if ( not exists $PlaceToPutInformation->{'Memory'}{'HIGHTEC'} {'OverallSize'} ); $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'OverallSize'} = $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'OverallSize'} + + $3; $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'Memory'}{$6} = +0 if ( not exists $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'Memo +ry'} {$6} ); $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'Memory'}{$6} = $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'Memory'}{$6} ++ $3; $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'OutputSection'} +{$7} = 0 if ( not exists $PlaceToPutInformation->{'Memory'}{'HIGHTEC'} {'OutputSection'}{$7} ); $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'OutputSection'} +{$7} = $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}{'OutputSection +'} {$7} + $3; } else { last; } } # This is line 157 #Create Array of Names for quick check! my @a = keys( %{ $PlaceToPutInformation->{'Maps'}{'HIGHTEC'} } ); $PlaceToPutInformation->{'SymbolCollection'}{'HIGHTEC'} = \@a if ( +@a); }

In reply to Can't get rid of: Useless use of private variable in void context by tobias_hofer

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (8)
    As of 2018-06-25 10:28 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (126 votes). Check out past polls.