Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^20: how to read input from a file, one section at a time?

by poj (Abbot)
on Apr 03, 2019 at 17:08 UTC ( [id://1232103]=note: print w/replies, xml ) Need Help??


in reply to Re^19: how to read input from a file, one section at a time?
in thread how to read input from a file, one section at a time?

printf "%d duplicate records written\n",$name,$para,$out_filename;

see printf and sprintf. You need to put %s in the print format for strings, %d for integers

while ( my $para = <$PROTFILE> ) { # Remove fasta header line if ( $para =~ s/^>(.*)//m ){ $name = $1; }; # Remove comment line(s) $para =~ s/^\s*#.*//mg; # Trim trailing white space $para =~ s/\s+$//; # next FASTA_RECORD if $fasta_seen{ $para }++; if ( $fasta_seen{ $para }++ ){ printf "duplicate record %s %s \nwritten to %s\n",$name,$para,$out +_filename; print $OUTFILE '>'.$name.$para."\n\n"; } }
poj

Replies are listed 'Best First'.
Re^21: how to read input from a file, one section at a time?
by davi54 (Sexton) on Apr 03, 2019 at 17:24 UTC
    Ohh.. okay.. still learning.. Thanks.. :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found