Scalar Data in an Array : Array Scalar « Array « Perl






Scalar Data in an Array

   


#!/usr/local/bin/perl
@FamilyName = ("Tom", "Michael", "A");
print $FamilyName[0];
print $FamilyName[1];
print $FamilyName[2];
print "\n\n";

print "$FamilyName[0] $FamilyName[1] $FamilyName[2]";

   
    
    
  








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.Assign array variable to scalar variable
5.Split a scalar to create a list
6.Assign array value to a list of scalar variables
7.Assigning an array value to a scalar variabe
8.Reference single array element by using the $ not @
9.Place scalar variables in lists and arrays.