Philip Potter wrote:
> 1. Is there a "set" type which holds aggregate data and doesn't care
> about order, which I could use to compare these results for equality?
You can use a hash as a set or a bag.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
# Make Data::Dumper pretty
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent = 1;
# Set maximum depth for Data::Dumper, zero means unlimited
$Data::Dumper::Maxdepth = 0;
my @a = qw( a b c x y z a b );
my %set = map { $_ => 1 } @a;
print '%set : ', Dumper \%set;
my %bag = ();
$bag{$_} ++ for @a;
print '%bag : ', Dumper \%bag;
__END__
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/