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

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


Karolina,

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

open OUT, ">filename";   #can be placed anywhere before the print 
statement
# 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 
argument
open OUT,  ">$filename";		#sets OUT to name of file supplied on command 
line
print OUT, "Hit=",	$hit->name,

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

perl program_name.pl argument

-Todd



More information about the Bioperl-l mailing list