in reply to Which one is best for optimization
In Perl, "break" is called last. But it doesn't seem like you'd want to break out of your foreach loop.