print "Enter a directory´s path to work with all files in a folder or a single file path\n\n"; chomp(my $input =); if ($input =~ /./){ ### attempt of recognizing a file extention $datei = $input; open(my $fastd,'<', $datei) or die "die datei $datei wurde nicht geöffnet: $!\n"; while (my $line = <$fastd>) { #reading fasta file chomp $line; if ($line =~ /^>/) { $header = $line; $header =~ s/>//g; } else { $sequences->{$header} .= $line } } }elsif($input =~ /[^.]/){ #### attempt of recognizing just a folder but i know it wont work always $path = $input; opendir my $DIR, $path or die " the directory couldn't be opened\n"; my @folder = grep -f "$path/$_", readdir $DIR; for my $file (@folder){ open (my $fastd ,'<', "$path/$file") or die "the file $file couldn't be opened: $!\n"; while (my $line = <$fastd>) { #reading fasta file chomp $line; if ($line =~ /^>/) { $header = $line; $header =~ s/>//g; } else { $sequences->{$header} .= $line } } } }