particle, I overlooked your solution on purpose ;-). That has absolutely nothing to do with the quality - all of them work fine on single START/END tags.
I just was not sure how quick index in comparison to the regex solutions works. The other two are both regex and thus easy to compare. I thought index should be quicker than a regex on a fixed string:
but the benchmark suggested otherwise. The difference might be because of the function overhead and the surrounding code in your solution. But I was too lazy to test this with some proper benchmarks ...$i = index $stuff, 'START'; # compared to $stuff =~ /START/;
-- Hofmator
In reply to Re3: Efficiently Extracting a Range of Lines (was: Range This)
by Hofmator
in thread Efficiently Extracting a Range of Lines (was: Range This)
by skazat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |