in reply to the $_ Special Variable

Most of the time, you use $_ without actually using it -- without typing it, that is. Take this code:

my @array; while(<$file>){ chomp; tr/A-Z//d; push @array, [split /\s+/]; }

Each of those lines of code operates on $_, though you don't see the variable explicitly typed at all. That's because many Perl functions operate on $_ by default if they aren't given a specific argument.

Some say using $_ is bad practice and makes code less maintainable. That may be true for longer loops containing many other variables, but for short loops like the above, in my opinion it's actually clearer than:

my @array; while(my $line = <$file>){ chomp $line; $line =~ tr/A-Z//d; push @array, [split /\s+/, $line]; }

Aaron B.
Available for small or large Perl jobs; see my home node.