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

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

?? rhl29.htm

?? linux的初學電子書
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<HTML>

<HEAD>

<TITLE>Red Hat Linux Unleashed rhl29.htm </TITLE>

<LINK REL="ToC" HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm">

<LINK REL="Index" HREF="htindex.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/htindex.htm">

<LINK REL="Next" HREF="rhl30.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl30.htm">

<LINK REL="Previous" HREF="rhl28.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl28.htm"></HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">

<A NAME="I0"></A>

<H2>Red Hat Linux Unleashed rhl29.htm</H2>

<P ALIGN=LEFT>

<A HREF="rhl28.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl28.htm" TARGET="_self"><IMG SRC="purprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>

<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm" TARGET="_self"><IMG SRC="purtoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>

<A HREF="rhl30.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl30.htm" TARGET="_self"><IMG SRC="purnext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>


<HR ALIGN=CENTER>

<P>

<UL>

<UL>

<UL>

<LI>

<A HREF="#E68E230" >Variables in Perl</A>

<UL>

<UL>

<LI>

<A HREF="#E70E9" >Code Blocks in Loops</A></UL>

<LI>

<A HREF="#E69E362" >Quoting Rules</A></UL>

<LI>

<A HREF="#E68E231" >Arrays and Associative Arrays</A>

<UL>

<LI>

<A HREF="#E69E363" >Associative Arrays</A></UL>

<LI>

<A HREF="#E68E232" >Array Operations</A>

<LI>

<A HREF="#E68E233" >File Handles and Operators</A>

<LI>

<A HREF="#E68E234" >Working with Patterns</A>

<LI>

<A HREF="#E68E235" >Subroutines</A>

<LI>

<A HREF="#E68E236" >More Features in Perl 5</A>

<LI>

<A HREF="#E68E237" >Summary</A></UL></UL></UL>

<HR ALIGN=CENTER>

<A NAME="E66E29"></A>

<H1 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>29</B></FONT></CENTER></H1>

<BR>

<A NAME="E67E29"></A>

<H2 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>Perl</B></FONT></CENTER></H2>

<BR>

<P>Perl stands for Practical Extraction and Report Language and is a free utility that comes with Linux versions. Perl was developed by Larry Wall. The -v option will print the version number of Perl you are running. This book is written for Perl 5.002, 
and not for 5.001m which comes with your Linux system, since the later version has fewer bugs and more features. The full release of 5.002 is available at the FTP site ftp.mox. The latest release is available from the Web site <A 
HREF="tppmsgs/msgs0.htm#99" tppabs="http://mox.perl.com/perl/info/software.html">http://mox.perl.com/perl/info/software.html</A> as perl5.002.tar.gz. Installation is very easy if you follow the read me directions.

<BR>

<P>Perl is a program just like any other program on your system, only it's more powerful than most other programs because it combines the features of awk, grep, sed, and C all in one language! To run Perl, you can simply type perl at the prompt and type in 
your code. In almost all cases, though, you will want to keep your Perl code in files just like shell scripts. A Perl program is referred to as a script.

<BR>

<P>Perl programs are interpreted and compiled by the Perl program before executing the program. To create a Perl program you use the syntax of #!program_name as the first line of an executable file to create a Perl script. The following two lines are a 
valid Perl script:

<BR>

<PRE>

<FONT COLOR="#000080">#!/usr/bin/perl

print &quot;I be Perl\n&quot;;</FONT></PRE>

<P>On some Linux systems, the path to Perl is /sbin/perl, and on some it's /usr/local/bin/perl. The libraries for the Perl program on some other machines will be located in the /usr/bin/perl5, /usr/lib/perl5, or the /usr/local/lib/perl5 directory. Use a 
find command to see if you can locate Perl on your system.

<BR>

<P>You can run programs via the command line with the -e switch to perl. For example, entering the following command at the prompt will print &quot;Howdy!&quot;.

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">$ perl -e 'print &quot;Howdy&quot;;\n'</FONT></PRE>

<P>In all but the shortest of Perl programs, you will use a file to store your Perl code as a script. Using a script file offers you the ease of not having to type commands interactively and thus not being able to correct typing errors easily. A script 
file also provides a written record of which commands to use to do some task.

<BR>

<P>To fire off a command on all lines in the input, use the -p option. Thus,

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">$perl -p -e 's/old/new/g' test.txt</FONT></PRE>

<P>will run the command to substitute all strings old with new on each line from the file test.txt. If you use the -p option, it will print each line as it is read in.

<BR>

<P>Let's start with an introduction to the Perl language.

<BR>

<BR>

<A NAME="E68E230"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Variables in Perl</B></FONT></CENTER></H3>

<BR>

<P>Perl has three basic types of variables: scalars, arrays, and associative arrays. A scalar variable is anything that can hold one number or a string. An array stores many scalars in a sequence, where each scalar can be indexed using a number starting 
from 0. An associative is like an array in that it stores strings in sequenceb but uses another string as an index to address individual items instead of a number.

<BR>

<P>Let's start with scalar variables.

<BR>

<P>The syntax for a scalar variable is $variable_name. A variable name is set up and addressed in the same way as Bourne shell variables. To assign values to a scalar, you use statements like these:

<BR>

<PRE>

<FONT COLOR="#000080">$name = &quot;Kamran&quot;;

$number= 100;

$phone_Number = '555-1232';</FONT></PRE>

<P>A variable in Perl is evaluated at runtime to derive a value that is one of the following: a string, a number, or a pointer to scalar. It's important to place a $ sign in front of the variable name, or it will be interpreted as a file handle.

<BR>

<P>To print out the value of a variable, you would use a print statement. To print the value of $name, you would make a call:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">print $name;</FONT></PRE>

<P>The value of $name is printed to the screen. Perl scripts expect input from a standard input (the keyboard) and write to the standard output.

<BR>

<BR>

<A NAME="E70E9"></A>

<H5 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Code Blocks in Loops</B></FONT></CENTER></H5>

<BR>

<P>Variables and assignment statements exist in code blocks. Each code block is a section of code between two curly braces. The loop construct and conditional expressions used in Perl delimit code blocks with curly braces. The following are some examples 
of code blocks available in Perl:

<BR>

<PRE>

<FONT COLOR="#000080">while(condition) {

... execute code here while condition is true;

}

until(condition) { # opposite of while statement.

... execute code here while condition is false;

}

do {

... do this at least once ...

... stop if condition is false ...

} while(condition);

do {

... do this at least once ...

... stop if condition is true ...

} until(condition);

if (condition1) {

condition1_code true;

} else {

...no condition1 up to conditionN is true;

}

if (condition1) {

...condition1_code true;

} elsif (condition2) {

condition1_code true;

....

} elsif (conditionN) {

conditionN_code true;

} else {

...no condition from 1 up to N is true;

}

unless (condition1) { # opposite of &quot;if&quot; statement.

do this if condition is false;

}</FONT></PRE>

<P>The condition in the preceding blocks of code is anything from a Perl variable to an expression that returns either a true or false value. A true value is a nonzero or a nonempty string.

<BR>

<P>Code blocks can be declared within code blocks to create levels of code blocks. Variables declared in one code block are usually global to the rest of the program. To keep the scope of the variable limited to the code block in which it is declared, use 
the my $variableName syntax. If you declare with local $variableName syntax, the $variableName will be available to all lower levels but not outside the code block. So if your code calls another subroutine, any variables declared with the word local could 
be modified by the called subroutine; however, those variables declared by the my keyword will not be visible to the called subroutine.

<BR>

<P>Variables in code blocks are also declared the first time they are assigned a value. This creation includes arrays and strings. Variables are then evaluated by the parser when they appear in code, and even in strings. There are times when you do not 
want the variable to be evaluated. This is the time when you should be aware of quoting rules in Perl.

<BR>

<BR>

<A NAME="E69E362"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Quoting Rules</B></FONT></CENTER></H4>

<BR>

<P>Three different types of quotes can be used on Perl. Double quotes (&quot;&quot;) are used to enclose strings. Any scalars in double quoted strings are evaluated by Perl. To force Perl not to evaluate anything in a quote, you will have to use single 
quotes ('). Finally, to run some values in a shell program and get its return value back, use the back quote (`) symbol. To see an example of how it works, see the sample Perl script in Listing 29.1.

<BR>

<P>

<FONT COLOR="#000080"><B>Listing 29.1. Quoting in a Perl script.</B></FONT>

<BR>

<PRE>

<FONT COLOR="#000080">1 #!/usr/bin/perl

2 $folks=&quot;100&quot;;

3 print &quot;\$folks = $folks \n&quot;;

4 print '\$folks = $folks \n';

5 print &quot;\n\n BEEP! \a \LSOME BLANK \ELINES HERE \n\n&quot;;

6 $date = 'date +%D';

7 print &quot;Today is [$date] \n&quot;;

8 chop $date;

9 print &quot;Date after chopping off carriage return: [&quot;.$date.&quot;]\n&quot;;</FONT></PRE>

<P>The output from the code in Listing 29.1 is shown here. The line numbers shown in the listing are for the benefit of illustration only and are not present in the actual file.

<BR>

<PRE>

<FONT COLOR="#000080">$folks = 100

$folks = $folks \n

BEEP! some blank LINES HERE

Today is [03/29/96

]

Date after chopping off carriage return: [03/29/96]</FONT></PRE>

<P>Let's go over the code shown in Listing 29.1.

<BR>

<P>Line 1 is the mandatory first line of the Perl script.

<BR>

<P>Line 2 assigns a string value to $folks variable. Note that you did not have to declare the variable $folks; it was created when used for the first time.

<BR>

<P>Line 3 prints the value of $folks in between double quotes. The $ sign in $folks has to be escaped with the \ character to prevent Perl from evaluating the value of $folks instead of printing the word $folks verbatim in the output like this:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">$folks = 100</FONT></PRE>

<P>In line 4, Perl does not evaluate anything between the single quotes. The entire contents of the line are left untouched and printed out here:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">\$folks = $folks \n</FONT></PRE>

<P>Perl has several special characters to format text data for you. Line 5 prints multiple blank lines with the \n character and beeps at the terminal. Two \n characters are needed to proceed from the end of the current line, skip line and position the 
cursor at the next line. Notice how the words SOME BLANK are printed in lowercase? This is because they are encased between the \L and \E special characters, which forces all characters to be lowercase. Some of these special characters are listed in Table 
29.1.

<BR>

<BR>

<P ALIGN=CENTER>

<CENTER>

<FONT COLOR="#000080"><B>Table 29.1. Special characters in Perl.</B></FONT></CENTER>

<BR>



<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>Character</I>

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

<I>Meaning</I></FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\n 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

New line (line feed)</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\r 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Carriage return (MSDOS)</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\t 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Tab</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\a 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Beep</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\b 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Backspace</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\L \E 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Lowercase all characters in between \L and \E</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\l 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Lowercase next character</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\U \E 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Uppercase all characters in between \U and \E</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\u 

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Uppercase next character</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\cC

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Insert control character &quot;C&quot;</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\x##

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Hex number in ##, such as \x1d</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\0ooo

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Octal number in ooo, such as \0213</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

\\

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

A backslash</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
经典一区二区三区| 91麻豆精品国产自产在线| 欧美亚洲自拍偷拍| 2023国产一二三区日本精品2022| 欧美激情在线一区二区三区| 日本不卡一二三区黄网| 91免费观看视频| 久久亚洲精华国产精华液| 五月天亚洲婷婷| 在线欧美日韩国产| 亚洲丝袜美腿综合| 高清免费成人av| 久久伊99综合婷婷久久伊| 日韩精品欧美精品| 欧美精品乱码久久久久久按摩| 国产精品理伦片| 国产成人在线观看| 国产亚洲欧美日韩日本| 久久99深爱久久99精品| 欧美一级高清片在线观看| 亚洲国产精品久久一线不卡| 91在线观看美女| 国产精品传媒入口麻豆| 豆国产96在线|亚洲| 精品国产乱码久久久久久夜甘婷婷| 亚洲v日本v欧美v久久精品| 一本一道综合狠狠老| 国产精品久久久久久久第一福利 | 成人欧美一区二区三区视频网页| 国产综合久久久久久鬼色| 日韩亚洲欧美在线观看| 日本欧美在线看| 欧美一区永久视频免费观看| 日韩专区一卡二卡| 欧美一级高清大全免费观看| 麻豆精品视频在线观看视频| 日韩欧美电影一二三| 久久爱www久久做| 久久久久久一二三区| 狠狠狠色丁香婷婷综合久久五月| 精品国产sm最大网站免费看| 国产一区欧美二区| 国产精品久久夜| 91久久精品国产91性色tv| 亚洲在线一区二区三区| 在线播放国产精品二区一二区四区 | 一区二区三区不卡视频| 在线精品观看国产| 日韩和欧美一区二区三区| 日韩视频在线一区二区| 国产精品1区2区3区| 日本一区二区三区久久久久久久久不 | 免费在线一区观看| 精品美女一区二区| 99久久亚洲一区二区三区青草| 一区二区三区四区在线免费观看| 在线亚洲高清视频| 久久电影网电视剧免费观看| 欧美韩国一区二区| 欧美日韩精品一区二区三区| 狠狠色丁香久久婷婷综| 中文字幕日韩av资源站| 欧美日本国产一区| 韩日欧美一区二区三区| 亚洲视频图片小说| 日韩一级片网站| 99久久免费精品| 日本人妖一区二区| 一区二区中文视频| 欧美一区二区三区四区在线观看| 国产一区二区h| 夜夜嗨av一区二区三区网页 | 狠狠色狠狠色合久久伊人| 中文字幕一区二区三区色视频| 欧美色综合网站| 国产激情一区二区三区桃花岛亚洲| 亚洲三级久久久| 精品sm捆绑视频| 欧美日韩中文国产| 国产成人精品免费网站| 丝袜亚洲另类欧美| 中文字幕一区二区三区视频| 精品av综合导航| 欧美狂野另类xxxxoooo| av动漫一区二区| 国产专区综合网| 日本在线不卡一区| 亚洲欧美日本在线| 国产农村妇女精品| 日韩精品在线一区| 欧美日本在线播放| 一本大道久久a久久综合 | 美女精品一区二区| 亚洲综合在线电影| 国产精品美女久久久久久2018| 日韩一区二区三区电影在线观看| 一本到一区二区三区| 成人av网址在线观看| 国产在线精品国自产拍免费| 免费一区二区视频| 日日欢夜夜爽一区| 亚洲123区在线观看| 亚洲免费观看高清完整版在线观看熊 | 精品国产一区二区亚洲人成毛片| 精品视频在线免费观看| 色丁香久综合在线久综合在线观看| 国产精品亚洲综合一区在线观看| 久久se精品一区精品二区| 青青草国产成人av片免费| 午夜精品久久久久久久蜜桃app| 亚洲人成影院在线观看| 亚洲日本va午夜在线影院| 国产精品拍天天在线| 国产欧美在线观看一区| 国产欧美日韩亚州综合| 国产女同互慰高潮91漫画| 欧美激情中文字幕一区二区| 国产精品私人自拍| 国产精品国产a| 亚洲精品精品亚洲| 亚洲一区二区视频在线观看| 一区二区三区精品| 日韩高清电影一区| 精品一区二区免费在线观看| 久久国产精品72免费观看| 国内国产精品久久| 成人手机电影网| 色素色在线综合| 欧美一区二区在线看| 精品乱码亚洲一区二区不卡| 精品国产乱码91久久久久久网站| 2020日本不卡一区二区视频| 中文字幕乱码亚洲精品一区| 最新国产成人在线观看| 亚洲午夜视频在线| 老鸭窝一区二区久久精品| 国产一区二区三区在线观看免费视频| 国产精品1024久久| 在线免费视频一区二区| 欧美一级免费大片| 欧美国产日韩在线观看| 亚洲国产人成综合网站| 麻豆91精品视频| 99精品1区2区| 91精品国产91久久综合桃花| 国产视频一区二区在线观看| 一区二区高清免费观看影视大全 | 欧美videofree性高清杂交| 欧美激情一区二区三区四区| 亚洲图片欧美视频| 国产一区二区三区精品欧美日韩一区二区三区 | 中国av一区二区三区| 一区二区久久久| 国产在线视频不卡二| 日本韩国一区二区| 久久视频一区二区| 亚洲国产一二三| 成人小视频免费在线观看| 欧美二区三区91| 亚洲欧洲日韩一区二区三区| 青娱乐精品视频| 在线观看国产日韩| 日本一区二区三区高清不卡 | 制服丝袜一区二区三区| 日本一区二区成人在线| 亚洲国产成人精品视频| 成人午夜视频网站| 日韩视频免费观看高清完整版在线观看| 国产精品女主播在线观看| 奇米亚洲午夜久久精品| 色就色 综合激情| 国产精品污www在线观看| 精品一区二区三区av| 欧美精品亚洲二区| 亚洲男同性恋视频| 国产91精品精华液一区二区三区| 日韩欧美在线1卡| 偷拍与自拍一区| 欧美日韩综合一区| 亚洲精品va在线观看| av一二三不卡影片| 国产免费观看久久| 国产成人免费视频网站高清观看视频| 91精品国产色综合久久不卡蜜臀 | 中文字幕一区日韩精品欧美| 国产一区视频网站| xnxx国产精品| 六月丁香婷婷久久| 日韩三级高清在线| 麻豆精品视频在线观看| 欧美一区二区三区免费在线看| 亚洲一区欧美一区| 在线视频观看一区| 亚洲在线中文字幕| 欧美日韩中文一区| 日韩电影在线一区| 欧美一区二区国产| 老司机精品视频在线| 日韩欧美一二三四区| 久久精品国产亚洲aⅴ|