打印金字塔

There's more than one way to do it!
https://metacpan.org http://perlmonks.org
回复
头像
523066680
Administrator
Administrator
帖子: 573
注册时间: 2016年07月19日 12:14
联系:

打印金字塔

帖子 523066680 »

:perl -e "grep {print ' 'x(10-$_),'*'x($_*2+1),chr(10) } (0..10) " * *** ***** ******* ********* *********** ************* *************** ***************** ******************* ********************* :perl -e "$s='*'; for (0..10) {print ' 'x(10-$_),$s,chr(10); $s.='**'}" * *** ***** ******* ********* *********** ************* *************** ***************** ******************* *********************
or 字符串替换
my $s="          *          \n";
do { print $s } while ( $s=~s/ (\*+) /*$1*/ );
回复

在线用户

正浏览此版面之用户: 没有注册用户 和 0 访客