atmosphere has asked for the wisdom of the Perl Monks concerning the following question:
My dilemma is that I have repeated this code 5 times changing only the numbers at the end of my arrays and variables which is where I would like the for loop to come in so I would only need to have the one iteration. Thanks in advance for any and all suggestions/help!if (scalar@row1 == "6") { @entry1 = (@required , @row1); $digest1 = sha1_hex(@entry1); $sth = $dbh->prepare($query); $sth->execute($digest1); $data1 = $sth->fetchrow_array(); if ($data1 ne $digest1) { push(@entry1, $digest1); $sth = $dbh->prepare($insert); $sth->execute(@entry1); &create_pdf(@entry1); $msg->attach( Type => 'image/gif', Path => "../pdfs/ir_$diges +t1.pdf", Filename => "ir_$digest1.pdf", Disposition => 'attachment') } else {$dberr +or .= "The following row you submitted: <br> @entry1 <br>already exsi +ts in the database and will note be re-submitted. <br>"} };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cleaning up Code
by ikegami (Patriarch) on Dec 10, 2008 at 00:25 UTC | |
by atmosphere (Novice) on Dec 10, 2008 at 02:44 UTC | |
by ikegami (Patriarch) on Dec 10, 2008 at 03:37 UTC | |
by atmosphere (Novice) on Dec 10, 2008 at 04:38 UTC | |
by ikegami (Patriarch) on Dec 10, 2008 at 06:17 UTC | |
| |
|
Re: Cleaning up Code
by GrandFather (Saint) on Dec 10, 2008 at 00:30 UTC | |
|
Re: Cleaning up Code
by mikelieman (Friar) on Dec 10, 2008 at 02:12 UTC | |
|
Re: Cleaning up Code
by jimX11 (Friar) on Dec 16, 2008 at 15:16 UTC |