develooper Front page | perl.beginners | Postings from August 2011

Just why?

Thread Next
From:
TimKapHwan
Date:
August 12, 2011 10:57
Subject:
Just why?
Message ID:
3418bb15-7716-4e0b-a483-2a1e45e6b6d6@c19g2000yqe.googlegroups.com
Hello all!
My first question in this group =)
Can someone explain me why this work fine:

#!/usr/bin/perl -w
sub func
 {
  return 10;
 }
print 5 * func, "\n";
The answer is 50. Good!

But then i change func and 5:
#!/usr/bin/perl -w
sub func
{
return 10;
}
print func * 5, "\n";

The output is 10 Without multiplication by 5 and "\n".

Why this happens, plz tell.
 Thank you!!


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About