#!/usr/bin/perl use strict; use warnings; use File::MMagic; my $mm = File::MMagic->new(); my $path='nur/ein/test/'; print "Type angeben: "; my $type=; chomp($type); my @list=glob("$path*"); @list=grep{$mm->checktype_filename($_) =~ /\Q$type\E/}@list; map{ print "$_\n" }@list;