John Lin wrote:

> Hi List,
>
> This is probably a really simple question, but I need some help with this.
> Basically,  I am searching through a directory and if something matches
> what I am looking for, then save that filename to a text file.  Something
> like this:
> ===================================

use strict;
use warnings;

>
> $wanted_filename='thisfilename';
>
> opendir (DIRECTORY, "/directory/");
>         @filenames=readdir(DIRECTORY);
> closedir(DIRECTORY);
>
> for ($i=0; $i <= $#filenames; $i++) {
>         [EMAIL PROTECTED];
>         if ($wanted_filename == $filename) {

doesn't work.  That is a numerical test.  I don't know how the file is being
written at all, because this should always return false. Have you tried removing
the file, to see if it really gets written when you run the script?

If you had warnings turned on, it would also have warned you about this.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to