I've been reading over the perl doc, but I can't quite get my head around hashes. I'm trying to find if a hash key exists, and if so, compare its value. The thing that is confusing me is that my searches say that you find if a key exists by if (exists $files{$key}), but that $files{$key} also gives the value? the code I'm working on is:
foreach my $item(@new_contents) {
    next if !-f "$directory/$item";
    my $date_modified = (stat("$directory/$item"))[9];
    if (exists $files{$item}) {
        if ($files{$item} != $date_modified {
            $files{$item} = $date_modified;
            print "$item has been modified\n";
        }
    } else {
        $files{$item} = $date_modified;
        print "$item has been added\n";
    }
}