hi

hi

am 13.09.2011 16:00:42 von 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
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: hi

am 14.09.2011 13:17:53 von 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.

And even then, it's hard to help you to improve your code if you don't show
it.

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

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: hi

am 14.09.2011 18:35:19 von Brandon McCaig

On Tue, Sep 13, 2011 at 10:00 AM, pradeep wrote:
> 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
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: hi

am 14.09.2011 18:40:47 von Brandon McCaig

On Wed, Sep 14, 2011 at 12:35 PM, Brandon McCaig 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
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: hi

am 15.09.2011 12:22:45 von 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 "-".

I hope this can help you.

2011/9/14 Brandon McCaig

> On Wed, Sep 14, 2011 at 12:35 PM, Brandon McCaig
> 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
> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
> Castopulence Software <
> 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--