Abdulaziz Ghuloum writes:
>
> So, is there a rational reason why the increment operator should behave this
> way and why the decrement operator behaves differently?
Yes, increment is magic, but decrement is not. In the perlop man page
(perldoc perlop), you'll find
Auto-increment and A
On Jun 3, Abdulaziz Ghuloum said:
>Incrementing and decrementing strings are quiet puzzling to me. I don't
>seem to figure out the rationale behind the use of the increment (++)
>and decrement (--) operators when it comes to strings. Let me
>illustrate:
Here's the short answer:
Auto-increment
On 03 Jun 2001 11:18:57 AST, Abdulaziz Ghuloum said:
oops, $str should be 'ab9' not 'ab1' in this example.
> $str = 'ab1';
> $str++;
> print "$str\n"; # can you take a guess? Answer: 'ac0'
_
Do You Yahoo!?
Get your free @yahoo.co
Hello everybody
Incrementing and decrementing strings are quiet puzzling to me. I don't seem
to figure out the rationale behind the use of the increment (++) and decrement
(--) operators when it comes to strings. Let me illustrate:
$str = 'hello';
$str++;
print "$str\n"; # here we get "hellp".