Advertisement
cwchen

[Perl 6] Deleting key/value pairs from a hash.

Oct 28th, 2017
883
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.20 KB | None | 0 0
  1. my %hash = one => "eins", two => "zwei", three => "drei";
  2.  
  3. %hash.keys.elems == 3 or die "Wrong count";
  4.  
  5. # Delete one key-value pair.
  6. %hash<three>:delete;
  7.  
  8. %hash.keys.elems == 2 or die "Wrong count";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement