in reply to Printing all lines of a file using a perl one liner

I am trying to write a perl one liner that...

You start with a problem statement who's solution is meaningless in the real world. Perl Golf is an interesting game, but I'm not sure that you really understand that you are playing golf? If this is not a golf competition, then why on earth would you write such code?

I do not see how this code makes any sense:

chomp; @a=split(/\t/); $a[0]=~s/\s+//g; $a[1]=~s/\s+//g; $a[2]=~s/\s+//g; $a[3]=~s/\s+//g;
This code has nothing to do with the FASTA spec.

I highly recommend using the BIO Perl modules. The FastA format is simple and I wrote one parser at Re: Bio perl package - I think I've written more. But even so, I don't recommend my code as the end-all and be-all.

Replies are listed 'Best First'.
Re^2: Printing all lines of a file using a perl one liner
by la (Novice) on Sep 29, 2011 at 17:03 UTC

    As it turns out, it was something really simple.... My script wasn't working because I didn't have the input file saved as the correct format. I created my txt file in excel (office for Macs 2011) and saved it as a tab delimited text file. This input did not make my script work. When I re-saved it as a Windows Formatted Text file, the script works great and my txt file is converted to fasta format no problem.

    Thank you so much for your input everyone. It is appreciated.