[Chicago-talk] Removing "." from a string?

Eric Ellington e.ellington at gmail.com
Thu Jan 31 15:24:32 PST 2008


>    subst:  0 wallclock secs ( 0.91 usr +  0.00 sys =  0.91 CPU) @
>10989010.99/s (n=10000000)
>
>       tr:  1 wallclock secs ( 1.51 usr +  0.00 sys =  1.51 CPU) @
>6622516.56/s (n=10000000)
>
>   'subst' => "\$dotted_quad    =~ s/\D//g;",
>

I am confused. Didn't Andy Bach show that s/// was the quickest in this case?
In what case would tr be quicker?

Eric

On Jan 31, 2008 5:09 PM, Randal L. Schwartz <merlyn at stonehenge.com> wrote:
> >>>>> "John" == John Kristoff <jtk at depaul.edu> writes:
>
> John> Other than saving one keystroke, is there anything specifically more
> John> correct or better to using tr/// there than using perl's re?
>
> Speed.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>



-- 
Eric Ellington
e.ellington at gmail.com


More information about the Chicago-talk mailing list