#!/usr/bin/perl -w use strict; # enforces decleration of variables sub changeL{ # $listRef is assigned the first element of the argument # list, which is a reference to the list containing BAB my $listRef = $_[0]; $listRef->[0] = "ABA"; } # list with one element my @list = ("BAB"); # makes a reference to the list my $listR = \@list; # print first element of the list print "$list[0]\n"; # call the subroutine changeL changeL($listR); # print first element of the list print "$list[0]\n";