Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Print Output to New File (UPDATED)

by thanos1983 (Parson)
on Nov 03, 2017 at 15:50 UTC ( [id://1202705]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Print Output to New File (UPDATED)
in thread Print Output to New File

Hello 1nickt,

I was experimenting with Data::Printer as an alternative way.

You can use it for example like:

use Data::Printer; p %hash;

This why you could see the printing part. Hope is more clear now. :)

Update: Sample of code that I was experimenting, see below:

#!/usr/bin/perl use strict; use warnings; use Data::Printer; my %hash = ( ';LCBO - Prolactin precursor - Bovine' => "a sample seque +nce in FASTA format MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPNGPGNCQVSLRDLFDRAVMVSHYIHD +LSS EMFNEFDKRYAQGKGFITMALNSCHTSSLPTPEDKEQAQQTHHEVLMSLILGLLRSWNDPL +YHL VTEVRGMKGAPDAILSRAIEIEEENKRLLEGMEMIFGQVIPGAKETEPYPVWSGLPSLQTK +DED ARYSAFYNLLHCLRRDSSKIDTYLKLLNCRIIYNNNC*" ); my $filename = 'output.txt'; open(my $fh, '>', $filename) or die "Could not open file '$filename' $!"; p(%hash, output => $fh); close $fh or warn "Could not open file '$filename' $!"; print "Done\n"; __END__ $ perl test.pl Done $ cat output.txt { ';LCBO - Prolactin precursor - Bovine' "a sample sequence in FAS +TA format MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPNGPGNCQVSLRDLFDRAVMVSHYIHD +LSS EMFNEFDKRYAQGKGFITMALNSCHTSSLPTPEDKEQAQQTHHEVLMSLILGLLRSWNDPL +YHL VTEVRGMKGAPDAILSRAIEIEEENKRLLEGMEMIFGQVIPGAKETEPYPVWSGLPSLQTK +DED ARYSAFYNLLHCLRRDSSKIDTYLKLLNCRIIYNNNC*" }

BR / Thanos

Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1202705]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found