Don't ask to ask, just ask | |
PerlMonks |
'function' calls without parenthesesby g0n (Priest) |
on Mar 21, 2006 at 16:36 UTC ( [id://538221]=perlquestion: print w/replies, xml ) | Need Help?? |
g0n has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, I have some code that uses Term::ReadKey to get some user input, but 99 times out of 100 when this script is run, it picks the data up from a file instead, and Term::Readkey isn't needed. So I figure why not do away with the dependency, and require Term::ReadKey in when needed. But the sub that uses it contains a couple of statements like this:
Intrigued by this - apparently a function call without parentheses - I asked in the CB, and was told that the parentheses are optional for a single param function call. But this test case:
fails to compile with:
(On AS perl, 5.6.1). Term::ReadKey doesn't appear to use prototypes incidentally. I'm intrigued - is there a functional difference between ReadMode 1; and ReadMode(1); and if so, what? Or am I being really, really dense? Thanks. Update: thanks to duff. I'd sort of always assumed that
and were equivalent, and never encountered anything that proved me wrong. I know better now :-)
--------------------------------------------------------------
"If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing." Can you spare 2 minutes to help with my research? If so, please click here
Back to
Seekers of Perl Wisdom
|
|