[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Is this fun? What's going on?



On Fri, Aug 06, 1999 at 06:07:09AM -0400, Bill Jones wrote:
> >> foreach (@INC) {
> >>    print () . "\n";  # Ignores the LF...
> >> }
> >> # Also tried the . and/or ,  both to no avail...
> >> ???
> 
> > What are you trying to accomplish?
> 
> 
> Implicit  $_  in capturing ()
> 

Okay.

print with zero arguments prints $_.

print with more than zero arguments prints its arguments.


You're trying to give print zero arguments, so it prints $_:

print () . "\n";
      ^^

And, at the same time, more than zero arguments, so it prints a newline:

print () . "\n";
         ^^^^^^


But, of course, you can't give print zero and more than zero arguments at
the same time.  If you want print to print anything other than just $_, you
have to give it the arguments you want it to print.

print "$_\n";


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe