[Omaha.pm] for loop quickie

Daniel Linder dan at linder.org
Mon May 22 20:47:58 PDT 2006





On Mon, May 22, 2006 16:02, Jay Hannah wrote:

> before:

>    for ($j = 0; $j < @row; $j++) {

>       $row[$j] =~ s/[^ -~]//g;

>       $row[$j] =~ s/\|/:/g;

>    }

> 

> after:

>    for (@row) {

>       s/[^ -~]//g;

>       s/\|/:/g;

>    }



Ok, Jay -- which one is faster?  I am pretty sure it's the second
one, but I'm interested in how much.



(Thought I'd ask since you're always benchmarking ...)



Dan



- - - -

"Wait for that wisest of all counselors, time." -- Pericles

"I do not fear computers, I fear the lack of them." -- Isaac
Asimov

"Soon we will be able to harness the rotational energy from Orwell's
grave to solve all world energy problems." -- /. user GigsVT
(208848)

GPG fingerprint:6FFD DB94 7B96 0FD8 EADF  2EE0 B2B0 CC47 4FDE 9B68
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20060522/1177e506/attachment.html 


More information about the Omaha-pm mailing list