in reply to Re^2: convert rows to columns
in thread convert rows to columns
No, I did mean =, for assignment.
On each iteration of the while loop, the default variable $_ is implicitly assigned the next line read from the DATA handle. This $_ variable becomes the implicit argument to chomp, and then it’s implicitly bound to the regex match.
So, the code I gave is equivalent to this:
while ($_ = <DATA>) { chomp $_; my @pairs = $_ =~ /(..)/g; ...
but more compact and “Perlish”. See perlvar#General-Variables.
Hope that helps,
Athanasius <°(((>< contra mundum
|
---|
In Section
Seekers of Perl Wisdom