Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Unexplained benchmark when using chop vs. chomp (or neither)by Eily (Monsignor) |
on Mar 08, 2018 at 09:56 UTC ( [id://1210505]=note: print w/replies, xml ) | Need Help?? |
chop will remove a character from the string each time, unless there is none. Since for aliases the variable to the list elements, the strings in @data get chopped until they are empty. As a matter of fact, since the lines are pretty short, the strings are empty before the 20th call to the function, and even without chopping, the function gets called more than 150 times Edit: reformulated and shortened my confusing post :)
In Section
Seekers of Perl Wisdom
|
|