in reply to Script doesn't enter while loop.

while (<FILE>) { $file_data=<FILE>; }
The <> operator reads a line from a file regardless if you set it to anything, so this script will try to read in two lines every time it iterates through the loop. Since you only have a single line, you're going to run into problems here. A better way to code this is :
while( $file_data = <FILE> ) { }
or
my ( $file_data ) = <FILE>;

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
It's not what you know, but knowing how to find it if you don't know that's important

Replies are listed 'Best First'.
Re: Re: Script doesn't enter while loop.
by ChemBoy (Priest) on Aug 23, 2001 at 21:28 UTC

    Or even

    my $file_data = <FILE>;
    if you don't like useless parentheses. :-) (Note that those parentheses are far from useless under other circumstances-- you just don't need them here).

    For the problem of "not entering the while loop", note that the debugger does some strange and curious things around loops sometimes. I tested your code with the following two-line input:

    foo,bar fooey
    and got the following sequence in the debugger (note that the empty command statements are all interpreted as "n"):