in reply to Re: Performing search and replace on an output file prior to printing
in thread Performing search and replace on an output file prior to printing

Can you clarify "removed useless slice"? I know this is not a golf problem, but one liners are a place where brevity can be useful. As I see it:

@v = ("w", @F[2,3], length($F[9]))

is valid syntax and would save 5 characters.

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

  • Comment on Re^2: Performing search and replace on an output file prior to printing
  • Download Code

Replies are listed 'Best First'.
Re^3: Performing search and replace on an output file prior to printing
by choroba (Cardinal) on Jan 26, 2016 at 13:41 UTC
    would save 5 characters.
    @v = ("w", @F[2,3], length($F[9])) @v = ("w", @F[2,3], length $F[9]) # -1 more!
    ($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,
Re^3: Performing search and replace on an output file prior to printing
by Eily (Monsignor) on Jan 26, 2016 at 16:18 UTC

    I started with @v{1,3} = (...) and a separate computation of $v[0] and $v[2]. But I turned that into @v{0,1,2,3} = (...), where the slice on @v is not only useless, but also incorrect now that I think of it (since it was actually a slice on %v). And yes the code can be shorter (there is a lot of unnecessary white space for example), but I was expecting TJCooper to adapt the oneliner to his needs anyway.