[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Fun with ++



Having some fun in 5.004_04.  Do you know without trying it what this does:

use strict;
use Data::Dumper;
my %h;
@h{qw/1 2 3/}++;
print Dumper (\%h), "\n";

Now if you understand the answer, what should the result of this be:

use strict;
use Data::Dumper;
my @a;
@a[qw/1 2 3/]++;
print Dumper(\@a), "\n";

Hint: there's a bit more output.  Why?

--
Peter Scott
Pacific Systems Design Technologies


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe