in reply to Weird ? behavior of printf / sprintf
My interpretation is that printf makes variable substitution before format the output. This means that in:
printf"$a[%d]\n", 4
$a[%d] is interpreted before %d, then warns. The same happens in the second example
In the last one:
perl -wle 'my @a=1..9; printf"\$a[%d]\n", 4'
Because the $ is scaped, there is no variable substitution and the format process behaves normally
citromatik
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Weird ? behavior of printf / sprintf
by blazar (Canon) on Jul 13, 2007 at 09:51 UTC |