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

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

?? the perl weekly journal 3rd edition.html

?? a collection of mega hacking tools
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<HTML>

<HEAD>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">

<META NAME="Generator" CONTENT="Microsoft Word 97">

<TITLE>Ankit Fadia ankit@bol.net.in</TITLE>

</HEAD>

<BODY LINK="#0000ff">



<FONT SIZE=2><P>_______________________________________________________________</P>



<P>The Perl Almost Weekly Manual By Ankit Fadia </FONT><A HREF="mailto:ankit@bol.net.in"><FONT SIZE=2>ankit@bol.net.in</FONT></A></P>

<FONT SIZE=2><P>_______________________________________________________________</P>



<B><P>@ARGV</P>



</B><P>Till now we have learnt about only one special Variable, the $_ variable. Another useful variable is the @ARGV variable which contains a set of elements of all command line arguments provided to the Perl Program. The first command line argument can be found at $ARGV[0], the second at $ARGV[1] and so on. Let's suppose a Perl Program was called using three command line arguments, which are</P>

<P> Ankit, Fadia, Anki123. Then @ARGV would contain Ankit, Fadia and Anki123, with $ARGV[0]=Ankit, $ARGV[1]= Fadia and $ARGV[2]= Anki123.</P>

<P>For Example,</P>



<P>The following PERL program takes the number which was passed as a command line argument, then multiplies this argument with 4 and finally displays the result on the screen.</P>



<P>$number = $ARGV[0];</P>

<P>print $number *4;</P>



<P>Output:</P>



<P>C:\perl&gt;perl filename.pl 5</P>

<P>20</P>



<P>Not all functions assume $_ to be the default variable, some functions take @ARGV instead. For Example, the shift( ) function. What the shift( ) function does is remove and return the leftmost or the first argument of @ARGV. To understand the use of the shift( ) function, consider the following example.</P>



<P>In this PERL program ,we assume that the User Passes two arguments, the Program then takes the two arguments adds them and then displays the sum on the screen. </P>



<P>$first = shift;</P>

<P>$second = shift;</P>

<P>print $first + $second;</P>



<P>Output:</P>



<P>C:\perl&gt;perl filename.pl 3 5</P>

<P>8</P>



<B><P>Input Output</P>

</B>

<P>Until Now we know of only two kinds of data types-: Scalars and Arrays. Well in this chapter, we will learn about a new third kind of data type called Filehandles. These filehandles act as a bridge between the Perl Program and other files, directories or other programs.</P>



<P>In fact, we have already come across file handles in the earlier chapters, without even noticing it. Remember that we used the angle brackets &lt; &gt;, for two purposes: to read files and to get User Input. Now in both the cases, the angle brackets automatically without you knowing of it, opened a filehandle.</P>

<P>The Standard Perl filehandles are-:</P>



<P>&nbsp;</P>

<P>STDIN&#9;&#9;Standard Input&#9;&#9;Used to Get User Input</P>

<P>STDOUT             Standard Output&#9;&#9;The Program output, which is usually displayed on the screen.</P>

<P>STDERR             Standard Error&#9;&#9;Error Messages to be displayed on the Screen</P>



<P>Just like STDIN is used to get User Input and  ARGV is used to read command line data. All this might seem a bit confusing, but believe me, it really is not. Read on to understand better.</P>



<P>Say you give a command like:</P>



<P>$varname= &lt; &gt;;</P>



<P>then PERL automatically fills the angle brackets with either STDIN or ARGV. But how does PERL decide which handle should be inserted? Good Question. You see, whenever PERL comes across angle brackets, it checks to see whether there is still data left to be read from the command line files. If there is data left, then the angle brackets behaves as &lt;ARGV&gt; else they behave as &lt;STDIN&gt;.</P>



<P>We can also manually differentiate between the two by mentioning either one of them within the angle brackets. So basically we can say that the code &lt;FILE&gt; will read data from FILE.</P>



<B><P>Opening Files For Reading</P>

</B>

<P>Well now that you know what file handles do, lets learn how to open a text file to read it's data and print this read data on the screen. The following code does just that-:</P>



<P>open(SITES, "sitelist.txt");  # Open sitelist.txt and name the connection SITES</P>

<P>while (&lt;SITES&gt;) {</P>

<P>print;                        # Read the next line from SITES and print it on the screen</P>

<P>}</P>



<P>Now let's analyze each line of the code snippet. In the first line, we use the open ( ) function (discussed in detail later) to open the file sitelist.txt and give the connection a friendly name of our choice, in this case we name the connection SITES. We can give it any name of our choice, even something like your own name or simply 'a'.</P>

<P>The second line is the same as </P>



<P>while($_= &lt;SITES&gt;);</P>

<P><BR>

We are simply making better, more efficient scripts. It basically reads the next line of sitelist.txt using the opened connection, SITES. This line is then assigned to the default variable $_ , which is finally printed by the third line. Perl reads one by one each line of the file opened.</P>



<P>Now let's say if the file sitelist.txt does not exist, then normally PERL displays a cryptic difficult to understand error message which is of no use to a novice to deduce what went wrong. How can we display our own customised error messages instead of using the cryptic PERL error messages? Well the die ( ) function holds the key.</P>



<P>The basic syntax of the command is-:</P>



<P>&nbsp;</P>

<P>die(STRING): This code exits the program with the current value of the special variable $! (Discussed Later) and prints STRING on the screen.</P>



<P>Now let's take an example to see how we can use the die( ) function effectively.</P>

<P>Consider the following snippet of code-:</P>



<P>open (FILE123, "first.txt") | |  die "File Not Found";</P>

<P>while (&lt;FILE123&gt;) {</P>

<P>print;</P>

<P>}</P>



<P>The above program attempts to open the first.txt text file and if it cannot do so for some reason, it displays the cutomised error message, File Not Found on the screen.</P>



<P>Another Special Variable: $!</P>



<P>Earlier I had mentioned a new kind of special variable, the $! Variable. </P>



<P>The $! Or $ERRORNO or $OS_ERROR Variable contains the system error code. In Numeric context ($!) it contains the error number and in character context ($ERRORNO or $OS_ERROR) it contains the error message.</P>



<P>For Example,</P>



<P>print $!;   #Prints current Error Number</P>

<P>print $ERRORNO;  #Prints Error Message associated with the current Error Number</P>



<P>The Error Number to Error Message table is as follows:</P>



<P>&nbsp;</P>

<OL>



<LI>Not Owner</LI>

<LI>No Such File or Directory</LI></OL>



<OL START=5>



<LI>                      Input/Output Error</LI></OL>



<OL START=13>



<LI>                      Permission Denied</LI></OL>



<OL START=17>



<LI>                      File Exits</LI></OL>



<OL START=28>



<LI>                      No Space Left on Drive</LI></OL>





<P>This variable is normally is used in the following context;</P>



<P>Open(FILE123, "xyz.doc") || die "File Not Found: $!"</P>



<P>Will display something like the following error message if the file xyz.doc does not exist:</P>



<P>File Not Found: 2</P>



<P>Sometimes, when an error occurs, instead of exiting entirely from the program we might need to display only a Warning Message advising the user what to do next as an error has occurred. This is where the warn ( ) function comes in. This function too works like the die ( ) function the only difference being that the program is not exited.</P>

<P>For Example,</P>



<P>warn("Caution!! System Resource Low. Please Close some programs before continuing");</P>



<P>&nbsp;</P>

<P>Till now we have learnt only how to read from a file, now let抯 learn how to write or even append to a file. Again we make use of the lovely function open( ). Its basic syntax is as follows-:</P>



<P>open(FILEHANDLE, FILENAME): Opens the file FILENAME and gives the connection the name, FILEHANDLE.</P>



<P>If the open ( ) function is successful it return the TRUE value else it return UNDEF.</P>



<P>Whether a file has been opened for only reading, only writing, appending, or both writing and reading depends on the character at the beginning or preceding FILENAME.</P>



<P>If  FILENAME begins with &lt; (or nothing) the file is opened for Reading only.</P>

<P>If  FILENAME begins with &gt; then the file is opened for Writing only.</P>

<P>If  FILENAME begins with &gt;&gt; then the file is opened for appending.</P>

<P>If  FILENAME begins with +(i.e. +&gt;, &lt;+ or +&gt;&gt;) then the file is opened for reading and    </P>

<P>   &#9;&#9;&#9;&#9;&#9;&#9; writing(appending).</P>

<P>If  FILENAME is  - then STDIN is opened</P>

<P>If  FILENAME is &gt;- then STDOUT is opened</P>



<P>The following are some Practical examples, that will make you understand the various characters better-:</P>



<P>open(FILE, "&gt;&gt;$filename") or die" File not Found";    #File opened for Appending</P>



<P>open(FILE, "+&lt;$filename") or die" File not Found";    #File opened for both reading and writing.</P>



<P>open(FILE, "+&gt;$filename") or die" File not Found";   #File opened for both reading and writing</P>



<P>open(FILE, "&gt;$filename") or die" File not Found";     #File opened for writing.</P>



<P>NOTE: When you try to open a file with the &gt; character then  PERL checks to see if the file by the specified filename exists or not. If yes then the File is overwritten else a new file by the specified filename is created.</P>



<P>The close( ) function is used to close a file connection using the open ( ) function. The basic syntax of the close( ) function is as follows:</P>



<P>Close(FILEHANDLE);</P>



<P>Examples:</P>



<P>print "USERNAME:";</P>

<P>chomp ($user= &lt; &gt;);</P>

<P>print "Password:";</P>

<P>chomp($pass= &lt; &gt;);</P>

<P>open(LOGFILE, "&gt;&gt;log.txt") or die " Please Re Login";</P>

<P>close(LOGFILE);</P>



<P>The above code simply logs or appends the Usernames and Passwords typed by the User to a log file, log.txt and then finally closes the File Handle associated with it.</P>



<P>The following PERL program logs all keystrokes of the User until he types EXIT\n.</P>



<P>While(10) {</P>

<P>$input = &lt;&gt;;     #Infinite Loop</P>

<P>last if $input eq "exit\n";         #Exit loop when User types Exit followed by Enter.</P>

<P>open(FILE, "&gt;&gt;xyz.txt");</P>

<P>print FILE $input;               # Print data typed by User in the file xyz.txt</P>

<P>}</P>

<P>close FILE;</P>



<B><P>MOVING AROUND IN A FILE</P>

</B>

<P>Now that we know how to open a file for various purposes, how can we move around within a file and how can we tell where you are?</P>



<P>You see, whenever a file handle is used, it has an associated file pointer. When we open a file, the file pointer by default points to 0. This file pointer changes automatically accordingly as we move or read data from the file using the filehandle. This process is automatic and occurs without any User intervention.</P>

<P>But sometimes, we manually want to change the position of the file pointer and make it point elsewhere. This is when the seek( ) and tell( ) functions come into the picture.</P>



<B><P>seek( )</P>

</B>

<P>Basic Syntax of the seek command is:</P>



<P>seek(FILEHANDLE, STEPS, FROM); :Moves the file pointer of the FILEHANDLE to number of STEPS from FROM.</P>



<P>Note: File Positions are measured in Bytes.</P>



<P>The value of FROM can be 0 for the beginning of the file, 1 for the current position and 2 for the end of the file.</P>



<P>The following example will really make you comfortable using the seek( ) command:</P>



<P>seek(FILE, 0, 0);      # moves to beginning of file</P>



<P>seek(FILE, 157,0);   #moves to 157 bytes from the beginning of the file.</P>



<P>seek(FILE,45,1);      #moves 45 bytes ahead.</P>



<P>seek(FILE, -45,1);   #moves 25 bytes behind.</P>



<P>seek(FILE,200,2);   #moves 200 bytes from the End of File.(EOF)</P>



<P>I hope by know you would probably know the seek( ) command like the back of your hand.</P>



<B><P>tell( )</P>

</B>

<P>The tell() command returns the current position of the file pointer.</P>

<P>For Example, </P>

<P>         </P>

<P>print tell(FILE);</P>



<P>prints the current position of the file pointer.</P>



<B><P>Truncating Files</P>

</B>

<P>The truncate( ) function is used to truncate or shorten  a file to the specified number of bytes. Its basic syntax is:</P>



<P>truncate(FILE, NUM); :Shortens the FILE to NUM number of bytes.</P>



<P>For Example,</P>



<P>truncate("xyz.txt", 100); #Shortens xyz.txt to 100 bytes.</P>



<P>The same above result can also be achieved by the following lines of code:</P>



<P>open(FILE, "+&lt;xyz.txt);</P>

<P>truncate(FILE, 100);</P>



<B><P>Deleting Files</P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜臀99久久精品久久久久久软件| 视频一区二区三区在线| 2023国产一二三区日本精品2022| 欧美丰满高潮xxxx喷水动漫| 欧美日韩精品一区二区三区四区| 欧美精品粉嫩高潮一区二区| 欧美精品久久99久久在免费线| 666欧美在线视频| 日韩免费观看高清完整版| 日韩欧美一二三四区| 精品国产sm最大网站| 国产亚洲欧美激情| 国产精品久久久久久一区二区三区| 中文字幕亚洲成人| 一区二区激情视频| 日韩和欧美一区二区| 韩国视频一区二区| 高清免费成人av| 色av成人天堂桃色av| 69堂成人精品免费视频| 一区二区免费在线| 奇米色一区二区三区四区| 国内精品视频一区二区三区八戒| 国产精品1区2区3区在线观看| 成人毛片在线观看| 在线观看区一区二| 久久久久国产精品人| 亚洲精品水蜜桃| 久久99精品国产91久久来源| 99国产精品久久久| 555夜色666亚洲国产免| 久久久久久久综合| 一区二区三区不卡在线观看| 极品少妇xxxx精品少妇| 色婷婷久久综合| 日韩一区二区在线看片| 国产精品久久久久永久免费观看 | 日韩欧美一二三| 中文字幕在线不卡视频| 日韩福利视频网| 成人av高清在线| 亚洲精品一区二区在线观看| 樱花草国产18久久久久| 国产精品伊人色| 欧美欧美欧美欧美首页| 国产精品久久久一本精品| 精品午夜一区二区三区在线观看| 91丨porny丨户外露出| 久久综合久久综合久久| 日韩经典中文字幕一区| 色综合久久综合网欧美综合网| 久久精品日韩一区二区三区| 欧美96一区二区免费视频| 91精品福利视频| 日韩美女视频一区二区 | 亚洲一卡二卡三卡四卡无卡久久| 国产一区二区三区高清播放| 69精品人人人人| 亚洲超碰精品一区二区| 91黄视频在线观看| 亚洲欧美日韩在线| 99久久国产综合色|国产精品| 久久精品视频一区| 国产一区二区调教| 欧美变态凌虐bdsm| 美腿丝袜亚洲色图| 日韩欧美在线不卡| 麻豆成人在线观看| 日韩一区二区三区电影在线观看| 偷拍一区二区三区| 欧美蜜桃一区二区三区| 丝袜亚洲另类欧美综合| 欧美精品日韩精品| 免费人成在线不卡| 日韩精品一区二区三区老鸭窝| 蜜臀av在线播放一区二区三区| 69堂成人精品免费视频| 日韩高清不卡一区| 欧美一级国产精品| 久久99最新地址| 久久久精品天堂| 国产91综合网| 亚洲日本在线看| 337p粉嫩大胆噜噜噜噜噜91av| 另类小说图片综合网| 精品久久99ma| 国产大陆a不卡| 国产精品久久久久久亚洲伦 | 精品少妇一区二区三区视频免付费| 亚洲影视在线播放| 欧美午夜影院一区| 亚洲成av人片在线| 精品剧情v国产在线观看在线| 国产精品白丝jk白祙喷水网站| 久久久久国产精品厨房| 成人黄色网址在线观看| 亚洲综合偷拍欧美一区色| 欧美年轻男男videosbes| 国产一区二区三区久久悠悠色av| 中文字幕av在线一区二区三区| 97精品国产露脸对白| 日本不卡一二三区黄网| 国产午夜精品理论片a级大结局| 99久久er热在这里只有精品15 | 夜夜爽夜夜爽精品视频| 91 com成人网| 国产精品1区2区| 亚洲免费视频成人| 日韩欧美一区二区免费| 粉嫩13p一区二区三区| 亚洲国产精品久久一线不卡| 久久在线观看免费| 欧美群妇大交群中文字幕| 国产成人福利片| 日韩和欧美的一区| 亚洲免费色视频| 国产日韩欧美综合在线| 欧美一区二区黄色| 欧美在线播放高清精品| 国产69精品一区二区亚洲孕妇| 日韩综合小视频| 亚洲精品免费在线观看| 国产亚洲自拍一区| 精品毛片乱码1区2区3区| 在线观看亚洲a| k8久久久一区二区三区| 国产一区二区三区香蕉| 婷婷国产在线综合| 一区二区三区在线观看网站| 国产天堂亚洲国产碰碰| 日韩欧美国产一二三区| 在线精品视频一区二区| 91丨porny丨中文| 成人毛片在线观看| 国产精品99久久久久久久女警| 日韩二区三区在线观看| 午夜天堂影视香蕉久久| 一区二区三区 在线观看视频 | 欧美色老头old∨ideo| 成人网页在线观看| 国产成人综合亚洲91猫咪| 九九九久久久精品| 久久se这里有精品| 六月丁香综合在线视频| 美女视频黄 久久| 日本不卡视频在线观看| 蜜臀av一区二区在线观看| 奇米777欧美一区二区| 免费不卡在线视频| 美女在线视频一区| 极品尤物av久久免费看| 九九九精品视频| 久久99精品久久久久久久久久久久 | 国产伦精品一区二区三区视频青涩 | 久久久精品黄色| 久久精品一区二区三区av| 久久午夜色播影院免费高清 | 亚洲理论在线观看| 亚洲欧美日韩国产另类专区| 一区二区三区四区亚洲| 香蕉久久一区二区不卡无毒影院| 午夜日韩在线观看| 乱一区二区av| 国产精品综合av一区二区国产馆| 国产福利91精品| a4yy欧美一区二区三区| 欧美在线看片a免费观看| 欧美日本一道本| 日韩欧美色电影| 国产精品久久久久永久免费观看| 亚洲免费在线播放| 日精品一区二区三区| 国产精品一区二区在线观看网站| 不卡的av电影| 日本二三区不卡| 精品国内片67194| 亚洲欧美激情在线| 日本亚洲最大的色成网站www| 精品一区二区在线免费观看| 成人性生交大合| 欧美日韩国产免费一区二区 | 亚洲欧洲制服丝袜| 性欧美疯狂xxxxbbbb| 国精品**一区二区三区在线蜜桃| 粉嫩13p一区二区三区| 欧美日韩日日摸| 久久精品夜夜夜夜久久| 亚洲三级在线免费| 国产伦精品一区二区三区免费| 91蝌蚪国产九色| 久久嫩草精品久久久久| 亚洲精品国产无套在线观| 精品一区二区在线视频| 91污在线观看| 欧美成人r级一区二区三区| 亚洲黄网站在线观看| 国产一区二区三区免费播放| 欧美剧情电影在线观看完整版免费励志电影| 欧美变态口味重另类| 亚洲最新视频在线播放|