7 tie
my %h, "BerkeleyDB::Hash", -Filename
=> '_fruit.db', -Flags
=> DB_CREATE
|| die "Cannot open DB!\n";
8 #tie my %h, "Tie::Hash::DBD", "dbi:SQLite:dbname=_sqlite.db";
10 # Add a few key/value pairs to the file
12 #$h{"banana"} = "yellow";
13 $h{"orange"} = "orange";
18 #$h{"test"} = to_json({"from" => "to", "lol" => "rofl"});
19 print $h{"test"}."\n";
20 print Dumper
(from_json
($h{"test"}))."\n";
23 # Check for existence of a key
24 print "Banana Exists\n\n" if $h{"banana"};
26 # Delete a key/value pair.
29 # print the contents of the file
30 while (my ($k, $v) = each %h) { print "$k -> $v\n" }
This page took 0.299072 seconds and 4 git commands to generate.