Perl Arrays

A Perl array variable starts with @. push adds elements to the end. Using an array in scalar context, as scalar(@scores) does, gives its length.

Perl
use strict;
use warnings;

my @scores = (82, 91, 76);
push @scores, 95;
my $total = 0;
$total += $_ for @scores;
print scalar(@scores), " ", $total, "\n";
Read the full lesson