Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Open Multiple Files

Status
Not open for further replies.

campbere

Technical User
Oct 10, 2000
146
US
Ok I am a rookie to be Perl so take it easy on me. :)

I want to open multiple files that are located in a directory, extract information from them and do some checking with the numbers in the files. I am stuck and have not found good examples to help me out. This is what I have to this point.

while ($FILE =~ (<*.rpt>)) {
#Get the stas and set to variables
$tot_items =~ m/items=&quot;(\d+)/;
print $string;
$insert =~ m/inserts=&quot;(\d+)/;
print $insert;
$update =~ m/updates=&quot;(\d+)/;
print $update;
$delete =~ m/deletes=&quot;(\d+)/;
print $delete;
$failure =~ m/failures=&quot;(\d+)/;
print $failure;
}

I appreciate the help. Also if you know of any good perl resources particulary sites that offer plenty of examples and tutorials pless pass that on.

Thanks,

PerlRookie
 
You could use:

Code:
$dir = &quot;./path&quot;
opendir DIR, $dir or die;
    while ( $file = readdir <DIR> ) {
       #fun stuff here
    }
closedir DIR;

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top