in reply to Re^2: Quick question on a Perl Code!
in thread Quick question on a Perl Code!

I'll elaborate
sub fudge($){ print @_ }
that is a function declaration -- it doesn't print anything
fudge(1); fudge 2;
those are function calls, it prints 1 then prints 2

If you wrote

fudge 1,2;
the prototype ($) ensures fudge only gets 1 argument

If you try to force the issue with

fudge(1,2);
You'll get an error
$ 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.
Next time, when you get links, follow them, read them, its what we all do :)

Replies are listed 'Best First'.
Re^4: Quick question on a Perl Code!
by dudydude (Novice) on Jul 14, 2011 at 16:08 UTC

    Thanks, I am a newbie just a week programming with Perl and some stuff are still confusing to me! THANKS :o)