当我们存储少量数据的时候,我们不必使用数据库,那样有点杀鸡焉用牛刀的感觉。
perl中的dbm就是一种存储较小数据的方式。其实他就是一个hash。在使用的时候,也是按照hash的操作方式。极为轻便,简单。为我们保存较小数据提供了一种方式。
底下是一个例子。
如下是使用方式,运行结果:
Your question ('quit' to quit): 1 is name
Ok, I' will remember "1" as "name"
Your question ('quit' to quit): 2 is id
Ok, I' will remember "2" as "id"
Your question ('quit' to quit): 3 is address
Ok, I' will remember "3" as "address"
Your question ('quit' to quit): 1?
1 is name
Your question ('quit' to quit): 2?
2 is id
Your question ('quit' to quit): 3?
3 is address
Your question ('quit' to quit): like /d?
1 is like /d
2 is like /d
3 is like /d
Your question ('quit' to quit): quit