My point was really that using named variables is usually more clear (to me at least) than using no variable, relying in the default of either $_ or @_ in the function.
This depends highly on the situation. You later say that your coding style is "situational," so I don't understand why you'd make a sweeping generalization like this. There are many cases where relying on $_ greatly enhances readability.
@_ is a completely different matter, because -- as blazar says -- it's not just a "default" that you can avoid using. You use it to get subroutine parameters, and that's all there is to it. (Unless you're talking about using @_ as the default target for split, but I certainly hope you're not.)
I've been coding Perl for 10 years now.
I don't know enough about you personally to comment on your experience, but the length of time knowing how to use something is only a rough indicator of skill level. Consider how many people have been driving a car for decades, and are still terrible at it. :-)
I initialize when I declare as a matter of habit, to avoid "uninitialized" warnings.
You might as well just turn off the "uninitialized" warnings, if that's the case. Usually I start out with my variables all uninitialized, but use an algorithm that should initialize them before I use them. If that initialization doesn't happen, then I get a warning, and I know my algorithm is funky. It can be very helpful.
I wasnt aware that line wasn't blazar-approved ... If you have a recommendation for the "newbies", you might want to actually write out some alternate code
It's not just blazar's opinion. The standard way to get iterator behavior in Perl is a while loop. A filehandle is best used as an iterator. This is common practice.
In reply to Re^4: Yet another array problem
by revdiablo
in thread Yet another array problem
by Angharad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |