in reply to Re: Check if string A and B are made up of same chars
in thread Check if string A and B are made up of same chars

The uniq is not really needed there because Set::Scalar itself will discard any duplicates.

Replies are listed 'Best First'.
Re^3: Check if string A and B are made up of same chars
by karlgoethebier (Abbot) on Nov 18, 2024 at 16:19 UTC

    Yes, thanks. I had to convince myself again - it's been a long time since I last used it.

    my $s_1 = Set::Scalar->new(split//, "abc"); my $s_2 = Set::Scalar->new(split//, "aaaaaabc"); dd $s_1; dd $s_2; __END__ do { my $a = bless({ elements => { a => "a", b => "b", c => "c" }, universe => bless({ elements => { a => "a", b => "b", c => "c" }, null => bless({ universe => 'fix' }, "Set::Scalar::N +ull"), universe => undef, }, "Set::Scalar::Universe"), }, "Set::Scalar"); $a->{universe}{null}{universe} = $a->{universe}; $a; } do { my $a = bless({ elements => { a => "a", b => "b", c => "c" }, universe => bless({ elements => { a => "a", b => "b", c => "c" }, null => bless({ universe => 'fix' }, "Set::Scalar::N +ull"), universe => undef, }, "Set::Scalar::Universe"), }, "Set::Scalar"); $a->{universe}{null}{universe} = $a->{universe}; $a; }