On 12/08/2011 19:22, 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.

Not quite. func is being treated as a filehandle, and *5 and "\n" are
parameters to print. If warnings were enabled you should get a message
to the effect that filehandle func is not open.

Try running

  print STDOUT * 5, "\n";

Rob

--
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