Don't ask to ask, just ask | |
PerlMonks |
Rex4: pluralizationby Vynce (Friar) |
on Sep 09, 2005 at 03:11 UTC ( [id://490417]=note: print w/replies, xml ) | Need Help?? |
well, the abs() call is only there for the case of -1 -- you can take it out to compare against your case, or put some other check in to your case such that -1 == $count behaves the same as 1 == $count. otherwise you're comparing apples & oranges. also, my snippet used two interpolations where yours reduced it to one ($noun versus the constant iteration) which doesn't make a huge difference, but again, them citrus fruits... time for me to run home. if you haven't rebenched, I'll set one up that's as parallel as possible except for x vs. ?: ps: I don't know how the x operator is implemented, which is why i said "theoretically" faster -- as far as i can tell, there is no need for it to include a branch. UP-dilly-DATE : OK, i didn't do it last night, but I did it. I made this small change:
and got ... actually, quite similar results:
Which is interesting, to me.
In Section
Cool Uses for Perl
|
|