From:                   "Terry Poperszky" <[EMAIL PROTECTED]>
> I am working on a bit of logic to be used in a script that copies new
> files to a temporary directory and I am stumped.  Basically what I
> want to accomplish is to be able to look for the existence of a file
> name in a log file, and I am trying to use a hash to accomplish this.
> 
> $directory is the listing of the current files in the directory
> 
> $dir_log currently is file containing the same information as
> $directory. 
> 
> I am trying to see if the elements of $directory exist as keys in the
> hash, but it isn't working.
> 
> open MYFILE, "<dir_log";
> 
> 
> 
> while (<MYFILE>) {
> 
>             $dir_log{chomp($_)} = 1;

chomp() doesn't return what you seem to think. You have to change the 
line above to 
        chomp(); $dir_log{$_} = 1;
 
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
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