Consider that's speed you're after: the answer is: use a different language than Perl.
I agree with many of your more controversial assertions; but that one is a gross over simplification.
For many things, especially text manipulations, well thought through Perl programs will run a highly tuned C program a very close second. And if you factor in the development time, maintainability and portability, they'll usually win hands down.
But the trick to good performance--as you well know and frequently demonstrate--is to write the Perl program in that way that best plays to its strengths. In general, that means avoiding the O'Woe trap and writing the simplest code that gets the job done.
Just because someone is prepared to spend an extra hour or two to get the best performance available from their perl script, it does not mean it warrents spending a week or two trying to write and tune the equivalent C(Java/Other) program.
In this case, as GrandFather points out, making two passes of each line rather than one, will likely make very little difference. Assuming that is the total extent of the processing required between reading and writing each record. But that is not always the case, and becoming familiar with which Perl techniques are more efficient than others is as good a function of this place as any other.
Asking certainly should not be cause for your derision, just because you know that in this case the suggested alternatives are unlikely to be of benefit. Much less because you are sufficiently experienced to consider writing things in other languages when you consider that would be advantageous to your needs. Many who come here do not readily have that option. And others would prefer to avoid it where possible,
In reply to Re^2: timtowtdi but which is the [quote fingers]best[/quote fingers]
by BrowserUk
in thread timtowtdi but which is the [quote fingers]best[/quote fingers]
by PyrexKidd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |