new at Perl myself but I couldn't see that anyone had answered your query "what is $_?".
$_ is one of Perl's built-in variables - it is the default variable (i.e. what's currently being input or matched) and frequently if not explicitly set it will be assumed.
These pairs are all the same: (these examples are from perlvar (http://perldoc.perl.org/perlvar.html)
$_ The default input and pattern-searching space. The following pairs are + equivalent: while (<>) {...} # equivalent only in while! while (defined($_ = <>)) {...} /^Subject:/ $_ =~ /^Subject:/ tr/a-z/A-Z/ $_ =~ tr/a-z/A-Z/ chomp chomp($_)
It's a very important variable to get your head around so do ask in the Chatterbox if you're unsure. (at least that's what I would do).
In reply to Re^3: read multiple record data and populate in a new data stucture
by stevemayes
in thread read multiple record data and populate in a new data stucture
by fseng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |