[EMAIL PROTECTED] wrote:
>
> I thought regexp was the fastest way to pull strings out of another
> string; certainly faster than substr(). It seems I was wrong, as the
> following code showed
>
> <SNIP>
>
> This showed that "old way" ran more than 1200% faster. That's right,
> twelve hundred per cent. Did I get my facts mixed up in thinking
> that regexp beat all, or is there something obfuscated going on?????
Yeah...I'd say you got your facts mixed up. substr() is very fast, but
also very limited. Regex is slower, but much more flexible.
>From your example:
This is slower, but it will find anything between two braces:
$data_line =~ />([^\<]+)\</;
$tag = $1;
This is faster, but only if you know EXACTLY where to find the piece
you want. One character off and it's useless.
$tag = substr( $data_line, 19, -5 );
--
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs