sub print_summary { my ($type) = @_; if($type=~/w/) { print "hello\n"; } } # ... later ... print_summary("world");