in reply to Re: oneliner to count the number binary digits in this string 1011111
in thread oneliner to count the number binary digits in this string 1011111

 $string_len    = length($binary_number);
  • Comment on Re^2: oneliner to count the number binary digits in this string 1011111
  • Download Code

Replies are listed 'Best First'.
Re^3: oneliner to count the number binary digits in this string 1011111
by LanX (Saint) on Mar 13, 2021 at 23:07 UTC

    DB<45> p "NOPE! 1011111" =~ tr/01// 7 DB<46> p length "NOPE! 1011111" 13 DB<47>

    > to count the number binary digits

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery