in reply to Re^2: Quick question on a Perl Code!
in thread Quick question on a Perl Code!
that is a function declaration -- it doesn't print anythingsub fudge($){ print @_ }
those are function calls, it prints 1 then prints 2fudge(1); fudge 2;
If you wrote
the prototype ($) ensures fudge only gets 1 argumentfudge 1,2;
If you try to force the issue with
You'll get an errorfudge(1,2);
Next time, when you get links, follow them, read them, its what we all do :)$ perl -le " sub fudge($){print @_} fudge(1,2); Too many arguments for main::fudge at -e line 1, near "2)" Execution of -e aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Quick question on a Perl Code!
by dudydude (Novice) on Jul 14, 2011 at 16:08 UTC |