Perl (Scripting) - Print last value in an array in Perl
Let's say you have an array of fruit.
my @fruit = qw(apple banana orange grapes);
The following will print the last value in the array (grapes in this example).
Likewise, you could store the last value in a new variable.
my $last_value = $fruit[$#fruit];