in reply to Re^2: Appending to a file.
in thread Appending to a file.

There's a global variable (though in recent versions of Perl it can be made more local on request) in Perl called $_. Many Perl functions, operators and looping constructs operate on $_ if you don't give them another variable to operate on instead.

For example, rather than:

foreach my $item (@array) { print($item); }

You can take advantage of the fact that the default name used by foreach is $_, and the default thing printed by print is $_, and instead write:

for (@array) # note "for" and "foreach" are synonyms { print; }

Or just:

print for @array;

Applying the same logic to your loop, the for is assigning each item in @array to $_; and if /$email/ is shorthand for if $_ =~ /email/; etc.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'