my $max_lines = 100;
. . .
while ($line--) {
. . .
# do stuff
. . .
}
####
my $playera = 100;
my $playerb = 100;
print "player A HP | player B HP\n";
while (1) {
$playera -= rand(10);
$playerb -= rand(10);
print "$playera | $playerb\n";
die (($playera < $playerb) ? "player A lost!" : "player B lost!")
if ($playera < 0 || $playerb < 0);
}
##
##
player A HP | player B HP
94.0023803710938 | 99.3478393554688
88.4292602539063 | 96.0552978515625
88.1494140625 | 94.9520874023438
86.5380859375 | 93.8046264648438
82.1652221679688 | 84.6536254882813
75.5804443359375 | 76.0702514648438
69.7055053710938 | 75.4898071289063
67.3040771484375 | 68.40087890625
63.6215209960938 | 64.7930908203125
58.9315795898438 | 60.8502197265625
50.4647827148438 | 57.1435546875
40.8901977539063 | 49.0029907226563
34.7552490234375 | 39.5355224609375
27.4127197265625 | 33.8937377929688
24.0670776367188 | 31.5869140625
19.4973754882813 | 22.3440551757813
10.3622436523438 | 14.5086669921875
9.0966796875 | 11.1148071289063
7.37579345703125 | 9.4158935546875
2.77679443359375 | 0.14801025390625
-1.7657470703125 | -7.55615234375
player B lost! at temp.pl line 11.
##
##
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+)-.*)$/;
$_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print"- $1"}&&`rm $1`;
print$\;}