xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:
looks like perl5 string doesn't support operations of arithmetic but self-increment/decrement. My question is how override operator so as to fit on string? and take a look third statement, IMHO, ab11 is more reasonable. Any help?perl -e "$a = qq(ab); $a + 3; print $a;" # ab perl -e "$a = qq(ab1); $a ++; print $a;" # ab2 perl -e "$a = qq(ab1); for(1..10) {$a ++;} print $a;" #ac1
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: string operations of arithmetic
by choroba (Cardinal) on Jun 24, 2011 at 12:37 UTC | |
|
Re: string operations of arithmetic
by MidLifeXis (Monsignor) on Jun 24, 2011 at 12:48 UTC | |
|
Re: string operations of arithmetic
by Anonymous Monk on Jun 24, 2011 at 12:26 UTC | |
|
Re: string operations of arithmetic
by wind (Priest) on Jun 24, 2011 at 16:24 UTC |