use strict; use warnings; use Win32::TieRegistry 0.20 (Delimiter=>"/"); sub get_file_association ($) { my $x= shift; my $reg= $Registry->{"HKEY_CLASSES_ROOT/$x//"} or return; # this usually refers to another entry. $reg &&= $Registry->{"HKEY_CLASSES_ROOT/$reg//"} if $x =~ /^\./; return $reg; } # print get_file_association ('.chm'); example usage (include the dot) foreach (@ARGV) { print $_, '=>', (get_file_association($_) || "NOT KNOWN"), "\n"; }