Hello I am basically trying to list all the files present in a given directory that ends with ".fasta" extension. But somehow I am not getting the whole file name....instead just getting the extension ".fasta", thus omitting the name of file before ".fasta" extension. However when I myself create a new file manually, say "a.fasta", it is being printed completely. Can anyone suggest me why the file created via perl code is not being grabbed by the glob function?? My code is
while(my $key = each %seqInfo) { my $nameWithoutFastaSign = $key; $nameWithoutFastaSign =~ tr/>//d; my $currentDir = getcwd; chdir "$currentDir/$nameWithoutFastaSign"; my $changedDir = getcwd; print "changed directory is: $changedDir\n"; while($fastaFile = glob("*.fasta")) { print "$fastaFile\n"; } chdir "$currentDir"; }
and the output shown is
changed directory is: /home/ammarah/Documents/code/1elwA .fasta changed directory is: /home/ammarah/Documents/code/1ghwA .fasta changed directory is: /home/ammarah/Documents/code/1flwA .fasta
There should be a complete file name, which is similar to folder name eg "1elwA.fasta" instead of simple ".fasta". Can anyone help me please??
In reply to Listing of files using glob by AG87
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |