#In the following example, every statement uses $_ implicitly.
while (<>) {
for (split) {
s/m/y/g;
print;
}
}
#It breaks the line you type into words, loops over those words, converts all m's to y's, and prints the result like this.
#So how does this code look if you put the $_ default variable back in explicitly?
while ($_ = <>) {
for $_ (split / /, $_) {
$_ =~ s/m/y/g;
print $_;
}
}
|