use strict; use warnings; use Data::Dumper; # the first arg will modified sub square_first_arg { $_[0] = $_[0]** 2; } my $x = 2; square_first_arg($x); print "2 squared is $x\n"; eval { square_first_arg( 3 ); }; print "trying to square something unmodifyable: $@ \n"; # Referenzen my $a = 'A'; sub a_to_b { # copy @_, as we dont't want to modify the the param itself my ($first_param) = @_; # modify the scalar that $first_param refers to ${ $first_param } = 'B'; } print Dumper( $a ); a_to_b( \$a ); print Dumper( $a );