in reply to conditional string formatting
printf +(3 < length $in ? q() : ' ') . '%-3s', $in
Or, more funny (and shorter):
printf ' ' x (4 > length $in) . '%-3s', $in
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: conditional string formatting
by docdurdee (Scribe) on Jun 08, 2015 at 17:51 UTC |