On 09/09/2013 11:00, Hans Ginzel wrote:

Is there a shorter way to write $a = ! $a, please?
perl -le '
  my @a = (undef, @ARGV);
  for $a (@a) {
    my @r; push @r, "$a:";
    for (1..3) {
      push @r, $a^=1;  # <--
    }
    print "@r";
  }
' 0 1 2 3 -1

: 1 0 1
0: 1 0 1
1: 0 1 0
2: 3 2 3
3: 2 3 2
-1: 4294967294 4294967295 4294967294

--
Ruud


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