package a;
sub func {
print 1;
}
package main;
a::->func;
IMO it’s enough to have a::func,a->func.
a::->func; looks very strange to me, why Perl supports this kind of strange looking syntax?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To quote chromatic’s excellent recent blog post on the topic at Modern Perl blog: “To avoid bareword parsing ambiguity.”
To illustrate why such syntax is useful, here’s an example evolved from your sample: