Using scalar function to convert array to scalar variable : scalar « System Functions « Perl






Using scalar function to convert array to scalar variable

   

#!/usr/bin/perl -w

use strict;

my @array = qw(A B C D);

print "Scalar value : ", scalar(@array), "\n";
print "Highest index: ", $#array, "\n";

   
    
    
  








Related examples in the same category

1.Using scalar() function to interpret an array variable in scalar context to get its length.
2.Is scalar readonly