亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch3.htm

?? prrl 5 programs codes in the book
?? HTM
?? 第 1 頁 / 共 3 頁
字號:

</TABLE>

</CENTER>

<P>

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Assign values to array variables.<BR>

Print the array variables.</I>

</BLOCKQUOTE>

<P>

Listing 3.1 shows values assigned to array variables.

<HR>

<BLOCKQUOTE>

<B>Listing 3.1&nbsp;&nbsp;03LST01.PL-Assigning Values to Array

Variables<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

@emptyArray = ();

@numberArray = (12, 014, 0x0c, 34.34, 23.3E-3);

@stringArray = (&quot;This&quot;, &quot;is&quot;, 'an', &quot;array&quot;, 'of', &quot;strings&quot;);

@mixedArray = (&quot;This&quot;, 30, &quot;is&quot;, 'a', &quot;mixed array&quot;, 'of', 0x08, &quot;items&quot;);

print &quot;Here is an empty array:&quot; . @emptyArray . &quot;&lt;- Nothing there!\n&quot;;

print @numberArray;  print &quot;\n&quot;;

print @stringArray;  print &quot;\n&quot;;

print @mixedArray;   print &quot;\n&quot;;

</PRE>

</BLOCKQUOTE>

<HR>

<P>

This program will display:

<BLOCKQUOTE>

<PRE>

Here is an empty array:0&lt;- Nothing there!

12121234.340.0233

Thisisanarrayofstrings

This30isamixed arrayof8items

</PRE>

</BLOCKQUOTE>

<P>

In this example, we assign literal values to array variables and

then display them using the <TT>print</TT>

command. This is very similar to what we did in <A HREF="ch1.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch1.htm" >Chapter 1</A> &quot;Getting

Your Feet Wet,&quot; except that we are temporarily storing the

array values into variables before printing them.

<P>

Suppose that you want to create one array from two smaller ones.

You can do this by using the sub-arrays inside the assignment

statement.

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Create two small arrays using the range operator.<BR>

Create an array that consists of the two small arrays.<BR>

Print the array.</I>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

@smallArrayOne = (5..10);

@smallArrayTwo = (1..5);

@largeArray = (@smallArrayOne, @smallArrayTwo);

print @largeArray;

</PRE>

</BLOCKQUOTE>

<P>

When run, this program prints the array (5, 6, 7, 8, 9, 10, 1,

2, 3, 4, 5). Notice that the 5 is duplicated in the new array

and that the elements are still in the same order as the sub-arrays.

When you coNCatenate arrays in this manner, Perl does not sort

them or modify their contents in any way.

<H3><A NAME="ExampleUsingArrayElements">

Example: Using Array Elements</A></H3>

<P>

Individual elements of an array are accessed by prefixing the

array name with a <TT>$</TT> and using

an index that indicates to Perl which element you want to use.

<P>

Listing 3.2 creates an array of five elements and then prints

each individual element.

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Create an array with five elements.<BR>

Print the array.<BR>

Print each element of the array.</I>

</BLOCKQUOTE>

<HR>

<BLOCKQUOTE>

<B>Listing 3.2&nbsp;&nbsp;03LIST02.PL-Accessing Array Elements

<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

@array = (1..5);

print @array;     print &quot;\n&quot;;

print $array[0];  print &quot;\n&quot;;

print $array[1];  print &quot;\n&quot;;

print $array[2];  print &quot;\n&quot;;

print $array[3];  print &quot;\n&quot;;

print $array[4];  print &quot;\n&quot;;

</PRE>

</BLOCKQUOTE>

<HR>

<P>

Listing 3.2 will print the following:

<BLOCKQUOTE>

<PRE>

12345

1

2

3

4

5

</PRE>

</BLOCKQUOTE>

<P>

Perl array indexes start at 0-well, they actually start at <TT>$[</TT>-but

for the moment zero is good enough. Almost every Perl program

uses zero as the base array subscript.<BR>

<p>

<CENTER>

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

<TR><TD><B>Note</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

The special variable, <TT>$[</TT>, is used to hold the base array subscript; usually, it is zero. However, it can be changed to any integer you want, even negative ones. Using a negative base array subscript probably will make your programs hard to 
understand, and I recommend against it. Other special variables are mentioned in <A HREF="ch12.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch12.htm" >Chapter 12</A>, &quot;Using Special Variables.&quot;

</BLOCKQUOTE>



</TD></TR>

</TABLE>

</CENTER>

<P>

<P>

You can replace the numeric literal indexes in the above example

with scalar variables. You can say:

<BLOCKQUOTE>

<PRE>

$index = 2

@array = (1..5);

print $array[$index];  print &quot;\n&quot;;

</PRE>

</BLOCKQUOTE>

<P>

which would print <TT>3</TT>.

<H3><A NAME="ExampleUsingNegativeSubscripts">

Example: Using Negative Subscripts</A></H3>

<P>

Perl is definitely a language that will surprise you at times.

In other languages, subscripts must be positive integers. However,

Perl lets you use negative subscripts to access array elements

in reverse order.<BR>

<p>

<CENTER>

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

<TR><TD><B>Tip</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

Using a negative subscript may come in handy if you need a fast way to get the value of the last element in an array.</BLOCKQUOTE>



</TD></TR>

</TABLE>

</CENTER>

<P>

<P>

The program in Listing 3.3 assigns a five-element array to <TT>@array</TT>.

Then, it uses the  <TT>print</TT>

statement and negative subscripts to print each array element

in reverse order.

<HR>

<BLOCKQUOTE>

<B>Listing 3.3&nbsp;&nbsp;03LIST03.PL-Accessing Array Elements

Using Negative Subscripts<BR>

</B>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

@array = (1..5);

print @array;      print &quot;\n&quot;;

print $array[-1];  print &quot;\n&quot;;

print $array[-2];  print &quot;\n&quot;;

print $array[-3];  print &quot;\n&quot;;

print $array[-4];  print &quot;\n&quot;;

print $array[-5];  print &quot;\n&quot;;

</PRE>

</BLOCKQUOTE>

<HR>

<P>

Listing 3.3 will print the following:

<BLOCKQUOTE>

<PRE>

12345

5

4

3

2

1

</PRE>

</BLOCKQUOTE>

<H3><A NAME="ExampleDeterminingtheNumberofElementsinanArray">

Example: Determining the Number of Elements in an Array</A></H3>

<P>

If you need to determine the number of elements that an array

contains, you can assign the array to a scalar variable.

<P>

In fact, anytime that an array is used when a scalar is needed,

the value used will be the number of array elements.

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Create an array with five elements.<BR>

<I>Assign the array size to the </I></I><TT><I>$numberOfElements</I></TT><I>

scalar variable.<BR>

Multiply the array size by 2 and assign that value to </I><TT><I>$doubleTheSize</I></TT><I>.

<BR>

Print the scalar variables.</I>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

@array = (1..5);

$numberOfElements = @array;

$doubleTheSize = 2 * @array;

print &quot;The number of array elements is: &quot; . $numberOfElements . &quot;\n&quot;;

print &quot;Double the number of array elements is: &quot; . $doubleTheSize . &quot;\n&quot;;

</PRE>

</BLOCKQUOTE>

<P>

When this program runs, it will assign a value of <TT>5</TT>

to <TT>$numberOfElements</TT> and

<TT>10</TT> to <TT>$doubleTheSize</TT>.

<BR>

<p>

<CENTER>

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

<TR><TD><B>Tip</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

Perl has the powerful ability to return the number of array elements when the array variable is used in a scalar context. However, this ability can be confusing while looking at someone else's program if you don't remember that there is a differeNCe 
between scalar contexts and array contexts.</BLOCKQUOTE>



</TD></TR>

</TABLE>

</CENTER>

<P>

<H3><A NAME="ExampleHowtoGrabaSliceorPartofanArray">

Example: How to Grab a Slice (or Part) of an Array</A></H3>

<P>

At times you will need to use some elements of an array and not

others. You might want to assign array elements to scalars or

to another array. Using only part of an array is done with an

array slice. An array <I>slice</I> uses an <TT>@</TT>

character and the square brackets (<TT>[]</TT>)

to create a sub-array consisting of selected individual elements.

For example,

<P>

<IMG SRC="pseudo.gif" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/pseudo.gif" BORDER=1 ALIGN=RIGHT><p>

<BLOCKQUOTE>

<I>Create a four-element array and assign it to </I><TT><I>@array</I></TT><I>.

<BR>

Use an array slice to assign the first and third elements to </I><TT><I>$first</I></TT><I>

and </I><TT><I>$third</I></TT><I>.

<BR>

Use an array slice to assign the second half of the array to </I><TT><I>@half</I></TT><I>.

<BR>

Print </I><TT><I>@array</I></TT><I>,

</I><TT><I>$first</I></TT><I>, </I><TT><I>$third</I></TT><I>,

and </I><TT><I>@half</I></TT><I> to

verify their values.<BR>

Tranpose the first and last elements in </I><TT><I>@array</I></TT><I>.

<BR>

Print </I><TT><I>@array</I></TT><I>

to verify that the elements have been switched.</I>

</BLOCKQUOTE>

<BLOCKQUOTE>

<PRE>

@array           = (&quot;One&quot;, &quot;Two&quot;, &quot;Three&quot;, &quot;Four&quot;);

($first, $third) = @array[0, 2];

@half            = @array[2, 3];



print(&quot;\@array=@array\n&quot;);

print(&quot;\$first=$first  \$third=$third\n&quot;);

print(&quot;\@half=@half\n&quot;);



@array[0, 3]     = @array[3, 0];

print(&quot;\@array=@array\n&quot;);

</PRE>

</BLOCKQUOTE>

<P>

This program will display:

<BLOCKQUOTE>

<PRE>

@array=One Two Three Four

$first=One  $third=Three

@half=Three Four

@array=Four Two Three One

</PRE>

</BLOCKQUOTE>

<P>

You won't really understand the power of array slices until you

learn about fuNCtions in <A HREF="ch5.htm" tppabs="http://cheminf.nankai.edu.cn/~eb~/Perl%205%20By%20Example/ch5.htm" >Chapter 5</A> &quot;FuNCtions.&quot; At

that point, you'll see that fuNCtions (sub- programs that you

invoke using a fuNCtion name) can return a value. When calling

a fuNCtion that returns the time and date in an array, a slice

can be used to &quot;grab&quot; just those elements in which you

are interested. For example, just the year or just the hour.

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

Associative Array Variables</FONT></A></H2>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人性色生活片| 性做久久久久久久免费看| 欧美一区二区三区免费视频| 99久久婷婷国产| www.欧美亚洲| 成人福利视频在线| 成人午夜av在线| 成人自拍视频在线观看| 91蜜桃网址入口| 欧美日韩另类一区| 日韩一区二区电影在线| 精品卡一卡二卡三卡四在线| 欧美激情一二三区| 中文字幕一区二区三区色视频 | 久久亚洲一级片| 久久精品一区四区| 亚洲男同性恋视频| 日韩av网站在线观看| 狠狠网亚洲精品| 成人avav影音| 欧美精品视频www在线观看 | 国产精品国产自产拍高清av| 亚洲欧洲日产国码二区| 午夜视频在线观看一区二区三区| 日本在线不卡一区| 成人久久久精品乱码一区二区三区 | 一区二区三区色| 奇米色一区二区三区四区| 国产成人鲁色资源国产91色综 | 欧美一级一级性生活免费录像| 久久久国产精华| 亚洲一区二区三区在线看| 久久99精品一区二区三区| 93久久精品日日躁夜夜躁欧美| 欧美福利视频一区| 中文字幕成人av| 免费精品视频在线| 91在线免费看| 亚洲精品在线电影| 亚洲一线二线三线久久久| 国产九色sp调教91| 欧美日韩五月天| 国产精品久久毛片a| 久久狠狠亚洲综合| 欧美在线观看一二区| 国产情人综合久久777777| 三级成人在线视频| 色偷偷久久人人79超碰人人澡| 精品成人一区二区三区四区| 午夜久久久影院| 91美女片黄在线| 国产精品久久久99| 国产精品系列在线播放| 欧美一区二区三区公司| 亚洲一区二区三区四区的| av不卡免费电影| 中文字幕免费不卡| 国产原创一区二区三区| 欧美一区二区性放荡片| 午夜久久久久久久久久一区二区| 91黄色免费版| 成人欧美一区二区三区在线播放| 久久精品国产亚洲一区二区三区| 欧美日韩国产经典色站一区二区三区 | 日韩精品电影在线| 欧美在线一二三| 亚洲男人的天堂在线aⅴ视频| 懂色av一区二区三区蜜臀| 久久久久久久久久久久电影| 韩国av一区二区| 精品国产1区2区3区| 久久精品国产亚洲a| 日韩三级视频在线看| 免费不卡在线观看| 精品欧美一区二区在线观看| 国产麻豆精品theporn| 久久久国产综合精品女国产盗摄| 激情伊人五月天久久综合| 久久欧美一区二区| 成人午夜电影网站| 亚洲免费观看在线视频| 91麻豆精品一区二区三区| 日韩一区中文字幕| 欧美网站一区二区| 亚洲.国产.中文慕字在线| 欧美伦理电影网| 激情亚洲综合在线| 中文字幕在线观看一区| 91麻豆国产精品久久| 亚洲成人精品一区二区| 日韩欧美国产小视频| 国产精品夜夜嗨| 18成人在线视频| 欧美日韩激情在线| 久久99精品久久久久久国产越南| 国产日韩影视精品| 色婷婷精品久久二区二区蜜臂av | 91亚洲永久精品| 亚洲国产成人91porn| 2欧美一区二区三区在线观看视频| 国产在线视频一区二区| 中文字幕亚洲成人| 欧美三级欧美一级| 国产大陆a不卡| 亚洲欧美日韩精品久久久久| 欧美一区二区福利在线| 国产成人精品三级| 亚洲国产日韩一区二区| 2020日本不卡一区二区视频| 91在线观看免费视频| 秋霞电影一区二区| 中文字幕中文字幕在线一区| 7777精品久久久大香线蕉| 国产高清不卡一区| 天天综合色天天| 国产精品久久久久久久岛一牛影视| 欧美日韩国产一级二级| 成人高清免费观看| 久久99国产乱子伦精品免费| 亚洲综合精品自拍| 久久久久国产精品免费免费搜索| 欧美色老头old∨ideo| 成人午夜碰碰视频| 乱一区二区av| 三级在线观看一区二区| 亚洲色图在线播放| 久久精品视频一区二区三区| 制服视频三区第一页精品| 色综合天天综合| 国产盗摄一区二区| 麻豆精品在线观看| 日韩高清不卡在线| 一区二区国产盗摄色噜噜| 欧美国产激情二区三区| 亚洲精品在线三区| 欧美一区二区大片| 欧美精品v国产精品v日韩精品| 99久久国产综合色|国产精品| 国产在线日韩欧美| 蜜桃av一区二区在线观看| 亚洲高清免费观看| 亚洲人午夜精品天堂一二香蕉| 国产精品女上位| 国产亚洲欧洲997久久综合| 在线精品国精品国产尤物884a | 精品久久久久久久久久久久包黑料 | 久久精品亚洲乱码伦伦中文| 日韩欧美精品三级| 日韩一级片网站| 3d动漫精品啪啪1区2区免费| 4438亚洲最大| 日韩一区二区三区免费看 | 亚洲日本中文字幕区| 日本一区二区三区四区| 欧美激情中文字幕一区二区| 久久久久国产成人精品亚洲午夜| 欧美精品一区二区不卡| 久久精品视频一区二区三区| 中文字幕电影一区| 亚洲欧美偷拍三级| 亚洲精品乱码久久久久| 亚洲国产综合91精品麻豆| 五月综合激情日本mⅴ| 免费xxxx性欧美18vr| 国产99久久久国产精品潘金 | 91在线视频18| 91成人在线观看喷潮| 欧美性xxxxxxxx| 这里只有精品视频在线观看| 日韩免费高清视频| 久久精品在线免费观看| 亚洲免费视频成人| 日韩精品亚洲一区| 国产精品香蕉一区二区三区| 成人国产亚洲欧美成人综合网| 色婷婷av一区| 日韩欧美高清一区| 国产精品私人影院| 偷拍日韩校园综合在线| 久久99国产精品麻豆| 91视频免费看| 69堂国产成人免费视频| 欧美激情综合五月色丁香小说| 亚洲天堂2014| 久久97超碰色| 色综合久久久网| 欧美电视剧在线看免费| 中文字幕五月欧美| 午夜精品久久久久久久久久久| 国产传媒欧美日韩成人| 欧美性大战久久久| 国产亚洲欧美日韩日本| 亚洲综合色视频| 懂色av噜噜一区二区三区av| 在线播放日韩导航| 1024亚洲合集| 国产精品一级黄| 欧美一级搡bbbb搡bbbb| 亚洲欧美激情视频在线观看一区二区三区| 日韩国产欧美在线观看|