摘要: 1. tr 转换 转换不是替换(tr///==y///)tr/searchlist/replacementlist/用于查找某个一个字符串,并用replacementlist替换,可以使用正则表达式my $str="this Is A teST";$str=~tr/a-z/A-Z/; 把小写转换为大写 会输出THIS IS A TESTs/// optionsg 全局替换i 忽略大小写my $str3="this is a test\n";$str3=~s/t/haha/g; =====>hahahis is a hahaeshahaprint $ 阅读全文
posted @ 2013-06-17 23:57 to be crazy 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 1.使用system函数 运行成功,返回0,运行失败则返回非负整数system("cmd");2.使用qxmy $cmd1=qx/date/;3.使用`` 与qx等效4.使用open函数open(CMD,“ifconfig |”) or die $!my @result=;close(CMD);5.使用readpipe函数使用readpipe函数可以获取外部程序运行的结果,比如运行 ls 会列出当前目录的文件和文件夹,my $result=readpipe("ls ");#!/usr/bin/perluse strict;my $return=syste 阅读全文
posted @ 2013-06-17 21:23 to be crazy 阅读(1572) 评论(0) 推荐(0) 编辑