Assign array variable to scalar variable : Array Scalar « Array « Perl






Assign array variable to scalar variable

    



@array = (1, 2, 3);
$variable = @array;
print "\@array has $variable elements.";

   
    
    
    
  








Related examples in the same category

1.Convert array to scalar
2.Assigning An Array To A Scalar
3.Use a scalar variable as our subscript:
4.Split a scalar to create a list
5.Assign array value to a list of scalar variables
6.Assigning an array value to a scalar variabe
7.Reference single array element by using the $ not @
8.Scalar Data in an Array
9.Place scalar variables in lists and arrays.