Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Mention :delete and :exists on hashes in 5to6
  • Loading branch information
Paul Cochrane committed Feb 24, 2015
1 parent 5b60067 commit 77d2a9c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Language/5to6.pod
Expand Up @@ -208,6 +208,23 @@ I<Key/value-slicing an array variable>
say join ',', @months[6, 8..11]:kv; # Perl 6 - % becomes @; slice controlled by adverb
=end item
Some functions for manipulating hashes and querying hash values have been
turned into adverbs:
=begin item
I<Checking for element existence in a hash>
say "element exists" if exists $hash{$key}; # Perl 5
say "element exists" if %hash{$key}:exists; # Perl 6 - exists controlled by adverb
=end item
=begin item
I<Deleting an element in a hash>
my $deleted_value = delete $hash{$key}; # Perl 5
my $deleted_value = %hash{$key}:delete; # Perl 6 - delete controlled by adverb
=end item
=head4 C<&> Sub
In Perl 6, the C<&> sigil is used consistently (and without the help of
Expand Down

2 comments on commit 77d2a9c

@smls
Copy link
Contributor

@smls smls commented on 77d2a9c Feb 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's the right place to mention those things.
That section is specifically for the hash sigil (or rather, for features which used that sigil in Perl 5) - not for everything involving hashes.

@paultcochrane
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're quite right. That was silly of me. I've added a new section called "Data Structures" which can be used to house information about Perl 6 data structures. This should be a better fit for the information I wanted to make note of.

Please sign in to comment.