You mentioned in the first part of your email that your script does 1,2,3 and
then in hte second half of your email you said it doesn't do 1,2,3 so i am
going to play it safe and assume you need help retrieving the filenames as
well .. (if i am wrong then just ignore that part)
you might want to check out the perl modules File::Find or just use the glob
function (perldoc -f glob) to retrieve all the filenames ... which method you
use depends on your personal pref and the way the files are organised.  (let
me know if you dont know how to retrieve CPAN modules )

In a nutshell you can do something like globbing all the filenames into an
array like so

my @array_of_filenames = glob('*.PDF');         # assume the files are all in the same 
directory

# loop through all the filenames and change the extension
foreach my $file (@array_of_filenames) {
        my @contents;
        open(PDF,$file);
        while (<IN>) {
                chomp;
                push @contents,$_;
        }
        close PDF;
        $file =~ s/PDF$/ATT/;
        create_new_file($file,@old_contents);
}

sub create_new_file {
        my $new_filename = shift;
        my @contents = @_;
        open(ATT,">$new_filename");
        while (@contents) {
                print ATT $_,"\n";
        }
}

create_new_file is a sub to do whatever you want with your contents .... and
the newfilename and exising data is passed in ... of course you will have to
change that part to suit your logic.

On Thu, Sep 06, 2001 at 09:46:44AM -0500, [EMAIL PROTECTED] shaped the 
electrons to read:
> Like the others in this group, I too am struggling with PERL and fear I have
> bitten more than I can chew.
> 
> So I raise my problem to the collective:
> 
> I have to write a PERL script that:
> 
> 1) Collects *.PDF file names off a CD, 
> 2) Parses the filename and 
> 3) saves this information (and some additional information) as a text file
> *.ATT.
> 
> 
> My script does 1, 2, and 3.
> 
> BUT, each file on the CD needs its own matching ATT file.
> For example:
> 
> Patient 11176.PDF ---> I need to create ----> Patient 11176.ATT
> Patient 11180.PDF ---> I need to create ----> Patient 11180.ATT
> .....
> 
> I cannot figure out how to code PERL to perform steps 1, 2, and 3 for each
> PDF and save it as a matching ATT file.
> 
> There can be as many as 100 PDF files on a CD.
> 
> Any help that can be offered would be incredibly appreciated.
> 
> 
> Bill
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to