It's very interesting to see various ways of thinking and there is a lot to learn for me.

I thought SQL's cross join will give you what you want. In real world, sometimes values comes from database and if you use cross join in such case, it is very handy.

#!/usr/bin/perl use strict; use warnings; use DBI; my($dbh,$testdb); $testdb='wnjpn.db';#SQLite database path $dbh=DBI->connect("dbi:SQLite:$testdb","","", {AutoCommit=>0,RaiseErro +r=>0}); #populate table while(<DATA>){ $dbh->do($_) or print DBI->errstr; } $dbh->commit; #print with natural join my $r=$dbh->selectall_arrayref( qq( select test_c.v || '-' ||test_s.v || '-' ||test_num.v as v from test_c cross join test_s cross join test_num; )) or die DBI->errstr; #),{ Slice => {} }) or die DBI->errstr; use Data::Dumper; print Dumper $r; $dbh->disconnect; __DATA__ drop table test_c; drop table test_s; drop table test_num; create table test_s ( v text primary key); create table test_c ( v text primary key); create table test_num ( v text primary key); insert into test_c values ( 'red'); insert into test_c values ( 'blue'); insert into test_s values ( 'small'); insert into test_s values ( 'medium'); insert into test_s values ( 'large'); insert into test_num values ( '1'); insert into test_num values ( '2'); insert into test_num values ( '3'); insert into test_num values ( '4');

In reply to Re: Combinations / permutations... not even sure what this is called by remiah
in thread Combinations / permutations... not even sure what this is called by tunafish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.