Just in the simplest and most general of terms, what it sounds like you want to do is an opendir on the folder, then use readdir to get each of the file names. Store each filename in a variable, and use it in the open command to open the file.
You might want to put the code that actually extracts the lines you want into a separate subroutine, and just call that subroutine for each file you open (or for each filename if you open the file in the subroutine). After you process your file, then use the close to close the file so you can move on to the next one and process it. It sounded from your description like you were looking for what opendir does. To get an explanation, do this: perldoc -f opendir See if that gets you started. Ask back if you need more specifics. Steve Howard -----Original Message----- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Bryan Keller Sent: Tuesday, March 03, 2009 9:45 AM To: perl-win32-users@listserv.ActiveState.com Subject: New to Perl and stuck Hi all, The following gets me the lines I need for any single txt file. #!usr/bin/perl use warnings; use strict; my @output = <>; print "$ARGV"; print ("\nESTIMATION\n"); print @output[18,21..24,28..31,206..208]; print "\nPOPULATION\n"; print @output[220,223..226,229..233,424..426]; These txt files are in groups of 25 (in folders). My goal is to automate this so that after specifying a folder, Perl will pull the specified lines from each of the 25 txt files in that folder and write them to a single output file. I would greatly appreciate any help or suggestions! Bryan ------------- Bryan Keller, Doctoral Student/Project Assistant Educational Psychology - Quantitative Methods The University of Wisconsin - Madison _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs