perl shell is a good idear (I'm using ipython a lot. That's why I like
to try perl shell), but it really has problems. See attached
screenshot.

On Sat, Jan 5, 2013 at 7:16 AM, David Precious <dav...@preshweb.co.uk> wrote:
> On Fri, 4 Jan 2013 15:43:41 -0700
> Elim Qiu <elim....@gmail.com> wrote:
>
>> It's on snow leopard, perl version 5.10.0
>>
>>
>>
>> print 3 > 1, "\n";
>>
>> prints 1 and ignored "\n"
>
> Includes the newline for me.
>
> If I had to hazard a guess, I'd say perhaps when you ran it you
> accidentally mistyped "." instead of "," (so you concatenated, so the
> code was effectively print 3 > "1\n")
>
> Could that be the case?
>
> Also, extra parenthesis never hurt; while not required in these
> examples, they can help aid readability at times and make precedence
> clearer to less experienced coders reading your code, removing any
> doubt from their minds on what's going to happen.
>
> If my guess above is right, if you'd used parenthesis it would have
> still worked - e.g.:
>
>   print 3 > 1 . "\n";
>
> written instead as:
>
>   print( ( 3 > 1 ) . "\n");
>
> ... would still have provided the result you were expecting.
>
> (I do of course agree that excessive use of parenthesis where not
> needed can instead hurt readability - just providing an example of
> where they could have helped.)
>
>
> The sections in perldoc perlop on precedence and associativity will be
> worth a read.
>
>
> --
> David Precious ("bigpresh") <dav...@preshweb.co.uk>
> http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
> www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
> www.preshweb.co.uk/cpan        www.preshweb.co.uk/github
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>

<<attachment: psh.gif>>

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