in reply to Changing an array from a sub

First, I just want to state for the record that this is an awesome question. Did the "homework" then presented the findings. I think folk here appreciate that kind of thoughtfulness and interest in learning. Second, my favorite tool for learning new ways to do things in Perl is Data::Dumper.
use Data::Dumper; my @array = #something or other . . . print Dumper @array; print Dumper \@array; #for a different form of output (array reference +) print Dumper $alsoanarrayreference; print Dumper $PrettyMuchAnything #because the output can be enlighteni +ng
$state{tired}?sleep(40):eat($food);