zhumao

新手上路

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

随笔分类 -  Perl

最近发现Perl的东西发了很多,整理一下吧,放在一下比较容易找
摘要:#!/usr/bin/perl use strict;use JSON::Any;use XML::Simple; my $json = '{"name":"zhumao","pass":"123","other":[{"a0":"a0a0a0","b0":"b0b0b0"},{"a1":"a1a1 阅读全文
posted @ 2018-10-02 18:52 zhumao-2 阅读(339) 评论(0) 推荐(0)

摘要:未︶︵︶知() 09:30:12use DBI; 19 my $dsn = "DBI:mysql:database=statistic;host=localhost;mysql_socket=/data/db/mysql/mysql.sock"; 20 my $db_user = "statistic"; 21 my $db_pass = "statistic"; 22 my $dbh = DBI... 阅读全文
posted @ 2006-03-16 09:49 zhumao-2 阅读(1064) 评论(0) 推荐(0)

摘要:#!/usr/bin/perl## create a MARC::Record object.use MARC::Record;my $record = MARC::Record->new();## add the leader to the record. optional.$record->leader('00903pam 2200265 a 4500');## create an... 阅读全文
posted @ 2005-08-11 22:06 zhumao-2 阅读(588) 评论(0) 推荐(0)

摘要:sub trim{ my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string;} 阅读全文
posted @ 2005-08-11 13:59 zhumao-2 阅读(4348) 评论(0) 推荐(0)

摘要:在 Perl 中使用内联 嵌入非 Perl 代码时不必再有使用 XS 的烦恼 Michael RobertsOwner, Vivtek2001 年 6 月 新的 Perl 内联模块允许您使用其他语言编写代码(如C、Python、Tcl 或 Java),并将其随意地放进 Perl 脚本中。不像以前将C 语言代码与 Perl进行连接的方法那样,内联的使用将非常简... 阅读全文
posted @ 2005-08-09 21:59 zhumao-2 阅读(619) 评论(0) 推荐(0)

摘要:perl中的特殊内置变量(转) 学习perl中的基础。 先来一个例子吧#!/usr/bin/perluse warnings;@array = qw(a b c d);foreach (@array) {print $_,"\n";}例子的作用就是定义一个数组并把其中的元素打印出来,这里需要注意的是foreach循环部分,foreach循环的标准格式应该是:foreach $elemen... 阅读全文
posted @ 2005-08-09 21:46 zhumao-2 阅读(446) 评论(0) 推荐(0)

摘要:从网页中提取链接 以下是HTML::LinkExtor中的一个提取图片链接的例程#!/usr/bin/perl -wuse LWP::UserAgent;use HTML::LinkExtor;use URI::URL;$url = "http://www.163.com/"; # for instance$ua = LWP::UserAgent->new;# Set up a call... 阅读全文
posted @ 2005-08-09 21:44 zhumao-2 阅读(2480) 评论(0) 推荐(0)

摘要:#!/usr/bin/perl -w printf"write the path you want to search files:"; $searchdir=; chomp $searchdir; printf "Input search string:"; $searchstr=; chomp $searchstr; opendir(DIRHANDLE,$searchdir) || die "... 阅读全文
posted @ 2005-08-09 21:42 zhumao-2 阅读(1199) 评论(1) 推荐(0)

摘要:#!/usr/bin/perl -w ####################################################################### Example of how to use the Spreadsheet::WriteExcel module to create ## an Excel binary file. ... 阅读全文
posted @ 2005-07-27 09:50 zhumao-2 阅读(767) 评论(0) 推荐(0)

摘要:我的评价: 本书是perl的经典入门书籍,介绍了perl中最基本的概念和语法,是perl入门的好书,我 向所有想了解或学习perl语言的朋友推荐本书。书中穿插有perl语法形成的历史和原因, 使你能充分感受到perl语言的文化,这也是perl流行的原动力。本书行文流畅,各知识点 介绍到位,令人很容易明白,达到入门点睛的效果。但本书的作用也就是入门而已,目的很 明确,它没有深入到perl脚本语言的高... 阅读全文
posted @ 2005-07-20 18:35 zhumao-2 阅读(1365) 评论(0) 推荐(0)

摘要:#!/usr/local/bin/perl print "content-type: text/html\n\n";use CGI;use MIME::QuotedPrint;use HTML::Entities;use Mail::Sendmail; $req = new CGI;#new version#print $req->param("action");#print $req->para... 阅读全文
posted @ 2005-07-19 11:40 zhumao-2 阅读(592) 评论(1) 推荐(0)

摘要:sub delhtml{ my($str) = @_; my($s_pos) = 0; my($e_pos) = 0; loop: if(index($str,'',$s_pos); if($s_pos > 0) { $str = sub... 阅读全文
posted @ 2005-06-25 19:41 zhumao-2 阅读(1333) 评论(3) 推荐(0)