Copy stdin to stdout: Difference between revisions

Content added Content deleted
(→‎{{Header|Perl}}: this is a shell invocation of perl)
(→‎{{header|Perl 6}}: Add a Perl 6 example)
Line 7: Line 7:
perl -pe ''
perl -pe ''
</lang>
</lang>

=={{header|Perl 6}}==
When invoked at a command line: Slightly less magical than Perl / Sed. The p flag means automatically print each line of output to STDOUT. The e flag means execute what follows inside quotes. ".lines" reads lines from the assigned pipe (file handle), STDIN by default.

<lang perl6>perl6 -pe'.lines'</lang>

When invoked from a file: Lines are auto-chomped, so need to re-add newlines (hence .say rather than .print)
<lang perl6>.say for lines</lang>


=={{Header|sed}}==
=={{Header|sed}}==