1. DB_File这个model可以将一个hash table 存储到硬盘上。
write.pl
#!/usr/bin/perl
use strict;
use warnings;
use DB_File;
my %hash;
tie(%hash,"DB_File","test.db") or die "$!\n";
$hash{"key"}="Hello World!";
read.pl
#!/usr/bin/perl
use strict;
use warnings;
use DB_File;
my %hash;
tie(%hash,"DB_File","test.db") or die "$!\n";
print "$hash{'key'}\n";
Run
perl write.pl
perl read.pl
> Hello World!
2. Smart::Comments
打印注释的功能在调试程序时十分有用,在扶凯的blog中发现 :) 注释掉use Smart::Comments;后,所有的 ### 注释变身普通注释。
#!/usr/bin/perl
use Smart::Comments;
for(1..3){### For loop
print "num: $_n";
print "testn";
}
https://blog.sciencenet.cn/blog-395566-584622.html
上一篇:
学习笔记:几个有用的perl的模块