Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Please help me find my error.

by muba (Priest)
on Jun 21, 2012 at 23:25 UTC ( #977730=note: print w/replies, xml ) Need Help??

in reply to [ RESOLVED ] Please help me find my error.

foreach $item ($costs)
You probably mean foreach $item (keys %costs). Note the use of the keys keywords so that you only loop over the keys of %costs, so that you can then do $cost += $costs{$item};

You wrote $costs, you probably meant %costs.

my %costs = $v{hourly_worker_expenses};
This also probably isn't what you meant, because earlier you assigned a hashref to that slot. And hashrefs need to be dereferenced. The line should probably read my %costs = %{$v{hourly_worker_expenses}};


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977730]
[stevieb]: been thinking... if it wasn't for Perl, I believe that I'd be done in tech. I don't do social media or the like, if I'm not coding I'm not on a device at all, and don't miss comms at all when I'm not around. I code for my job (which I like), but I think..
[stevieb]: ...I haven't coughed up my laptop because of Perl.
[stevieb]: I think that Perl is the reason that I haven't gone 100% off grid :)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2017-03-29 02:06 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (343 votes). Check out past polls.