韩半仙

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理

2012年3月11日

摘要: understanding blocks and streamsthere are two ways to look at files-blocks of data-stream a block of data simply a chunk of the file that can be written or read in one operation.a stream is data that may come as a series of bytes- keystrokes from a user- data sent over a network connection handles.p 阅读全文
posted @ 2012-03-11 16:16 韩英武 阅读(535) 评论(0) 推荐(0)

2012年3月10日

摘要: a reference is a variable that refer to a value- as opposed to a variable that contains a valueexample.pl#!/usr/bin/perl#usestrict;usewarnings;main(@ARGV);submain{my$var="ThisisthePerl5referenceschapter.";my$ref=\$var;my$copy=$ref;message($$ref);$var=42;message($$copy);}submessage{my$m=shi 阅读全文
posted @ 2012-03-10 21:31 韩英武 阅读(233) 评论(0) 推荐(0)

摘要: understanding subroutinessubroutines(sometimes called "functions") are a means of encapsulating code.subroutines are reusable. subroutines can hide complexity.subroutines can call other subroutines.subroutines can call themselves.this is called "recursion"http://www.cnblogs.com/h 阅读全文
posted @ 2012-03-10 13:23 韩英武 阅读(333) 评论(0) 推荐(0)

2012年3月5日

摘要: Regular expressions is a very powerful method of matching patterns in text there are often called "regex" or the plural "regexes".they are used within other languages, like Perlcommonly used for search-and-replace operationsregexes can be very simple or very complexthe regex expr 阅读全文
posted @ 2012-03-05 00:51 韩英武 阅读(320) 评论(0) 推荐(0)

2012年3月4日

摘要: 数值的比较运算符:+, -, *, /, ++, --;arithemetic.pl#!/usr/bin/perluse strict;use warnings;main(@ARGV);sub main{ my $n=42 + 12;# repeat with - * / message("The number is: " . $n); my $n =42; #$n++; #$n--; #++$n; message("The number is: " . $n++); message("The number is: " . ++$n) 阅读全文
posted @ 2012-03-04 19:18 韩英武 阅读(398) 评论(0) 推荐(0)

2012年2月26日

摘要: perl uses special variable for a number of purpose.default value for function and loopserror codes and messagesinformation about the system and its enviromentover 70 special variables full list in perl documentation page "perlvar"$_ Default input$1, $2, $3, etc Pattern results$! ... 阅读全文
posted @ 2012-02-26 11:36 韩英武 阅读(367) 评论(0) 推荐(0)

2012年2月21日

摘要: http://docstore.mik.ua/orelly/ 阅读全文
posted @ 2012-02-21 02:34 韩英武 阅读(404) 评论(0) 推荐(0)

摘要: 原文来自007_008在http://club.topsage.com/thread-2386780-1-1.html的帖子概述交互式程序通常需要用户手动完成一些操作,因此常常会成为系统管理自动化和测试自动化中的障碍。最早出现在 Unix 上的 Expect 语言可以用来和 passwd/ssh/telnet/ftp 等命令行程序进行交互,将用户从这些手工操作中解放出来。作为 Tcl 语言的扩展,Expect 最初由 Tcl 编写,但是现在已经有了 Perl 和 Python 的实现。Perl 作为最为流行的脚本语言之一,整合了 C/sh/sed/awk 的优点且和系统结合紧密,已成为系统管理 阅读全文
posted @ 2012-02-21 02:25 韩英武 阅读(1052) 评论(0) 推荐(0)

2012年2月19日

摘要: loops are used for repeating codeeg: while(condition){ statement1; statement2;}perl provide two basic types of loopswhile/until loopsfor/foreach loopswhile.pl#!/usr/bin/perluse strict;use warnings;main(@ARGV);sub main{ open(FH, "linesfile.txt"); while(my $line = <FH>){# message(" 阅读全文
posted @ 2012-02-19 20:18 韩英武 阅读(389) 评论(0) 推荐(0)

摘要: 本章节实在是简单的不想写,太多雷同的部分了。understanding conditional statements1. conditional execute code selectivelyif(condition){ statements)2. conditionals my provide alternative codeif (condition){ statement_1}else{ statement_2}beginning with version 5.10, perl also provides a switch statement -use given ... 阅读全文
posted @ 2012-02-19 19:25 韩英武 阅读(291) 评论(0) 推荐(0)