in reply to get a reference implicitly within a subroutine call?

As the posts above stated, @_ essentially contains references aliases to the original parameter values, so you'd just need to change $val = $_[0]; to $val = \$_[0];. and, of course, you could get rid of the ref() check :)

EDIT: as L~R pointed out, i misspoke on the stricken-through part. the rest of the post is still correct though.

__________
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
- Terry Pratchett

Replies are listed 'Best First'.
Re^2: get a reference implicitly within a subroutine call?
by Limbic~Region (Chancellor) on Jun 23, 2006 at 16:15 UTC
    EvanK,
    Where do any of the above posts state that @_ contains references? If it did contain references, then your code would be taking a reference to a reference. This may seem like I am being pedantic but there is a distinct difference between references and aliases and they can't be interchanged.

    Cheers - L~R