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

Re: Perl Hash Script

by muba (Priest)
on Jan 08, 2013 at 15:59 UTC ( #1012263=note: print w/ replies, xml ) Need Help??

in reply to Perl Hash Script

One thing I can spot right away regards these lines.

foreach my $empnum(sort keys %empwork) { my $periods=0; $periods++; my $hours = 0; $hours += $empwork{$empnum};

Your code boils down to

foreach my $empnum(sort keys %empwork) { my $periods = 1; my $hours = $empwork{$empnum}
I doubt that is what you really want.

Did you mean this instead?

my $periods=0; my $hours = 0; foreach my $empnum(sort keys %empwork) { $periods++; $hours += $empwork{$empnum};

Comment on Re: Perl Hash Script
Select or Download Code
Replies are listed 'Best First'.
Re^2: Perl Hash Script
by prithviraj (Novice) on Jan 08, 2013 at 16:10 UTC
    I am not getting the exact output for your code Sir.

      I never claimed you it would. I was merely questioning whether your script might suffer from a logical error, and explaining why I think it does. Does it?

      Edit: s/you/it/

        Yes. You are right.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2015-11-25 05:11 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (670 votes), past polls