# prototypes only check arg format # i.e. (scalar/array/hash/code/glob and number of args) package Sample; sub stringify () { return ($_[0]->{data}) x $_[1] } package main; sub print_string($) { print $_[0]->stringify(1) } my $obj = bless ( {data=>"foo\n"}, 'Sample'); print_string($obj); # fine print_string(5); # uh oh... basic numbers don't have a stringify method, # yet the arg passed the prototype since 5 is a scalar.