本帖最后由 523066680 于 2015-11-5 09:09 编辑
- use utf8;
- binmode(STDOUT, ":encoding(gbk)");
-
- my $a="aA1一bB2二cC3三dD4四eE5五fF6六gG7七hH8八iI9九";
- my @arr;
- my $i = 0;
- grep { $arr[($i++)%4].=$_ } split("", $a);
- printf join("\n", @arr);
复制代码 abcdefghi
ABCDEFGHI
123456789
一二三四五六七八九- my $s="aA1一bB2二cC3三dD4四eE5五fF6六gG7七hH8八iI9九";
- print ($s =~ /\d/g, "\n");
- print ($s =~ /[a-z]/g, "\n");
- print ($s =~ /[A-Z]/g, "\n");
- print ($s =~ /\p{han}/g,"\n");
复制代码
|