Thanks for your help.
I rewrote it using a mix of your suggestions and it works fine now.

FYI:  The 'chomp' statement was eliminating the '/n' so the pattern match
was not occuring.  That's fixed now too.

Tom.
"Thomas 'Gakk' Summers" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Warning: Perl Novice Alert!
>
> I'm trying to:
> 1. read in a list of files,
> 2. test for text,
> 3. convert the text files from '\n' unix to '\r\n' dos
> 4. write them to a temporary location.
>
> The code below produces an error: 'Use of uninitialized value in -f at...'
> in line 2.
>
> I must misunderstand the use of the file test, but I'm not getting any
help
> from "Programming Perl" or the man pages.
> Please help?
>
> p.s.  My method of converting is flawed as well, but I haven't tried to
fix
> it yet.  Please feel free to comment on how better to do that.
> p.p.s. I suspect that numerous other bugs are here, but I haven't been
able
> to test the 'for loop' either.
>
> *******************************8
>   for (my $i=0; $i<=scalar(@files);$i++){
>     if (-f $files[$i] && -T $files[$i]) {
>       open (iFH, "<$files[$i]") or die ("$progname: Can't open infile ->
> $files[
> $i]\n");        # input file
>       open (oFH, ">$tmpfile$i") or die ("$progname: Can't open tmpfile ->
> $tmpfi
> le$i\n");
>       while (defined(my $txtline = <iFH>)){
>         chomp($txtline);
>         $txtline =~ s/\n/\r\n/g;
>         print oFH $txtline;
>       }
>       close oFH;
>       close iFH;
>       $files[$i] = "$tmpfile$i";
>     }
>   }
>
>
>



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

Reply via email to