|There's more than one way to do things|
Re: Unexpected action at a distance with use warnings FATAL=>'all';by jarich (Curate)
|on Jan 23, 2006 at 02:55 UTC||Need Help??|
next and it's friends are clever little calls in Perl. Did you know you can do this evil thing?
Now just imagine that process and add_to_processed are hidden away in another module, or something like that. Your foreach loop looks like it processes each thing in the array and then adds it to the list of processed things. But it doesn't. Some things are skipped, silently, others are left behind when add_to_processed decides it's had enough.
Call one of these subroutines outside of a loop and watch as sometimes they break, and sometimes they don't! Gotta love it. (Yes, I was given some code a little like this to maintain once....)
At least eval was telling you about your mislaid next. ;)
Personally I try to keep eval statements around the smallest scope possible. So I'd be writing:
or some functional equivalent.
Your advice is good. Making warnings fatal and other such sweeping changes definately require a code review or at least careful thought.
Hope you're having fun.jarich