4 ms·
This is worth a bit of explanation, see this link and the code duplicated below: https://perlmaven.com/the-default-variable-of-perl https://perlmaven.com/the-d
by ramses0 8y ago
This is worth a bit of explanation, see this link and the code duplicated below:
https://perlmaven.com/the-default-variable-of-perl https://perlmaven.com/the-default-variable-of-perl
I agree with most everything the author says, along with the idea that you shouldn't use it that often.
----------
use strict;
use warnings;
use v5.10;
while ($_ = <STDIN>) {
chomp $_;
if ($_ =~ /MATCH/) {
say $_;
}
}
----------
use strict;
use warnings;
use v5.10;
while (<STDIN>) {
chomp;
if (/MATCH/) {
say;
}
}
- deleted 8y ago[deleted]