如何使用printf打印此示例輸出?Perl printf問題
******************************************************************************
** XYZ Corporation Date: March 27, 1989(Use current date)**
** 999 John Doe street **
** Ypsilanti, MI. 48197. **
** **
** Pay to the order of: ? **
** The amount of: ? dollars, and ? cents **
** **
** signed: **
** President, XYZ Corporation. **
** **
**--------------------------------------------------------------------------**
** SUMMARY **
** Social security number: ? **
** Regular pay: ? **
** Overtime pay: ? **
** Gross pay: ? **
** Federal tax: ? **
** Social sec. deduction: ? **
** City tax: ? **
** Union dues: ? **
** Net pay: ? **
** **
******************************************************************************
我想盡辦法,但我不知道如果我是正確的:
printf"
XYZ Corporation Date:
999 John Doe street
Ypsilanti, MI. 48197
Pay to the order of: |
The amount of: | dollars, and | cents
signed:
President, XYZ Corporation.
--------------------------------------------------------------------------
SUMMARY
Social security number: $ssn
Regular pay: %-.2f
Overtime pay: %-.2f
Gross pay: %-.2f
Federal tax: %-.2f
Social sec. deduction: %-.2f
City tax: %-.2f
Union dues: %-.2f
Net pay: %-.2f\n", $regPay, $overPay, $grossPay, $fedTax, $ssnDeduction, $cityTax, $unionDues, $netPay;
誰能幫助我?我確信我的任務不正確,但我只想知道解決方案。
對於一個完整的參考:http://perldoc.perl.org/perlform.html – flesk 2012-02-08 07:16:44
我聽見Perl6 ::表(HTTP://search.cpan。 org/perldoc?Perl6 :: Form)(用於Perl5的Perl6風格表單)比Perl5的內置格式要好得多。因人而異。 – ikegami 2012-02-08 08:00:16