On 12/08/11 02:22 PM, Robert Wohlfarth wrote:
On Fri, Aug 12, 2011 at 7:03 AM, TimKapHwan<tkapra...@gmail.com>  wrote:

#!/usr/bin/perl -w
sub func
{
return 10;
}
print func * 5, "\n";


Perl interprets that command like this:
print func(*5, "\n");

The "*5" and "\n" become parameters to func. Change the code like this:
print func() * 5, "\n";


Or you could change the function like this:

sub func() {
  return 10;
}

This is the one time where prototypes can be used without messing things up quickly. :)

See `perldoc perlsub` and search for the section on "Prototypes".


--
Just my 0.00000002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

"Make something worthwhile."  -- Dear Hunter

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to