Guest User

Untitled

a guest
Mar 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5. use feature 'say';
  6. use Storable;
  7.  
  8. my $hashref;
  9. my $hash_file = 'hashfile';
  10.  
  11. if (-e $hash_file) {
  12. $hashref = retrieve($hash_file);
  13. } else {
  14. $hashref = {};
  15. }
  16.  
  17. if (@ARGV == 2) {
  18. my ($newkey, $newval) = @ARGV;
  19. $hashref->{$newkey} = $newval;
  20. }
  21.  
  22. say "$_ -> $hashref->{$_}" for sort keys %$hashref;
  23.  
  24. store $hashref, $hash_file;
Add Comment
Please, Sign In to add comment