in reply to Re^3: 5.40 released
in thread 5.40 released

I semi-agree with anonymonk here - the Cish cruft got in the way of me seeing the point trying to be made. I saw C code and essentially skipped everything else. I find it really hard to imagine why you would want to write C in Perl as a preferred option. Why not just write C in C?

However I agree with cavac that the implicit variable should be avoided, but not to the extent of eschewing map and grep etc.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^5: 5.40 released
by cavac (Prior) on Jun 13, 2024 at 11:18 UTC

    Well, since i needed the iterator VALUE in the code, so for(0..9) was not an option. This is quite often the case in my code. To avoid mixing too many styles of constructs, i limited my coding style to use C-Style.

    Plus, as mentioned, i often port between JavaScript, C/C++ and Perl, as well as doing a lot of Arduino development. For my use cases, for(0..9) is the cruft, proper C-Style loops are the norm ;-)

    But, as i said, that's just the style guide for my own projects.

      Well, since i needed the iterator VALUE in the code, so for(0..9) was not an option.

      I'm not sure how this follows. Could you explain why this condition precludes the perlish loop?


      🦛

      Well, since i needed the iterator VALUE in the code, so for(0..9) was not an option. This is quite often the case in my code. To avoid mixing too many styles of constructs, i limited my coding style to use C-Style.

      for my $i(0..9){...}

      Or am I missing something?