Re: Proposed correction

2012-09-17 Thread jmrhide-perl
} #ADDED LINE } Does that look reasonable? Other attempts to send the script garbage would just cause it to tell you your answer was wrong, I think. John M Rathbun MD From: Jim Gibson To: Perl Beginners Sent: Mon, September 17, 2012 10:18:1

Re: Proposed correction

2012-09-17 Thread Jim Gibson
On Sep 17, 2012, at 6:52 AM, Shlomi Fish wrote: > Hi, > > I apologise for having sent that to Dr. Rathbun in private - that was not my > intention but a misuse of software. Resending to the list. > > On Sun, 16 Sep 2012 19:31:01 -0700 (PDT) > jmrhide-p...@yahoo.com wrote: > >> for (my $loopite

Re: Proposed correction

2012-09-17 Thread Shlomi Fish
Hi, I apologise for having sent that to Dr. Rathbun in private - that was not my intention but a misuse of software. Resending to the list. On Sun, 16 Sep 2012 19:31:01 -0700 (PDT) jmrhide-p...@yahoo.com wrote: > for (my $loopiter = 0; $loopiter < $loopmax; $loopiter++) { #1 > if ($

Re: Proposed correction

2012-09-17 Thread jmrhide-perl
e'll have the beast tamed! Thanks for your helpful comments! John M Rathbun MD From: Shlomi Fish To: jmrhide-p...@yahoo.com Sent: Mon, September 17, 2012 3:01:19 AM Subject: Re: Proposed correction Hi, On Sun, 16 Sep 2012 19:31:01 -0700 (PDT) jmrhide-p...

Re: Proposed correction

2012-09-17 Thread Shawn H Corey
On Sun, 16 Sep 2012 19:31:01 -0700 (PDT) jmrhide-p...@yahoo.com wrote: > for (my $i = 0; $i < @ary1; $i++) {Leaving aside other concerns, for > the moment, is there a better way to write that first line? You mean: for my $i ( 0 .. $#ary1 ){ # ... } -- Just my 0.0002 millio

Proposed correction

2012-09-16 Thread jmrhide-perl
for (my $loopiter = 0; $loopiter < $loopmax; $loopiter++) { #1 if ($loopiter >= ($loopmax - 1)) { die "Loop number $loopnum has iterated $loopiter times" } $termnum[0] = int( rand($defnum) ); last unless ( $termnum[0] == $lastnum ); }

Re: Fw: Proposed correction for my long script

2012-09-16 Thread Uri Guttman
On 09/16/2012 09:34 PM, jmrhide-p...@yahoo.com wrote: I copied what was on the manpage for CGI::carp I lost my way on that one, but I don't see how a shuffle works here either. I'm trying to ensure that the program will not pick the same term twice in a row. $lastnum comes from a cookie and re

Re: Fw: Proposed correction for my long script

2012-09-16 Thread jmrhide-perl
to these looping structures that recur throughout the process of constructing new questions John M Rathbun MD From: Uri Guttman To: beginners@perl.org Sent: Sun, September 16, 2012 8:10:50 PM Subject: Re: Fw: Proposed correction for my long script On 09/16/2012 07:40

Re: Fw: Proposed correction for my long script

2012-09-16 Thread Uri Guttman
On 09/16/2012 07:40 PM, jmrhide-p...@yahoo.com wrote: I guess I've been vague again. I was really hoping for somebody to cast an eye on the subroutines I added earlier today. My intention was to (1) prevent any infinite looping and (2) get notification if one of the loops misbehaves. Did I make a

Fw: Proposed correction for my long script

2012-09-16 Thread jmrhide-perl
n the snippets of code below? John M Rathbun MD - Forwarded Message From: "jmrhide-p...@yahoo.com" To: beginners@perl.org Sent: Sun, September 16, 2012 3:46:47 PM Subject: Proposed correction for my long script OK, here's my amateurish attempt at a correction: #!/usr

Re: Proposed correction for my long script

2012-09-16 Thread Uri Guttman
On 09/16/2012 03:46 PM, jmrhide-p...@yahoo.com wrote: OK, here's my amateurish attempt at a correction: i know you said you don't want to learn to be a professional coder. but there are so many ways to improve your code little by little. most here have been shying away for good reason and bec

Re: Proposed correction for my long script

2012-09-16 Thread Peter Scott
On Sun, 16 Sep 2012 12:46:08 -0700, jmrhide-perl wrote: > Does it look OK? This is a prime example of something that a test harness would be very useful for, then we'd all know the answer. There may be some entirely different reason why your provider thinks this script is consuming excessive re

Proposed correction for my long script

2012-09-16 Thread jmrhide-perl
OK, here's my amateurish attempt at a correction: #!/usr/local/bin/perl use warnings; use strict; use diagnostics; use CGI; my $cgi = new CGI; use Mail::Sendmail; use CGI::carp qw(set_die_handler); BEGIN { sub handle_errors { my $msg = shift; sendmail( From => 'i...@the