On Tue, Sep 10, 2013 at 08:29:00AM -0400, Shawn H Corey wrote:
> On Mon, 09 Sep 2013 11:00:31 +0200
> Hans Ginzel <h...@matfyz.cz> wrote:
> 
> > Is there a shorter way to write $a = ! $a, please?
> 
> Why?

Because it's the sort of thing one might expect Perl to provide.  I know
that I have thought that before.

^= 1 is close, but you really want something that works on truthiness
rather than bits, and xor= doesn't exist.

However, since people will tell you off for using $a anyway, I suggest
using $| instead, and then the operation you are looking for is $|--

$ perl -E 'say $|-- for 1 .. 5'
0
1
0
1
0

[ If it's not obvious, my tongue was in my cheek for half of this post. ]

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

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