Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Trying to do multiple while loops on the same input file

by elef (Friar)
on Jun 01, 2011 at 13:31 UTC ( [id://907627]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open (INPUTFILE, "<:encoding(UTF-8)", "in.txt") or die "Can't open fil
    +e: $!";
    for (my $i = 1; $i < 5; $i++) {
    ...
        }
    }
    close INPUTFILE;
    
  2. or download this
    for (my $i = 1; $i < 5; $i++) {
        open (INPUTFILE, "<:encoding(UTF-8)", "in.txt") or die "Can't open
    + file: $!";
    ...
        }
        close INPUTFILE;
    }
    
  3. or download this
    print "First loop:\n\n";
    while (<DATA>) {
    ...
    first line
    second line
    third line
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://907627]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-23 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found