in reply to Printf : How to repeat characters?
Does this do what you want?
Update: or perhaps this?my $a = chr(65); my $b = chr(66); my $c = chr(67); printf "%s" x 3, $a x 2, $b x 3, $c x 4;
or even, using james2vegas' "$" idea, but with %c instead of %sprintf "%c" x 9, (65) x 2, (66) x 3, (67) x 4;
BTW, the above strange-looking POSIX extension positional parameter $ printf syntax was introduced in Perl 5.8 in 2002.printf '%1$c'x2 . '%2$c'x3 . '%3$c'x4, 65, 66, 67;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printf : How to repeat characters?
by westrock2000 (Beadle) on Oct 03, 2010 at 04:34 UTC |