in reply to Binary to decimal conversion

Too much joining :)
return unpack 'd*', reverse $buffer;

Replies are listed 'Best First'.
Re^2: Binary to decimal conversion
by andreas1234567 (Vicar) on Dec 11, 2007 at 10:34 UTC
    Hmm.. I'm surprised to see it works to reverse a scalar like that. read's 2nd argument is a SCALAR, and reverse's single argument is a LIST. What is it I do not understand?
    --
    Andreas

      From reverse

      reverse LIST
            In list context, returns a list value consisting of the ele-
            ments of LIST in the opposite order.  In scalar context, con-
            catenates the elements of LIST and returns a string value with
            all characters in the opposite order.
      
      90% of every Perl application is already written.
      dragonchild
        In list context:
        my @array = reverse( LIST );
        In scalar context:
        my $value = reverse( LIST );
        Fine. But it does not say how it's supposed to behave when fed a SCALAR instead of a LIST, does it?

        I'm still confused.

        --
        Andreas