Re: Scriptome and Perl One-Linersby rnahi (Curate)
|on Oct 23, 2005 at 15:01 UTC||Need Help??|
much of the code in the Scriptome would make an excellent tutorial on Perl one-liners
I would not be so quick about excellence.
Take for example, this page
I see an inefficient replacement of newline, instead of chomp. But since this is a one-liner, the "-l" option will do instead, and it will also save the output newlines.
Then, the @F=split /\t/, $_; could be easily replaced by the "-a" autosplit option, which will happily take charge of different whitespace types, other than tabs.
I would say that this one-liner woult be better written as
Or, I should even dare this:
It's shorter, thus easier to write, and less mistakes to make when copying it.