in reply to Whats wrong in this code?

Use tr instead of grep to count the '>' in a string.

Update: or use the command line grep instead:

Update: Nevermind ;)

But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

Replies are listed 'Best First'.
Re^2: Whats wrong in this code?
by choroba (Cardinal) on Nov 18, 2016 at 12:47 UTC
    I can imagine how to use tr/// instead of m//, but how do you want to replace grep with tr?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
      tr/// returns the number of substitutions made, i.e. 0 (or false) if the searched character wasn't found, and something true otherwise. So it could more or less work to replace a grep in the specific use of grep in the original post, but you can't use a regex to specify that the ">" character should be at the beginning of the line.
        But you can apply tr/// only to a string, but grep applies to a list.

        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,