[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] for loop quickie




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