Permalink
Browse files

Update octocatsay to use STDIN, too

  • Loading branch information...
1 parent 324cb5a commit dd80aab00aab30d4a4993a577252165b2ae1faab @pengwynn committed Nov 14, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 bin/octocatsay
View
@@ -4,22 +4,28 @@
# octocatsay
# Coby Chapple - https://github.com/cobyism/octocatsay
+my $text = @ARGV[0];
+unless ($text) {
+ $text = <STDIN>;
+ chomp $text;
+}
+
print "
MMM. .MMM
MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMM _";
-for ($i = 0; $i < length(@ARGV[0]); $i++) {
+for ($i = 0; $i < length($text); $i++) {
print "_";
}
print "_
MMMMMMMMMMMMMMMMMMMMM | ";
-for ($i = 0; $i < length(@ARGV[0]); $i++) {
+for ($i = 0; $i < length($text); $i++) {
print " ";
}
print " |
- MMMMMMMMMMMMMMMMMMMMMMM | @ARGV[0] |
+ MMMMMMMMMMMMMMMMMMMMMMM | $text |
MMMMMMMMMMMMMMMMMMMMMMMM |_ ";
-for ($i = 0; $i < length(@ARGV[0]) - 2; $i++) {
+for ($i = 0; $i < length($text) - 2; $i++) {
print "_";
}
print "|

0 comments on commit dd80aab

Please sign in to comment.