Skip to content

Commit

Permalink
Create nyan-cat
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0ff committed Mar 12, 2014
1 parent f0111e9 commit e9d0a2e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions nyan-cat
@@ -0,0 +1,30 @@
#!/usr/bin/env perl
use warnings;
use strict;
use Term::ANSIColor;

if(@ARGV!=1) {
# Version 1.0
print "nyan-cat <file>\n";
exit(1);
}

my $i=0;
my $j=0;

my @rainbow = ("bright_red","yellow","bright_yellow","bright_green","bright_blue","bright_magenta");
my $fileName = $ARGV[0];

open my $file, $fileName or die "NyanCat could not open $fileName : $!";
while( my $line = <$file>) {
print colored($line,@rainbow[$i%6]);
if($j == 2) {
$j=0;
$i+=1;
}
else {
$j+=1;
}
}
print "\n";

0 comments on commit e9d0a2e

Please sign in to comment.