[Bioperl-l] Re: how to save blast parser output

Todd Naumann tan10 at psu.edu
Fri Sep 10 12:17:27 EDT 2004


To redirect the output from the screen into a file can be done by 

open OUT, ">filename";   #can be placed anywhere before the print 
# then simply add
print OUT "Hit = ",	$hit->name,	# adding OUT after print directs 
everything to file filename.

Using this method you would need to manually add the desired filename 
to the program before each run. If you want to use the program often 
and write lots of separate files it is easier to:

my $filename = shift @ARGV;	#this sets $filename to first command line 
open OUT,  ">$filename";		#sets OUT to name of file supplied on command 
print OUT, "Hit=",	$hit->name,

Then you can just supply the desired filename as a command line 

perl program_name.pl argument


More information about the Bioperl-l mailing list