Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Can't get rid of: Useless use of private variable in void context

by Anonymous Monk
on Feb 25, 2013 at 10:08 UTC ( [id://1020484]=note: print w/replies, xml ) Need Help??


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

#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, }; local *HTEC = $PlaceToPutInformation->{'Memory'}{'HIGHTEC'}; $HTEC{'OverallSize'} ||= 0; $HTEC{'OverallSize'} = $HTEC{'OverallSize'} + $3; $HTEC{'Memory'}{$6} ||= 0; $HTEC{'Memory'}{$6} = $HTEC{'Memory'}{$6} + $3; $HTEC{'OutputSection'}{$7} ||= 0; $HTEC{'OutputSection'}{$7} = $HTEC{'OutputSection'}{$7} + $3;

Replies are listed 'Best First'.
Re^2: Can't get rid of: Useless use of private variable in void context
by tobias_hofer (Friar) on Feb 25, 2013 at 10:18 UTC

    Yes, much more beautiful!
    sadly I still got to use perl 5.10 so local *HTEC... is not working

    However, the  ||= 0 version makes the code much more better and makes me get rid of all the if statements!
    I will use it that way!
    Thanks a lot!

    Cheers!

    Tobias

      sadly I still got to use perl 5.10 so local *HTEC... is not working

      Sure it is, it worked since the very first perl5, at least

      perl -MData::Dump -e" dd $f={2,{4,{6,8}}}; local *H=$$f{2}{4}; dd\%H" { 2 => { 4 => { 6 => 8 } } } { 6 => 8 }
        Hey, you are right! :-)
        Perfect!

        But there is one thing, I have to remove the  use strict;
        else I get a:
        Global symbol "%HTEC" requires explicit package name at...

        Thanks a lot!
        Tobias

Re^2: Can't get rid of: Useless use of private variable in void context
by Anonymous Monk on Feb 25, 2013 at 10:10 UTC
    Bah, start short too :)
    $HTEC{$5} = { 'Start' => $1, 'End' => $2, 'Size' => $3, 'Symbol' => $4, 'Memory' => $6, 'OutputSection' => $7, 'InputSection' => $8, 'InputObject' => $9, };
      and while you're at it, drop the single quotes for barewords :)

      $HTEC{perl}{is}{Perl}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1020484]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-28 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found