Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Displaying bit-vectors with Most Significant Bits to the left?

by LanX (Saint)
on Jan 05, 2020 at 14:57 UTC ( [id://11110981]=note: print w/replies, xml ) Need Help??


in reply to Re: Displaying bit-vectors with Most Significant Bits to the left?
in thread Displaying bit-vectors with Most Significant Bits to the left?

Using reverse on a single value in list context is a no-op.

You posted untested code in a fake demo.

So clever!

DB<315> undef $m1; vec($m1,$_,1)=1 for 0,2,8,9,10 DB<316> x unpack 'b16',$m1 0 1010000011100000 DB<317> p reverse unpack 'b16',$m1 1010000011100000 DB<318> p scalar reverse unpack 'b16',$m1 0000011100000101 DB<319>

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^2: Displaying bit-vectors with Most Significant Bits to the left?
  • Download Code

Replies are listed 'Best First'.
Re^3: Displaying bit-vectors with Most Significant Bits to the left?
by shmem (Chancellor) on Jan 05, 2020 at 17:11 UTC

    You posted untested code in a fake demo.

    So clever!

    Thanks for calling me a fool. So nice!

    p scalar reverse unpack 'b16',$m1

    Yeah, the scalar was missing, which you spotted and corrected.

    So what?

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      > So what?

      Well, you've pretended to show tested code.

      Think about it.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        Well, you faked a copy from an actual test.

        Think about it.

        What should I think?it mimicked the REPL you are using. I did even fake the sequence number! D'oh!
        Mine is different, I use perlsh from Term::ReadLine::Gnu (hacked to suit my needs), and this was the actual test using it:

        package main; # [498] ~ > vec($m0,$_,1)=1 for 0,2,8,9,10 result: '' package main; # [499] ~ > scalar reverse unpack 'b16',$m0 result: '0000011100000101'

        So not only am I a fool, but a dishonest person also, a liar and a faker, whose code is not to be trusted. At all!

        update: No Sir, I did not pretend to show tested code, as you claim after having edited your answer (without note). I did, and you can beat me to death for that, forget the scalar. Next.

        perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-24 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found