Created
March 10, 2009 07:49
-
-
Save tyru/76804 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| use utf8; | |
| use Perl6::Say; | |
| use String::CamelCase qw(camelize); | |
| say "--- cat ---"; | |
| filter_print(\*STDIN, \*STDOUT, sub { shift }); | |
| # stdin, stdout, stderr are allowed! | |
| say "--- cat ---"; | |
| filter_print(\*stdin, \*stdout, sub { shift }); | |
| say "--- cat >&2 ---"; | |
| filter_print(\*stdin, \*stderr, sub { shift }); | |
| # I like these words though. | |
| say "--- simple camelized ---"; | |
| filter_print(\*STDIN, \*STDOUT, sub { ucfirst lc shift }); | |
| say "--- camelized by String::CamelCase ---"; | |
| filter_print(\*STDIN, \*STDOUT, sub { camelize shift }); | |
| sub filter_print { | |
| my ($in, $out, $sub) = @_; | |
| $out->print($sub->($_)) while (<$in>); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment