sub mychop(\$) { chop ${shift()} } foreach my $thing (qw/foo bar baz/) { print "$thing -> "; my $c = mychop $thing; print " $thing,$c\n"; } #### foo -> foo,o bar -> bar,r baz -> baz,z