On Tue, Feb 26, 2008 at 8:07 AM,  <[EMAIL PROTECTED]> wrote:
> Hello All,
>
>
>
>  I have two arrays contains exact no.  of elements. Now what I need to do
>  is , I want to execute certain commands to each elements of the array at
>  a time.
>
>
>
>  It means that I want take first element of first array and first element
>  of second array and then want to execute certain commands considering
>  these two elements.
>
>  I don't know how should I achieve this in perl.
>
>
>
>  Please help.
>
>
>
>  Regards
>
>  Irfan.
>
>
>
>
>
>

A simple for statement should do it;

my @array1= qw/1 2 3 4/;
my @array2= qw/1 2 3 4/;
for 0..$#array1 {
  #your code here..
  print $array1[$_] + $array2[$_],"\n";
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to