[33074] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4350 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 17 05:17:20 2015

Date: Sat, 17 Jan 2015 02:17:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 17 Jan 2015     Volume: 11 Number: 4350

Today's topics:
    Re: What is ++ operation <jurgenex@hotmail.com>
    Re: What is ++ operation <news@todbe.com>
    Re: What is ++ operation <xemoth@gmail.com>
    Re: What is ++ operation <rweikusat@mobileactivedefense.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 15 Jan 2015 22:18:49 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: What is ++ operation
Message-Id: <15bhba5fmj9mhv25pi1ejnu6t7keebr6u1@4ax.com>

Paul Gekakis <pgek48@aol.com> wrote:
[ What is ++ operation]

See "perldoc perlop":
<quote>
 Auto-increment and Auto-decrement
   "++" and "--" work as in C. That is, [...]
</quote>

jue


------------------------------

Date: Thu, 15 Jan 2015 22:32:43 -0800
From: "$Bill" <news@todbe.com>
Subject: Re: What is ++ operation
Message-Id: <54B8B08B.3040605@todbe.com>

On 1/15/2015 20:46, Tim McDaniel wrote:
> In article <OPidnRL2ic2UEiXJnZ2dnUU7-N-dnZ2d@giganews.com>,
> Paul Gekakis  <pgek48@aol.com> wrote:
>> thanks
>
> ... It's hard to know how to answer the question well -- not because
> it's not well-known, but because it's in any textbook on the language
>
> For the immediate question, if your system has "man perlop" available,
> you can do
>      /Auto-increment and Auto-decrement
> and get an explanation.
>
> http://perldoc.perl.org/perlop.html#Auto-increment-and-Auto-decrement
> reaches the same explanation.
>
> "Increment" means "increase by one", and "decrement" means "decrease
> by one".

Also, the position indicates whether it's a pre-inc/dec or a post-inc/dec.
EG: ++$x or --$xx vs $x++ or $x--


------------------------------

Date: Fri, 16 Jan 2015 02:04:45 -0800 (PST)
From: Owen <xemoth@gmail.com>
Subject: Re: What is ++ operation
Message-Id: <a995e92d-6ae1-492e-80d2-9ced0677f63d@googlegroups.com>

On Friday, January 16, 2015 at 3:09:52 PM UTC+11, Paul Gekakis wrote:
> thanks

Try by experiment, here's a variation;

===============================

#!/usr/bin/perl

use strict;

my $letter = "a";

foreach (1 .. 26){
  print "$letter\n";
  $letter++;
}

==============================



Owen


------------------------------

Date: Fri, 16 Jan 2015 16:22:22 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: What is ++ operation
Message-Id: <8761c6vgox.fsf@doppelsaurus.mobileactivedefense.com>

Owen <xemoth@gmail.com> writes:
> On Friday, January 16, 2015 at 3:09:52 PM UTC+11, Paul Gekakis wrote:
>> thanks
>
> Try by experiment, here's a variation;
>
> ===============================
>
> #!/usr/bin/perl
>
> use strict;
>
> my $letter = "a";
>
> foreach (1 .. 26){
>   print "$letter\n";
>   $letter++;
> }
>
> ==============================

While that's surely "what every one else does", it's IMHO a bad
example. The postincrement (and -decrement) operators have very
peculiar semantics, namely 'modify the value but return the previous
value. Unless that's specifically what's intended, eg, as a bad example,

perl -e 'my $l = "a"; print $l++,"\n" for 1 .. 26'

one should consider using the simpler preincrement (or -decrement)
operator instead (returning the new value).


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4350
***************************************


home help back first fref pref prev next nref lref last post