in reply to Re: Re: I wrote some clever code - can the comment "defuse" it? (stab at restructuring)
in thread I wrote some clever code - can the comment "defuse" it?

I don't like it either, but the alternative requires an index variable and some math in the index range for a slice, which I find awfully icky. I'm surprised by the number of people who were caught out by the splice though - I use it in similar fashion as I do here pretty frequently, so it's a familiar sight.

Makeshifts last the longest.

  • Comment on Re^3: I wrote some clever code - can the comment "defuse" it? (stab at restructuring)

Replies are listed 'Best First'.
Re: Re^3: I wrote some clever code - can the comment "defuse" it? (stab at restructuring)
by ferrency (Deacon) on Jun 18, 2003 at 16:15 UTC
    There are alternatives to either destroying @letters or using an index. Two I can think of off the top of my head are local @letters (unless it's lexical, which it probably is) or a temporary variable (my @l = @letters and change the code to use that instead). I can't say I like using an additional temp var here, but it is another possibility :)

    Alan