Mega Code Archive

 
Categories / Perl / Array
 

A program that copies an array and compares the elements of the two arrays

#!/usr/local/bin/perl  @array1 = (14, "abc", 1.23, -7, "def");  @array2 = @array1;  $count = 1;  while ($count <= 5) {      print("element $count: $array1[$count-1] ");      print("$array2[$count-1]\n");      $count++;  }