I\'m trying to format my output to look like it\'s in columns. I\'m trying to use the printf function.
Here\'s what I have:
printf(\"%s %10s %12s %10s\\n
You need to use the same numbers in the two formats:
printf("%3s %10s %15s %13s\n", "Qty", "Desc.", "Unit \$", "Total");
and
printf("%3d %10s %12.2f %10.2f\n", @quantity[$he], @selections[$he], @prices[$he], @prices[$he]*@quantity[$he])
Note that 12.2 means (12 digits + 1 point + 2 digits), which is why I wrote 15 in the first format. The same goes for the 13.
Also note that you're accessing array elements incorrectly.
Instead of @quantity[$he]
use $quantity[$he]
. That is, replace the @
with a $
.