...and the reason the author is replacing "%" with "%%" is probably because $box will be passed as the format string for printf or sprintf. "%" has a special meaning in these strings, and he wants any/all "%" treated as percent signs. The proper way of escaping a percent sign for the format string of the aformentioned functions is by doubling it.