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

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



> From: Vicki Brown [mailto:vlb@cfcl.com]
> Sent: Thursday, August 05, 1999 17:18
> To: Fun With Perl
> Subject: [FWP] Is this fun? What's going on?
>
>
> #!/usr/bin/perl
>
> foreach (@INC) {
>    print
>    print "\n"
> }
>
>
> The results are not what I expected...

Why not?  You are telling it to print the value of printing a newline.
So it prints the newline, then it prints a one, then it loops to the
next element in the list @INC, etc.  (I haven't even tested it.  How's
that for smug?)

Put the semicolon after the first 'print' and all will be what you
expect.

--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com



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