Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    this loop grinds the server to a crawl - why plz

    I don't understand why this snippet would grind the server to a crawl.

    Having passed a number of vars from a form of checkboxes, I am trying to put them in their own hash for passing to a sub.

    here's the dumper data of the form data being passed
    Code:
    $VAR1 = {
              '1' => '2009-10-02�2009-10-03�2009-10-04�2009-10-05',
              '2' => '2009-10-05�2009-10-06�2009-10-07�2009-10-08'
            };
    here's the snippet
    Code:
      foreach my $room (sort %form){
    
        if ($room =~/^\d+$/ ) { #if room is a number.
      
          my $dates = $form{$room};
    
            print qq( room=$room : date=$dates<br />  );
        }
      }
    baffled.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Code:
      foreach my $room (sort keys %form){
    
        if ($room =~/^\d+$/ ) { #if room is a number.
      
          my $dates = $form{$room};
    
            print qq( room=$room : date=$dates<br />  );
        }
      }
    I guess $date[$room] is a array.

    best regards

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Blimey, a stupid mistake which I hadn't made in an earlier snippet about an hour before.

    Thanks oesxyl.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •