develooper Front page | perl.perl6.users | Postings from October 2018

bitwise or?

Thread Next
From:
ToddAndMargo
Date:
October 4, 2018 18:58
Subject:
bitwise or?
Message ID:
849a4a30-2382-fc7b-74bd-641cf13109d3@zoho.com
Hi All,

I am trying to come up with something like +=

      $ p6 'my $v = 32; $v += 2; say $v;'
      34

to replace

      $ p6 'my $v = 0b00100000; $v = $v +| 0b00010000; say $v;'
      48


But I obviously have something wrong:

      $ p6 'my $v = 0b00100000; $v +| 0b00010000; say $v;'
      WARNINGS for -e:
      Useless use of "+|" in expression "$v +| 0b00010000"
      in sink context (line 1)

      32

Where is my goof?

Many thanks,
-T

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About