What’s the difference between calling a function as &foo and foo()?

difference foo function
0
Posted

What’s the difference between calling a function as &foo and foo()?

0

When you call a function as &foo, you allow that function access to your current @_ values, and you by-pass prototypes. That means that the function doesn’t get an empty @_, it gets yours! While not strictly speaking a bug (it’s documented that way in the perlsub manpage), it would be hard to consider this a feature in most cases.

Related Questions