From:

Date:

June 28, 2015 09:11Subject:

Re: scalar sort $scalarMessage ID:

20150628111047.6037ae0b@pc09.procura.nlOn Sun, 28 Jun 2015 09:56:21 +0100, Zefram <zefram@fysh.org> wrote: > H.Merijn Brand wrote: > >That could easily be transformed into producing > >$ perl -wE'say scalar sort "bdca"' > >abcd > > YAGNI. Oh, but I did, which is why I wondered Someone needed a selection for all possible combinations (permutations) of letters in a sequence of letters, so I ended up with this instead my $alt = join "" => sort split m// => $code; to map all possible combinations into a single alt code and use that in a hash. Works great. The code did not need *all* possible permutations, just look at all existing permutations in a reference table. my %ref = ( acb => 1, axf => 3, bca => 2, cab => 3, cde => 2, fxa => 0, ); I get the code "abc" and want to visit all entries in the hash where the letter combination is the same, regardless the order. I revamped the hash to add an extra layer my %ref = ( abc => { acb => 1, bca => 2, cab => 3, }, afx => { axf => 3, fxa => 0, }, cde => { cde => 2, }, ); see the need? > -zefram -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.21 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/Thread Previous | Thread Next

- scalar sort $scalar by H.Merijn Brand
- Re: scalar sort $scalar by Ed Avis
- Re: scalar sort $scalar by Zefram
- Re: scalar sort $scalar by Abigail
- Re: scalar sort $scalar by Ed Avis
- Re: scalar sort $scalar by David Nicol
- Re: scalar sort $scalar by Ed Avis
- Re: scalar sort $scalar by David Nicol
- Re: scalar sort $scalar by Ed Avis
- Re: scalar sort $scalar by Zefram
- Re: scalar sort $scalar by Eric Brine
- Re: scalar sort $scalar by Zefram
**Re: scalar sort $scalar**by H.Merijn Brand- Re: scalar sort $scalar by Zefram
- Re: scalar sort $scalar by John Imrie
- Re: scalar sort $scalar by Shlomi Fish

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About