Hi Manjula,
There are two simple ways to output the Perl API query result into a file.
* Using I/O redirection.
perl myPerlAPI.pl > my_query_results.txt
* Using filehandle in Perl. The printResults() method (as well as
printHeader() and printFooter()) takes an optional filehandle as argument. It
works like this:
use IO::File; # add this to the beginning of your script
my $fh = IO::File->new("> my_query_results.txt"); # create a new filehandle
$query_runner->printHeader($fh); # output header to the file
$query_runner->printResults($fh); # output the results to the file
$query_runner->printFooter($fh); # output the footer to the file
$fh->close; # close the file
Hope this helps,
Junjun
From: Manjula Dharmawardhana <[email protected]<mailto:[email protected]>>
Date: Wed, 27 Jul 2011 03:24:15 -0400
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Subject: [BioMart Users] Saving Results of Perl query to file
Hi All,
I will be grateful if anybody can give a example showing how I can save the
output of the Perl API query to a file. The "printResults()" only prints the
results. How can I load it in to variable for further manipulation?
Sorry If this is too basic. But I tried but could not find a way.
Thanking in advance,
Manjula
_______________________________________________
Users mailing list
[email protected]
https://lists.biomart.org/mailman/listinfo/users