in reply to Using loops inside an 'if' statement

Your first example contains an error:
if ($checkbox) { #open file while (<FILE>) { # ^^ these two were exchanged #do something } }

Maybe that was the problem?

Liz

Replies are listed 'Best First'.
Re: Re: Using loops inside an 'if' statement
by jonnyfolk (Vicar) on Oct 02, 2003 at 10:27 UTC

    That typo was created especially for my question, I'm afraid. My apologies for that.

    I can't provide the code that I was having provlems with because I made so many changes getting it to work that I no longer have the original. I only know that when I cut and pasted everything inside the 'if' statement the script magically worked. The only problem is that in order to provide code for this thread I cut and pasted the whole lot back inside the 'if' statement, deleting the subroutine, tested it and the blooming script worked like a charm! Sounds of jonnyfolk beating his head against brick wall!

    It is fortunate that I asked the question (despite the copious -- votes!) because I had obviously jumped to the wrong conclusion which would not have been helpful to my 'perl progress' in the future.

    Thanks to all who pointed out the error of my ways