sub init_source_list { chdir $source_dir or die "Cannot change dir to $source_dir! ($!)"; while (defined($sourcefile = <*>)) { # for every file in this # directory if (-d $sourcefile) { # if the file is actually a directory... chdir "$sourcefile"; while (defined($ver = <*>)) { $ver =~ s/.*\///; #remove everything before the "/". $apps{$sourcefile}{$ver} = undef; # add an empty key to # %apps{$sourcefile} } chdir "$source_dir"; } else { $apps{$sourcefile} = undef; # add an empty key in the hash # %apps } } }