Use while loop to read console input and replace : While « Statement « Perl
- Perl
- Statement
- While
Use while loop to read console input and replace
while (<>) {
for (split) {
s/m/y/g;
print;
}
}
while ($_ = <>) {
for $_ (split / /, $_) {
$_ =~ s/m/y/g;
print $_;
}
}
Related examples in the same category