Thanks fxn, This certainly should help.
List, Is there a search tool which can give me perldoc pages given a string.
--- perldoc -q Search the text of questions (not answers) in perlfaq[1-9] --- does not seems to be powerful enough.
Thanks and Regards, Manish
On 04/08/2005 08:53 PM, Xavier Noria wrote:
On Apr 7, 2005, at 14:47, Manish Sapariya wrote:
Hi List, Can anybody tell me difference among all of the following sub declaration.
1. sub abc {} 2. sub xyz() {} # Please not round brackets, When I had this definition, I got following error.
The former is a regular subroutine, whereas the latter has a prototype. That prototype says xyz receives _no_ arguments, so an error is raised if one is passed:
% perl -wle 'sub xyz () { print "foo" } xyz(3)' Too many arguments for main::xyz at -e line 1, at end of line Execution of -e aborted due to compilation errors.
This is documented in perlsub (section "Prototypes"), where the meaning of the other two prototypes (@) and ($) is explained.
There's an excellent article by Tom Christiansen about prototypes:
Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl
http://library.n0i.net/programming/perl/articles/fm_prototypes/
-- fxn
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>