- 论坛徽章:
- 0
|
$file = $ARGV[0] or die;
@rot = ();
($x, $y) = (0, 0);
open ROT, "<$file";
while($c = getc(ROT)){
if($c ne "\n"){
$tmp = scalar(@{"tmp$y"})-$x;
if($tmp>0){ while($tmp){unshift(@{"tmp$y"}, ' '); $tmp--;} }
unshift(@{"tmp$y"}, $c);
push(@rot, \@{"tmp$y"}) if (scalar(@rot) <= $y);
$y++;
}else{ while($y <= scalar(@rot) ){ unshift(@{"tmp$y"}, ' '); $y++; } $x++; $y = 0; }
}
while($y <= scalar(@rot) ){ unshift(@{"tmp$y"}, ' '); $y++; }
while($line = shift(@rot)){ while($c = shift(@$line)){print $c;} print "\n"; }
#用perl随便写了一个,发现长好多,偶功力太差了
[ 本帖最后由 isaachs 于 2007-2-1 09:20 编辑 ] |
|