Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Extract multiple lists of Identifiers from a FASTA file

by hippo (Bishop)
on Aug 04, 2022 at 12:26 UTC ( [id://11145945]=note: print w/replies, xml ) Need Help??


in reply to Re: Extract multiple lists od Identifiers from a FASTA file
in thread Extract multiple lists od Identifiers from a FASTA file

you’re missing parens on open when you create your output file so it’s not parsing the way you intend

This isn't wrong but equally the parens are not needed if or is used for control flow instead of ||. All three of these work (my preference in the comments)

open( my $out_fh, q{>}, $outfile ) || die qq{problem writing to '$outf +ile': $!}; # OK open( my $out_fh, q{>}, $outfile ) or die qq{problem writing to '$outf +ile': $!}; # Better open my $out_fh, q{>}, $outfile or die qq{problem writing to '$outfile +': $!}; # Best

The last of these is an idiom I use all the time (albeit with actual quotation marks rather than q/qq). I find that absence of unnecessary punctuation makes for clearer reading but recognise that not everyone sees it the same way. There is also autodie if you don't want or need to write your own error messages.

All the rest of Fletch's advice is spot on. I'd also point you (joluito) to the Basic debugging checklist for help in finding out where things are going wrong.


🦛

Replies are listed 'Best First'.
Re^3: Extract multiple lists of Identifiers from a FASTA file
by BillKSmith (Monsignor) on Aug 04, 2022 at 12:58 UTC
    I agree with hippo's choice, but... To paraphrase the introduction to the book "Perl Best Practices": The style is not very important. What is important is that you chose one that works for you and always use it.
    Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-24 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found