...

View Full Version : this loop grinds the server to a crawl - why plz



bazz
11-01-2009, 01:57 AM
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


$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


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

oesxyl
11-01-2009, 02:14 AM
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

bazz
11-01-2009, 04:22 AM
Blimey, a stupid mistake which I hadn't made in an earlier snippet about an hour before. :(

Thanks oesxyl.

bazz



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum