Leser: 1
6 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12
sub print_formatted{ my ($max,$t1,$t2,$t3,$t4,$t5,$t6) = @_; # berechne den linken Rand $lRand my ($lRand) = int( ($max - length $t4) / 2 ); # berechne den rechten Rand $rRand my $rRand = $max - $lRand - length $t4; my $format = "%6d %-12s %-12s %*s%s%*s %-12s %10d\n"; print sprintf $format, $t1,$t2,$t3,$lRand,' ',$t4,$rRand,' ',$t5,$t6; }
1 2 3 4
for (my $i=1; $i<=$anzahl;$i++) { $lRand$i = int( ($may - length$t$i) / 2); } ...
%hash = ( Rand1 => 23, Rand2 => 15, t1 => 'test', t2 => 'Welt' );
1 2 3
for ( 1..$anzahl ){ $hash{ "Rand".$_ } = int( ( $may - length $hash{ "t".$_} ) / 2); }
Duff+2007-10-11 08:52:10--Code (perl): (dl )1 2 3 4for (my $i=1; $i<=$anzahl;$i++) { $lRand$i = int( ($may - length$t$i) / 2); } ...
1 2 3 4 5 6 7 8 9 10 11 12
sub print_formatted{ my ($max, @t) = @_; my @lRand; my @rRand; foreach(0..@t) { # berechne den linken Rand $lRand push @lRand, int( ($max - length $_) / 2 ); # berechne den rechten Rand $rRand push @rRand, $max - $lRand - length $_; } ..... }
6 Einträge, 1 Seite |