use strict; sub vert { my ($arg) = @_; print "Arg is $arg\n"; return 'text'; } # Correct way of creating subroutine reference my $sub_ref = \| # Will print "Arg is foo" &$sub_ref('foo'); # Incorrect attempt at creating a subroutine reference # Will print "Arg is bar" as a side effect my $not_sub_ref = \&vert('bar'); # Will die horribly, since $not_sub_ref is a reference # to the string 'text' (the return value of &vert), # not a reference to a subroutine &$not_sub_ref();