John W. Krahn wrote at Thu, 31 Jul 2003 00:22:04 -0700:
If you are just removing one element then you can use shift instead. And you are not really using $i it seems.
for ( 0 .. @archivo - 4 ) { push @lista_final, shift @correos_p; push @lista_final, shift @correos_h; push @lista_final, shift @correos_y; push @lista_final, shift @correos_l; push @lista_final, shift @correos_t; push @lista_final, shift @correos_s; push @lista_final, shift @correos_o; }
Let's shorten that a bit :-)
for ( 0 .. @archivo - 4 ) { push @lista_final, shift @{"correos_$_"} for qw/p h y l t s o/; }
That might be one of the rare moments where it could be correct to use symbolic references. Here it avoids having multiplied the code and logic 7 times. And IMHO it makes the code more readable as it is easier to follow the main idea :-)
You don't need symbolic references.
for ( 0 .. @archivo - 4 ) { push @lista_final, shift @$_ for ( [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] ); }
I agree with Steve Grazzini, though, and suspect there may be a better way to represent the data. But since we don't know what the data is, we can't suggest anything.
-- David Wall
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]