Re: how to simplify this script

2008-05-06 Thread Richard Lee
Gunnar Hjalmarsson wrote: Richard Lee wrote: Gunnar Hjalmarsson wrote: Richard Lee wrote: code of Gunnar's my $numbers_wanted = 2; my ( @datawanted, @numbers ); LOOP: foreach ( @datas ) { my @test = split; foreach my $num ( @numbers ) { next LOO

Re: how to simplify this script

2008-05-06 Thread Gunnar Hjalmarsson
Richard Lee wrote: Gunnar Hjalmarsson wrote: Richard Lee wrote: code of Gunnar's my $numbers_wanted = 2; my ( @datawanted, @numbers ); LOOP: foreach ( @datas ) { my @test = split; foreach my $num ( @numbers ) { next LOOP if grep( $num->{$_}, @tes

Re: how to simplify this script

2008-05-05 Thread Richard Lee
Gunnar Hjalmarsson wrote: Richard Lee wrote: " It should include '1 2 3' because '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9' = '1 2'(the common number from the list) + anynumber. " as any of them contains 1 and 2 and I don't understand why '1 2 3' was picked. My interpretation: Because it's th

Re: how to simplify this script

2008-05-05 Thread Gunnar Hjalmarsson
Richard Lee wrote: " It should include '1 2 3' because '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9' = '1 2'(the common number from the list) + anynumber. " as any of them contains 1 and 2 and I don't understand why '1 2 3' was picked. My interpretation: Because it's the first element of those wi

Re: how to simplify this script

2008-05-04 Thread Richard Lee
[EMAIL PROTECTED] wrote: > From: "Richard Lee" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: > Sent: Sunday, May 04, 2008 3:17 AM > Subject: Re: how to simplify this script > >> I don't have the solution yet but shouldn't the answer be

Re: how to simplify this script

2008-05-03 Thread Chas. Owens
On Sat, May 3, 2008 at 7:03 PM, <[EMAIL PROTECTED]> wrote: > Hi Gunnar and Members > > I am very thrilled with your solutions. Is 'LOOP' as in >> LOOP: > foreach ( @datas ) { <<= > a function or a command etc. I could not find this function in > http://perldoc.perl.org/index-function

Re: how to simplify this script

2008-05-03 Thread Chas. Owens
On Sat, May 3, 2008 at 6:44 PM, <[EMAIL PROTECTED]> wrote: snip > The output should include '1 2 3'. > Therefore I want the output to be > > 1 2 3 > 1 6 7 > 4 5 10 > > It should include '1 2 3' because '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 > 2 9' = '1 2'(the common number from the list) +

Re: how to simplify this script

2008-05-03 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: Hi Gunnar and Members I am very thrilled with your solutions. Is 'LOOP' as in >> LOOP: foreach ( @datas ) { <<= a function or a command etc. No, it's just the name I chose to give the outer foreach loop to be able to refer to it from within the inner for

Re: how to simplify this script

2008-05-03 Thread itshardtogetone
e - From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> To: Sent: Sunday, May 04, 2008 4:22 AM Subject: Re: how to simplify this script As usual, hashes can be useful to simplify things. In the code suggestion below I made use of the 'array of hashes' @numbers. my $nu

Re: how to simplify this script

2008-05-03 Thread itshardtogetone
From: "Richard Lee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Sunday, May 04, 2008 3:17 AM Subject: Re: how to simplify this script I don't have the solution yet but shouldn't the answer be 1 6 7 and 4 5 10 only ? it's printing out 1 2 3 as

Re: how to simplify this script

2008-05-03 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: In the script below, I have an array @datas with its elements consisting of numbers like this :- Out of the above list, I wish to generate a seperate array so that among their elements, there should not be any 2 numbers that can match and so the output should be :-

Re: how to simplify this script

2008-05-03 Thread Richard Lee
[EMAIL PROTECTED] wrote: > Hi, > In the script below, I have an array @datas with its elements consisting of > numbers like this :- > > my @datas = ( > '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9', '1 6 7', > '1 7 12', '2 6 7', '4 5 10', '4 5 15' > ); > > Out of the above list, I wish to

Re: how to simplify this script

2008-05-03 Thread Richard Lee
[EMAIL PROTECTED] wrote: > Hi, > In the script below, I have an array @datas with its elements consisting of > numbers like this :- > > my @datas = ( > '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9', '1 6 7', > '1 7 12', '2 6 7', '4 5 10', '4 5 15' > ); > > Out of the above list, I wish to

how to simplify this script

2008-05-03 Thread itshardtogetone
Hi, In the script below, I have an array @datas with its elements consisting of numbers like this :- my @datas = ( '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9', '1 6 7', '1 7 12', '2 6 7', '4 5 10', '4 5 15' ); Out of the above list, I wish to generate a seperate array so that among the