irah has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
When I run the following snippet, I got the output as,56555.
#!/usr/bin/perl use strict; use warnings; $a=5; printf("%d%d%d%d%d\n",$a++,$a--,++$a,--$a,$a);
In "perlop" man page, I read, there is no associative for '++' and '--' operator. I confused how this program working or executing?. When I run the same program in C, I got, 45555. Please explain how it is working?
Also I have a doubt "If the operator don't have any associative, how Perl will do that operation?."
Is there any side effect If I use same kind of operations?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Operator Associative in Perl
by ikegami (Patriarch) on Jun 03, 2009 at 15:37 UTC | |
by ig (Vicar) on Jun 04, 2009 at 21:37 UTC | |
Re: Operator Associative in Perl
by lakshmananindia (Chaplain) on Jun 03, 2009 at 11:02 UTC | |
by ikegami (Patriarch) on Jun 03, 2009 at 15:24 UTC | |
Re: Operator Associative in Perl
by JavaFan (Canon) on Jun 03, 2009 at 12:59 UTC | |
by catellus (Initiate) on Jun 04, 2009 at 17:24 UTC | |
by JavaFan (Canon) on Jun 04, 2009 at 17:31 UTC | |
Re: Operator Associative in Perl
by vinoth.ree (Monsignor) on Jun 03, 2009 at 11:00 UTC | |
Re: Operator Associative in Perl
by nagalenoj (Friar) on Jun 03, 2009 at 13:33 UTC | |
by AnomalousMonk (Archbishop) on Jun 03, 2009 at 18:49 UTC |