programming-examples/perl/Statement/Use while loop to read console input and replace.pl

13 lines
171 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
while (<>) {
for (split) {
s/m/y/g;
print;
}
}
while ($_ = <>) {
for $_ (split / /, $_) {
$_ =~ s/m/y/g;
print $_;
}
}