- 论坛徽章:
- 0
|
- #!/usr/bin/perl
- use Acme::Pythonic;
- sub zprint:
- my ( $LISTA, $LISTB, $SEC ) = @_;
- my ( $lena, $lenb ) = ( 0, 0 )
- my ( $backa, $backb, $forea, $foreb ) = (0) x 4
- my ( $FIRST, $SECOND ) = map "\033[1" . $_, qw[A B]
- my ( $BACK, $FORE, $NEWLINE, $NONE ) = ( "\b", ' ', "\n", '' )
- $SEC ||= 0.123
- $| = 1
- my $END = $#$LISTA > $#$LISTB ? $#$LISTA : $#$LISTB
- my $waiting = sub:
- select undef, undef, undef, $SEC
- print $NEWLINE
- for 0 .. $END:
- my $a = $LISTA->[$_] // $NONE
- my $b = $LISTB->[$_] // $NONE
-
- $lena += length $a
- $forea = $lena < $lenb ? $lenb - $lena : 0
- $backb = $lena < $lenb ? 0 : $lena - $lenb
- print $FIRST, $BACK x $backa, $a, $FORE x $forea
-
- $lenb += length $b
- $foreb = $lenb < $lena ? $lena - $lenb + 1 : 1
- $backa = $lenb < $lena ? 0 : $lenb - $lena
-
- print $SECOND, $BACK x $backb , $b, $FORE x $foreb
- &$waiting
-
- print $NEWLINE
-
- my @a = 'A' .. 'Z'
- my @b = 0 .. 32
- zprint \@a, \@b, 0.02
- zprint \@a, \@b;
- @a = qw/A AA AAA AAAA AAAAA AAAA AAA AA A AA AAA AAAA/
- @b = qw/B B BB BB BBB BBB BB BB B B BB BB/
- zprint \@a, \@b
- @a = 'a' .. 'i'
- @b = 1 .. 9
- zprint \@a, \@b, 0.5
复制代码 |
|