There are several ways to do this. Here are two:
$int = 5; sprintf "%0${int}i", $myint; $int = 5; sprintf "%0*i", $int, $myint;
In reply to Re: printf & sprintf: variable number formats
by duff
in thread printf & sprintf: variable number formats
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |