#!usr/bin/perl/ -w $outname="";# reset name of outfile open (OUT, ">temp.out") || die "cannot open: $!";#open a file for output - # as the names of the infiles have not been read yet, I assign this a temporary name to be renamed later # while(defined($file=glob("*.fa"))){ #loop opens one file ending in .fa after the other. stores the name in $file open (IN, "<$file") || die "cannot open: $!"; #reports error if file cannot be opened #and assigns $file to IN @filename_parts=split(/\./,$file); # writes first part of filename into $filename_parts[0] $outname .= "$filename_parts[0]".'.'; ### concatenated $filename_part[0] into new outname ### #repeats this for every cycle while (defined($line=)){print OUT $line;} #writes contents of $file line by line into filehandle OUT } #no more *.fa files in directory close OUT; #closes filehandle OUT and temp.out $outname="$outname".'fa.multiple';#adds useful extension to outfile system ("mv temp.out $outname"); # uses unix command mv (move)to rename temp.out into new $outname