Thread Formatierte Ausgabe / Platzhalter ... aber wie ?
(23 answers)
Opened by cherished at 2008-06-26 11:29
Hi,
man könnte auch sowas machen: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #!/usr/local/bin/perl -w my $a = "Hugo"; my $a1 = "Hugo bla"; my $b = "Hugo Ernst"; my $b1 = "Hugo"; print _stringFormat($a, 30, " "); print _stringFormat($a1, 30, " "), "\n"; print _stringFormat($b, 30, " "); print _stringFormat($b1, 30, " "), "\n"; print "fertig :-)"; sub _stringFormat { # variable, länge, zeichen return $_[0] . $_[2] x ($_[1] - length($_[0])); } Mega |