perl 实现cal功能
#!/usr/bin/perl -w use strict; use Date::Calc; use Calendar::Calendar qw(calendar); use Term::ANSIColor::Print; my ($year, $month, $day) = split(/\//, shift); my $cal = calendar($month, $year); my $string = Term::ANSIColor::Print->new(output => 'return', eol => '', ); my $new_day = $string->on_red($day); my @array = split(/\n/, $cal); my $head = shift @array; print " $head"; map{ if( /\D($day)\D/) { $_ =~ s/$1/$new_day/; } print "$_\n" }@array; #if( $cal =~ /\D($day)\D/ ) #{ # $cal =~ s/$1/$new_day/; #} # #print $cal."\n\n"; exit 0;