cwchen icon

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

cwchen | PRO | 10/28/17 11:23:07 PM UTC | 0 ⭐ | 8582 👁️ | Never ⏰ | []
Perl 6 |

0 B

|

None

|

0 👍

/

0 👎

my %hash = one => "eins", two => "zwei", three => "drei";
 
%hash.keys.elems == 3 or die "Wrong count";
 
# Delete one key-value pair.
%hash<three>:delete;
 
%hash.keys.elems == 2 or die "Wrong count";

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎