Use my:
my ($w, $str, $line); $w = 3; $str = "abc"; $line = sprintf ("%${w}s ", $str); [download]
In reply to Re: use of strict by shmem in thread use of strict by geofflh