Wagner, David --- Senior Programmer Analyst --- CFS wrote:
-----Original Message-----
From: Brian [mailto:brian5432...@yahoo.co.uk]
Sent: Friday, April 17, 2009 11:03
To: Perl Beginners
Subject: help needed to get over endless loop
Hi
I had this semi-working, changed something and can't remember where I
went right, so would appreciate some help getting back on top.
I know 1..10 and 2..10 probably won't work in the following
example, I
have just changed lines to show what I am trying to get.
You are not running with strict, warnings which would give you a
heads up
$mystart = -2;
$i = 1;
for ($i = 1..10 ) {
while ($i = 1 ) {
You would get warning if warnings were on. You are assigning 1
to $i and not $i == 1.
Better to give your code for the list to review.
I pretty much scrapped everything I had and have used the code as posted
as a new starting point, therefore that is all I am working with at the
moment.
if I use strict I get a couple of screenfuls of warnings, mostly
Global symbol "$xxx" requires explicit package name at ....
and a few Bareword warnings, but they seem to be because of
"strict subs" in use
If I can answer both you and Jim here...
I want to count from 1 to 10, I assigned $i as 1 so as not to need to
test $i against negative.
However, at the count of 1, I check to see if $mystart is positive or
negative.
If it is neg, a null value is printed.
If it is pos, $mystart is printed in red.
From count 2 thru 10...
If it is neg, a null value is printed.
If it is pos, $mystart is printed in black.
I need to retain the value of $i as this block of code will be re-used
further into the cgi.
regards
Brian
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/