# i renamed %test to %songs for sanity's sake for my $song_title (keys %songs) { my $song_file = $songs{$song_title}; if (grep $_ eq $song_file, @{$q->param('files')) { delete $song{$song_title}; unlink $song_file; } }