Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

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

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.