Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 11-01-2009, 02:57 AM   PM User | #1
bazz
Senior Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 4,330
Thanks: 35
Thanked 151 Times in 147 Posts
bazz will become famous soon enoughbazz will become famous soon enough
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.
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Old 11-01-2009, 03:14 AM   PM User | #2
oesxyl
Senior Coder


 
Join Date: Dec 2007
Posts: 4,658
Thanks: 374
Thanked 562 Times in 551 Posts
oesxyl has a spectacular aura aboutoesxyl has a spectacular aura about
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
oesxyl is offline   Reply With Quote
Old 11-01-2009, 05:22 AM   PM User | #3
bazz
Senior Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 4,330
Thanks: 35
Thanked 151 Times in 147 Posts
bazz will become famous soon enoughbazz will become famous soon enough
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.
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:40 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.