Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to Put a Loop in my 1st Program

by c-era (Curate)
on Nov 21, 2001 at 19:28 UTC ( [id://126777]=note: print w/replies, xml ) Need Help??


in reply to How to Put a Loop in my 1st Program

You want to use a while loop,
#!/usr/local/bin/perl open (TEXT,"general.txt") || die "Could not open file: $! \n"; $addthis=join("", <TEXT>); close (TEXT); open (FILES,"files.txt") || die "Could not open file: $! \n"; # Start to loop here??? or after the next group of statements? while ($line=<FILES>){ chomp $line; open (DATA,"$line") || die "Could not open file: $! \n"; $tothis=join("", <DATA>); close (DATA); $newrecord=$addthis.$tothis; open (DATA,">$line") || die "Could not write to: $! \n"; print "$line\n"; print DATA $newrecord; close (DATA); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found