Search and replace on command line
You can use -p option (see perl --help):


  assume loop like -n but print line also, like sed


So the script becomes:

echo hi | perl -pe 's/i/o/g'


which is really compiled to:

$ perl -MO=Deparse -pe 's/i/o/g'
LINE: while (defined($_ = &lt;ARGV&gt;)) {
    s/i/o/g;
}
continue {
    die "-p destination: $!\n" unless print $_;
}
-e syntax OK