home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7408 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  1.0 KB

  1. Path: sparky!uunet!news.centerline.com!thomaso
  2. From: thomaso@centerline.com (Thomas Andrews)
  3. Newsgroups: comp.lang.perl
  4. Subject: Is this a bug...
  5. Date: 14 Dec 1992 15:10:05 GMT
  6. Organization: CenterLine Software, Inc.
  7. Lines: 32
  8. Message-ID: <1gi84dINNhcv@armory.centerline.com>
  9. NNTP-Posting-Host: 140.239.2.21
  10.  
  11. I posted this "bug" but I didn't get any response.  Here it is again.
  12. Anybody want to comment/explain.  I checked the Camel book, and there
  13. is no explanation there...
  14.  
  15. It appears that calling a subroutine with no argument list is not the
  16. same as calling the subroutine with an empty argument list.  That is,
  17.     &foo();
  18. is different from
  19.     &foo;
  20. I could not find documentation for this in the camel book.  Is this
  21. a bug or a feature?
  22.  
  23. In particular, the following prints out "Just another Perl hacker,":
  24.  
  25. sub func {
  26.     print join(" ",@_),"\n";
  27. }
  28.  
  29. sub main {
  30.     &func;
  31. }
  32.  
  33. &main("Just","another","Perl","hacker,");
  34.  
  35. while if main were defined as:
  36.  sub main {
  37.     &func();
  38.  }
  39. It would print a blank line...
  40. --
  41. Thomas Andrews
  42. CenterLine Software
  43.