dbrock has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,
I have a simple question to ask... When doing while (<FILE>) {} what is the default varible..? is it " $_ "..? I have a script I am working on to parse some ascii txt files to extract predetermined information... After opening and scanning the above mentioned text files and extracting the required information... I print the scanned txtfile into a new filename on my filesystem... When I print the lines from the FILE into the new filename, I have data (Several Lines) from previously scanned logfiles printing into each new file I create...

Thanks, in advance for any help provided..! Darrick...

update (broquaint): title change (was Stupid newby question)

Replies are listed 'Best First'.
Re: default variable for while()
by jasonk (Parson) on Mar 17, 2003 at 15:56 UTC

    Yes, it is $_.


    We're not surrounded, we're in a target-rich environment!
Re: default variable for while()
by glwtta (Hermit) on Mar 17, 2003 at 18:50 UTC
    useful newbie tip: it's often useful to do something like:  while(my $line = <FILE>){}, less of a chance of confusing yourself (I just noticed that a lot of "casual" scripters don't even realize you can do this, and treat while(<>) as some sort of a keyword)