⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch19.htm

📁 《Perl 5 Unreleased》
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<BR>

&nbsp;&nbsp;7 PHILIPPINES&nbsp;&nbsp;&nbsp;&nbsp; Peso&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

24.80&nbsp;&nbsp;&nbsp;&nbsp;1000.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40.32

<BR>

&nbsp;&nbsp;8 PAKISTAN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rupee&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;38.00&nbsp;&nbsp;&nbsp;&nbsp;1200.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;31.58

<BR>

&nbsp;&nbsp;9 BAHRAIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dinar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

0.38&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;45.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

118.42<BR>

&nbsp;10 IRAQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dinar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

0.60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16.67

<BR>

&nbsp;11 JORDAN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dinar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

0.70&nbsp;&nbsp;&nbsp;&nbsp; 100.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

142.86<BR>

&nbsp;12 SAUDIARABIA&nbsp;&nbsp;&nbsp;&nbsp; Riyal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

3.75&nbsp;&nbsp;&nbsp;&nbsp;1000.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

266.67<BR>

</FONT></TT>

</BLOCKQUOTE>

<P>

Notice how the value of the investment is calculated in the format

specification itself. Look at line 15 in Listing 19.6 to see how

the output fields are set up for use with the format specifiers.

Note also that in line 14 the dollar sign is printed verbatim

in the output. You can print anything you want as long as it's

not misinterpreted as a specifier.

<P>

You can even call subroutines that return values in place of variables

in the format specification. Listing 19.7 defines a function that

tells you if your funds are running too high. The function returns

a message indicating that your investment in a foreign currency

is too low or too high based on a certain criteria. The value

returned from the function is a string and therefore will be printed

as left-justified output using <TT><FONT FACE="Courier">@&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</FONT></TT>.

<HR>

<BLOCKQUOTE>

<B>Listing 19.7. Using subroutines in formats.<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<TT><FONT FACE="Courier">&nbsp;1 #!/usr/bin/perl<BR>

&nbsp;2 while(&lt;&gt;) {<BR>

&nbsp;3&nbsp;&nbsp;($country, $code, $currency, $value, $amount)

= split(',');<BR>

&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp; write;<BR>

&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp; }<BR>

&nbsp;6 format STDOUT_TOP =<BR>

&nbsp;7 Id&nbsp;&nbsp;Country&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Currency&nbsp;&nbsp;Rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amount&nbsp;&nbsp;&nbsp;&nbsp;

Value in $<BR>

&nbsp;8 ============================================================

<BR>

&nbsp;9 .<BR>

10 format STDOUT =<BR>

11 @&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&nbsp;&nbsp;@&lt;&lt;&lt;&lt;&lt;&lt;

@#####.##&nbsp;&nbsp;&nbsp;@####.##&nbsp;&nbsp;$ @&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;

<BR>

12 $country,$currency,$value,$amount,&amp;checkAmount($amount,$value)

<BR>

13 .<BR>

14 sub checkAmount {<BR>

15&nbsp;&nbsp;&nbsp;&nbsp; my ($num, $val) = @_;<BR>

16&nbsp;&nbsp;&nbsp;&nbsp; my $dollars;<BR>

17&nbsp;&nbsp;&nbsp;&nbsp; my $ret;<BR>

18&nbsp;&nbsp;&nbsp;&nbsp; $dollars = $num / $val;<BR>

19&nbsp;&nbsp;&nbsp;&nbsp; $ret = sprintf &quot;%6.2f&nbsp;&nbsp;&nbsp;&nbsp;

&quot;, $dollars;<BR>

20&nbsp;&nbsp;&nbsp;&nbsp; if ($dollars &lt; 10)<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ $ret =

sprintf &quot;%6.2f low &quot;, $dollars; }<BR>

21&nbsp;&nbsp;&nbsp;&nbsp; if ($dollars &gt; 200)<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ $ret =

sprintf &quot;%6.2f high&quot;, $dollars; }<BR>

22&nbsp;&nbsp;&nbsp;&nbsp; $ret;<BR>

23 }</FONT></TT>

</BLOCKQUOTE>

<HR>

<P>

Note the format string to the <TT><FONT FACE="Courier">sprintf</FONT></TT>

function call in line numbers 19, 20, and 21 in the code shown

in Listing 19.7. The <TT><FONT FACE="Courier">sprintf</FONT></TT>

statement is designed to return the same number of characters

regardless of the value of <TT><FONT FACE="Courier">$dollar</FONT></TT>.

The length of the <TT><FONT FACE="Courier">$ret</FONT></TT> variable

in the <TT><FONT FACE="Courier">checkAmount</FONT></TT> subroutine

is a constant. If you leave the length of <TT><FONT FACE="Courier">$ret</FONT></TT>

dependent on <TT><FONT FACE="Courier">sprintf</FONT></TT>, there

is no guarantee that the output will be assigned on a decimal

point. It's important that you return a string back from the <TT><FONT FACE="Courier">checkAmount</FONT></TT>

function and not an integer. If you return an integer value, it

won't be printed.

<P>

Here's the output from Listing 19.7.

<BLOCKQUOTE>

<TT><FONT FACE="Courier">Id&nbsp;&nbsp;Country&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Currency&nbsp;&nbsp;Rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amount&nbsp;&nbsp;&nbsp;&nbsp;

Value in $<BR>

============================================================<BR>

UK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pound&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

1.85&nbsp;&nbsp;&nbsp;&nbsp; 100.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;54.05

<BR>

BELGIUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Franc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32.00&nbsp;&nbsp;&nbsp;&nbsp;

200.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6.25 low

<BR>

DENMARK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Krone&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

6.00&nbsp;&nbsp;&nbsp;&nbsp;2000.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

333.33 high<BR>

FINLAND&nbsp;&nbsp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sp;45.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

118.42<BR>

IRAQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dinar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

0.60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16.67

<BR>

JORDAN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dinar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

0.70&nbsp;&nbsp;&nbsp;&nbsp; 100.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

142.86<BR>

SAUDIARABIA&nbsp;&nbsp;&nbsp;&nbsp; Riyal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

3.75&nbsp;&nbsp;&nbsp;&nbsp;1000.00&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;

266.67 high</FONT></TT>

</BLOCKQUOTE>

<H2><A NAME="UsingMoreThanOneFormat"><FONT SIZE=5 COLOR=#FF0000>Using

More Than One Format</FONT></A></H2>

<P>

There is a standard header that uses the <TT><FONT FACE="Courier">_TOP</FONT></TT>

suffix; however, there is no <TT><FONT FACE="Courier">_END</FONT></TT>

or <TT><FONT FACE="Courier">_BOTTOM</FONT></TT> suffix to print

out when you are done. This is obvious because Perl does not know

when you want to stop. All is not lost, though, because you can

specify a different format to print out results at the end.

<P>

Listing 19.8 defines a new format name, called <TT><FONT FACE="Courier">ENDING</FONT></TT>.

First, it selects the format by setting the internal Perl variable

<TT><FONT FACE="Courier">$~</FONT></TT> to the name. Next, it

uses the format <TT><FONT FACE="Courier">ENDING</FONT></TT> to

print out the total value of the foreign currency portfolio.

<HR>

<BLOCKQUOTE>

<B>Listing 19.8. Using a different format.<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<TT><FONT FACE="Courier">&nbsp;1 #!/usr/bin/perl<BR>

&nbsp;2 while(&lt;&gt;) {<BR>

&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp; ($country, $code, $currency, $rate,

$amount)<BR>

&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=

split(',');<BR>

&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp; $sum += ($amount/$rate) ;<BR>

&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp; write;<BR>

&nbsp;7&nbsp;&nbsp;&nbsp;&nbsp; }<BR>

&nbsp;8 $~ = &quot;ENDING&quot;;<BR>

&nbsp;9 write;<BR>

10 format STDOUT_TOP =<BR>

11 Id&nbsp;&nbsp;Country&nbsp;&nbsp;&nbsp;&nbsp; Currency&nbsp;&nbsp;&nbsp;Rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amount&nbsp;&nbsp;&nbsp;&nbsp;

Value<BR>

12 ============================================================

<BR>

13 .<BR>

14 format STDOUT =<BR>

15 @&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&nbsp;&nbsp;@&lt;&lt;&lt;&lt;&lt;&lt;

@#####.##&nbsp;&nbsp;&nbsp;@####.##&nbsp;&nbsp;&nbsp;&nbsp;@#####.##

<BR>

16 $country,$currency,$rate,$amount,$amount/$rate<BR>

17 .<BR>

18 format ENDING =<BR>

19 ========================================================<BR>

20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total

Value =&nbsp;&nbsp;&nbsp;&nbsp;$@#######.###<BR>

21 $sum<BR>

22 ========================================================<BR>

23 .</FONT></TT>

</BLOCKQUOTE>

<HR>

<P>

Here is the output of Listing 19.8.

<BLOCKQUOTE>

<TT><FONT FACE="Courier">Id&nbsp;&nbsp;Country&nbsp;&nbsp;&nbsp;&nbsp;

Currency&nbsp;&nbsp;&nbsp;Rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amount&nbsp;&nbsp;&nbsp;&nbsp;

Value<BR>

========================================================<BR>

UK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pound&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

1.85&nbsp;&nbsp;&nbsp;&nbsp; 100.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;54.05

<BR>

BELGIUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Franc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32.00&nbsp;&nbsp;&nbsp;&nbsp;

200.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.25

<BR>

DENMARK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Krone&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

6.00&nbsp;&nbsp;&nbsp;&nbsp;2000.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

333.33<BR>

FINLAND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Markka&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.69&nbsp;&nbsp;&nbsp;&nbsp;1000.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

213.22<BR>

FRAncE&nbsp;&nbsp;&nbsp;&n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bsp;&nbsp;&nbsp;&nbsp;10.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16.67

<BR>

JORDAN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dinar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

0.70&nbsp;&nbsp;&nbsp;&nbsp; 100.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

142.86<BR>

SAUDIARABIA&nbsp;&nbsp;&nbsp;&nbsp; Riyal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

3.75&nbsp;&nbsp;&nbsp;&nbsp;1000.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

266.67<BR>

========================================================<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total

Value =&nbsp;&nbsp;&nbsp;&nbsp;$&nbsp;&nbsp;&nbsp;&nbsp;1271.741

<BR>

========================================================</FONT></TT>

</BLOCKQUOTE>

<H2><A NAME="ControllingtheFormat"><FONT SIZE=5 COLOR=#FF0000>Controlling

the Format</FONT></A></H2>

<P>

There are some very important internal Perl variables you must

be aware of when working with formats. By setting the values in

the following variables in a Perl script, you can control the

output of where to write to, the number of lines per page, what

to write on top of every new page and how to write every entry

and so on:<P>

<CENTER>

<TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>

<TR VALIGN=TOP><TD WIDTH=100><CENTER><I>Variable</I></CENTER></TD><TD WIDTH=513><CENTER><I>Description</I></CENTER>

</TD></TR>

<TR VALIGN=TOP><TD WIDTH=100><CENTER><TT><FONT FACE="Courier">$~</FONT></TT></CENTER>

</TD><TD WIDTH=513>This variable contains the name of the default format to use. The default is <TT><FONT FACE="Courier">STDOUT</FONT></TT> if you are writing to <TT><FONT FACE="Courier">STDOUT</FONT></TT>. This is used in Listing 19.8.

</TD></TR>

<TR VALIGN=TOP><TD WIDTH=100><CENTER><TT><FONT FACE="Courier">$^</FONT></TT></CENTER>

</TD><TD WIDTH=513>This variable contains the default top-of-page format. Just like the <TT><FONT FACE="Courier">$~</FONT></TT> variable, you can set <TT><FONT FACE="Courier">$^</FONT></TT> to a different top-of-page format than the default. Set this value 

to <TT><FONT FACE="Courier">NULL</FONT></TT> if you don't want a header printed every <TT><FONT FACE="Courier">$=</FONT></TT> lines.

</TD></TR>

<TR VALIGN=TOP><TD WIDTH=100><CENTER><TT><FONT FACE="Courier">$=</FONT></TT></CENTER>

</TD><TD WIDTH=513>This variable contains the number of lines to write before writing the top-of-page header. The default value is 60 lines per page.

</TD></TR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -