On Wed, Apr 27, 2005 at 11:48:39PM -0500, David Nicol wrote:
> On 4/26/05, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> > I presume you mean this to be the smart way:
> > 
> >         foreach my $num (1..$Very_Big_Number) {
> >                 $num *= 10;
> >                 ...do whatever...
> >         }
> 
> there is no doc for this because it is not what range is for.
> 
> You want to go from n to m by tens, presumably you have
> taken introductory C programming at some point in grade school
> or somewhen, you do not need coaching to come up with
> 
>       for (my $num = $n; $n <= $m; $n+= 10){
> 
> Range is really nice for taking array slices.  Anything else is
> a hack.

Wow.

>From perlop:

   The range operator is useful for writing "foreach (1..10)" loops and for 
   doing slice operations on arrays.

On the broader scale... 

No, you cannot assume I've taken any C classes.  The time when it was 
assumed a Perl programmer already knew another language, particularly C and 
shell, has long since past.  Perl programmers are Perl programmers.

And a feature is for whatever it turns out to be useful for.  Perl is full
of features that were designed for one thing and used for ten others each
of which originally considered to be horrible hacks and later realized to
be nice idoms.  Just to make sure we haven't lost sight of that.

You like your C style for loops, personally I find them difficult to read
and wrap my head around, but if that's what you're used to have fun.  But
don't restrict the rest of the users based on that.  TMTOWTDI and all.
Or did I stumble into python-porters?

Reply via email to