Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found