On Thu, Jul 31, 2003 at 12:17:10AM +0000, Pablo Fischer wrote: > Hi! I solved it: > > for($i=0; $i<($#archivo-2); $i++) { > # print "FSF\n"; > for($j=0; $j<9; $j++) { > push(@lista_final, $correos_p[$j]); > push(@lista_final, $correos_h[$j]); > push(@lista_final, $correos_y[$j]); > push(@lista_final, $correos_l[$j]); > push(@lista_final, $correos_t[$j]); > push(@lista_final, $correos_s[$j]); > push(@lista_final, $correos_o[$j]); > # print $correos_p[$j]."\n"; > } > splice(@correos_p,0,8); > splice(@correos_h,0,8); > splice(@correos_y,0,8); > splice(@correos_l,0,8); > splice(@correos_t,0,8); > splice(@correos_s,0,8); > splice(@correos_o,0,8); > } > > Correct?
Actually: splice() *returns* the deleted elements, so all you'd really need is for (whatever) { push @lista_final, splice(@correos_p, 0, 8); push @lista_final, splice(@correos_h, 0, 8); push @lista_final, splice(@correos_y, 0, 8); # etc... } But I do wonder whether you're using the the right data structure for this. For example, if you had a hash of arrays instead %correos = ( p => [ list ], h => [ list ], y => [ list ], etc... ); You could loop over %correos rather than repeating the push/splice statement eight times. (Just a thought.) > And now, How can I remove duplicate elements from a > list or array. I know that this answer its in perldoc > -q duplicate, but I didnt understand the doc. > > Some examples? But there are examples in the FAQ... (?) @lista_final = do { my %seen; grep !$seen{$_}++, @lista_final }; HTH -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]