http://qs321.pair.com?node_id=399830


in reply to Prepending 0's to 1000

You will find good use of the printf/sprintf functions.

perl -e "printf('%04d', 33)"

__OUTPUT__
0033