in reply to how do subroutines work

The zivad sub gets one parameter 'mago' in the array @_, which is stores in my $animal as a result of the default use of shift. It is shifting the leftmost scalar in the array @_. The my $list variable does not store a list but a scalar, namely the value of the %list hash for the key $animal. then the scalar $list is returned and printed...

This should be clearer

my %hash = ( pas => 'vau-vau', macak => 'mijau', krava => 'muuuuu', pile => 'pi-pi', mago => 'ia-ia' ); sub zivad { my $animal = shift; my $hash_value = $hash{$animal} || die "no animal"; return $hash_value; } print zivad('mago');

Not that I would use those variable names but they give you an idea of what the variables contain.

Pancho