in reply to Re: Common Beginner Mistakes
in thread Common Beginner Mistakes
#!/usr/local/bin/perl -w use strict; sub step_over_desert # () I won't repeat this mistake anymore!!! { print "Tsock...\n"; } sub cover_the_distance # () I won't repeat this mistake anymore!!! { my ($me, $desert_width, $max_spit_distance, $num_legs, $last_name, + $day_phone, $days_without_water) = @_; my $num_steps=0; while($desert_width) { my $todo = $desert_width * $num_legs; print "$desert_width miles remaining; $todo steps yet to do.\n" +; step_over_desert(); $desert_width--; $num_steps += $num_legs; } print "Steps made: $num_steps\n"; } #cover_the_distance("strong animal", 5, 15, 4, "Mabooka", "(123)-456-7 +890", -1); cover_the_distance("strong animal", "five thousand miles", 15, 4, "Mab +ooka", "(123)-456-7890", -1); 1;
Well guess what? Once in 10000 times the server would get tired and send a garbled status line -- smth. like:while($numlines) { get_next_one(...); $numlines--; ... }
and200 OK whatever,man
will start the almost infinite loop. (Try the code above).(while "whatever,man"--) {....}
-?."Larry"--;
|
---|