Utiliser le module FileHandle, entourer les valeurs du hash entre deux accolades :
#!/usr/local/bin/perl use strict; use FileHandle; my %hash; $hash{'1'} = FileHandle -> new("1.file","a") or die $!; $hash{'2'} = FileHandle -> new("2.file","a") or die $!; print {$hash{'1'}} "un\n"; print {$hash{'2'}} "deux\n"; while(my($key,$value) = each(%hash)) { $value -> close() or warn $!; }