hi
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 [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: hi
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 [at] pjcj.net
http://www.pjcj.net
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: hi
On Tue, Sep 13, 2011 at 10:00 AM, pradeep <epradeep.kumar1439 [at] gmail.com> 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 <http://www.bamccaig.com/> <bamccaig [at] gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamccaig [at] castopulence.org>
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: hi
On Wed, Sep 14, 2011 at 12:35 PM, Brandon McCaig <bamccaig [at] 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
[at] [at] -1,4 +1,4 [at] [at]
-#/usr/bin/perl
+#!/usr/bin/perl
use strict;
use warnings;
--
Brandon McCaig <http://www.bamccaig.com/> <bamccaig [at] gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamccaig [at] castopulence.org>
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: hi
--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 <bamccaig [at] gmail.com>
> On Wed, Sep 14, 2011 at 12:35 PM, Brandon McCaig <bamccaig [at] 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
> [at] [at] -1,4 +1,4 [at] [at]
> -#/usr/bin/perl
> +#!/usr/bin/perl
>
> use strict;
> use warnings;
>
>
> --
> Brandon McCaig <http://www.bamccaig.com/> <bamccaig [at] gmail.com>
> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
> Castopulence Software <http://www.castopulence.org/> <
> bamccaig [at] castopulence.org>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
> For additional commands, e-mail: beginners-help [at] perl.org
> http://learn.perl.org/
>
>
>
--001485f91ece2328e504acf843d0--