Code with STDIN
examples/mock-stdin/lib/MyEcho.pm
package MyEcho; use strict; use warnings; use Exporter qw(import); our @EXPORT_OK = qw(echo); sub echo { my $name = <STDIN>; return scalar reverse $name; }
examples/mock-stdin/bin/echo.pl
use strict; use warnings; use 5.010; use MyEcho qw(echo); say echo();
perl -Ilib bin/echo.pl