in reply to Re: Convert ASCII string to 7-bit binary string
in thread Convert ASCII string to 7-bit binary string

why is substr needed there?
  • Comment on Re^2: Convert ASCII string to 7-bit binary string

Replies are listed 'Best First'.
Re^3: Convert ASCII string to 7-bit binary string
by kennethk (Abbot) on Oct 27, 2015 at 20:21 UTC
    substr $var, 1 returns the string in $var minus the first character. That's what converts the 8 character binary output from unpack into the desired 7 character one. You could do the same thing with a substitution with the /r modifier, and I'm sure a number of other methods. In the OP, it's handled with s/^.//;, but then you can't chain.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.