#1: hi

Posted on 2011-09-13 16:00:42 by pradeep

Hi,
I do have a doubt ,
Input:
1,2,3,4,5,6
output:
1-2,3-4,5-6
1-2,3-5,4-6
1-2,3-6,4-5

1-3,2-4,5-6
1-3,2-5,4-6
1-3,2-6,4-5

1-4,2-3,5-6
1-4,2-5,3-6
1-4,2-6,3-5

1-5,2-3,4-6
1-5,2-4,3-6
1-5,2-6,3-4

1-6,2-3,4-5
1-6,2-4,3-5
1-6,2-5,3-4

Can anyone help me in this????

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
http://learn.perl.org/

Report this message

#2: Re: hi

Posted on 2011-09-14 13:17:53 by Paul Johnson

On Tue, Sep 13, 2011 at 07:00:42AM -0700, pradeep wrote:
> Hi,
> I do have a doubt ,
> Input:
> 1,2,3,4,5,6
> output:
> 1-2,3-4,5-6
> 1-2,3-5,4-6
> 1-2,3-6,4-5
>
> 1-3,2-4,5-6
> 1-3,2-5,4-6
> 1-3,2-6,4-5
>
> 1-4,2-3,5-6
> 1-4,2-5,3-6
> 1-4,2-6,3-5
>
> 1-5,2-3,4-6
> 1-5,2-4,3-6
> 1-5,2-6,3-4
>
> 1-6,2-3,4-5
> 1-6,2-4,3-5
> 1-6,2-5,3-4
>
> Can anyone help me in this????

Unlikely, unless you are a bit more specific about what you are trying to do.

it.

--
Paul Johnson - paul@pjcj.net
http://www.pjcj.net

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
http://learn.perl.org/

Report this message

#3: Re: hi

Posted on 2011-09-14 18:35:19 by Brandon McCaig

> Can anyone help me in this????

Of course we can!

#/usr/bin/perl

use strict;
use warnings;

my \$input = <>;

chomp \$input;

if(\$input eq '1,2,3,4,5,6')
{
print <<'EOF';
1-2,3-4,5-6
1-2,3-5,4-6
1-2,3-6,4-5

1-3,2-4,5-6
1-3,2-5,4-6
1-3,2-6,4-5

1-4,2-3,5-6
1-4,2-5,3-6
1-4,2-6,3-5

1-5,2-3,4-6
1-5,2-4,3-6
1-5,2-6,3-4

1-6,2-3,4-5
1-6,2-4,3-5
1-6,2-5,3-4
EOF
}

__END__

You're welcome. <_<

Regards,

--
Brandon McCaig <http://www.bamccaig.com/> <bamccaig@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamccaig@castopulence.org>

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
http://learn.perl.org/

Report this message

#4: Re: hi

Posted on 2011-09-14 18:40:47 by Brandon McCaig

On Wed, Sep 14, 2011 at 12:35 PM, Brandon McCaig <bamccaig@gmail.com> wrote:
> #/usr/bin/perl

Silly me, I forgot the bang.

--- a Wed Sep 14 12:38:40 2011
+++ b Wed Sep 14 12:38:46 2011
@@ -1,4 +1,4 @@
-#/usr/bin/perl
+#!/usr/bin/perl

use strict;
use warnings;

--
Brandon McCaig <http://www.bamccaig.com/> <bamccaig@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamccaig@castopulence.org>

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
http://learn.perl.org/

Report this message

#5: Re: hi

Posted on 2011-09-15 12:22:45 by Francisco Rivas

--001485f91ece2328e504acf843d0
Content-Type: text/plain; charset=ISO-8859-1

There is a pm called Math::Combinatorics (
http://search.cpan.org/~allenday/Math-Combinatorics-0.09/lib /Math/Combinatorics.pm
)

It is really helpful to get the combinations without repetition. Then you
just need to process the results to get the output you need, I mean with the
"," and "-".

2011/9/14 Brandon McCaig <bamccaig@gmail.com>

> On Wed, Sep 14, 2011 at 12:35 PM, Brandon McCaig <bamccaig@gmail.com>
> wrote:
> > #/usr/bin/perl
>
> Silly me, I forgot the bang.
>
> --- a Wed Sep 14 12:38:40 2011
> +++ b Wed Sep 14 12:38:46 2011
> @@ -1,4 +1,4 @@
> -#/usr/bin/perl
> +#!/usr/bin/perl
>
> use strict;
> use warnings;
>
>
> --
> Brandon McCaig <http://www.bamccaig.com/> <bamccaig@gmail.com>
> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
> Castopulence Software <http://www.castopulence.org/> <
> bamccaig@castopulence.org>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

--001485f91ece2328e504acf843d0--

Report this message