Recently in Perl Category

Perl Module 的编写

| | Comments (0) | TrackBacks (0)
package YourModule; 
# gives you Exporter's import() method directly
use Exporter 'import'; 
@EXPORT_OK = qw(munge frobnicate);
@EXPORT = qw(sth);

@EXPORT_OK 中声明的函数需要在use YourModule后加入qw//来申请进入全局。而@EXPORT 中声明的函数是默认就进入全局的。

s/\$NICK(?<!\\\$NICK)/$nick/g; 

将文本中$NICK替换为变量$nick, 当且仅当$前不是\. "hello, $NICK"可以被替换, 而"using \$NICK" 在中的$NICK则不会被替换掉.

声援SOFF|声援珊瑚虫:如果你是珊瑚虫用户,请坚决力挺声援珊瑚虫!

Archives