Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature 'say';
- use Storable;
- my $hashref;
- my $hash_file = 'hashfile';
- if (-e $hash_file) {
- $hashref = retrieve($hash_file);
- } else {
- $hashref = {};
- }
- if (@ARGV == 2) {
- my ($newkey, $newval) = @ARGV;
- $hashref->{$newkey} = $newval;
- }
- say "$_ -> $hashref->{$_}" for sort keys %$hashref;
- store $hashref, $hash_file;
Add Comment
Please, Sign In to add comment