Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Auto Increment "magic" Inquiry

by brusimm (Pilgrim)
on Jan 05, 2007 at 17:37 UTC ( #593174=note: print w/replies, xml ) Need Help??

in reply to Auto Increment "magic" Inquiry

Wow, where do I start?

jettero, Any opinion gives me a different perspective to consider. Thanks. I did look around as much as I could, and came up with the quoted statements in my posting. (Though, later on, it is noted there is some other "coverage" on the issue.) Roy Johnson & Solo, I am not relying on the behavior for anything of serious nature.

roboticus, my co-worker is.. "unique" in this scenario. Her Perl is of a different flavor, and I just tested this script on a unix system, using a different version of Perl, with the same results. (I AM NOT JUSTIFYING my results, just adding to my observations.)

jbert, you just hurt my brain with: Things can be entirely consistent and predictable and yet not reliable. That's like being in a Rigid State of Flexibility!! All joking aside, I did try to uncover supporting documentation, but alas, there is none, for understandable reasons.

GrandFather, I' won't get "bit" because I do not have any plans to ever try to implement this kind of unstable insanity!.. (Was that redundant? Did I just create a variable making sanity, sane or what?). I'm just experimenting, trying to understand things, get to the bottom of my own curiosities.

blokhead "Now hopefully you agree with what everyone has been saying, that assigning to a variable multiple times while using its value in the same statement is really not worth it." Oh yea, that has sunk in!! Thank you blokhead for the matrix you took the time to create for me. I've been going over it, trying to get the premise to sink in, and it will. Somehow.. with enough beer maybe... "I guess if perl wants to reserve the right to do something else, you'll have to respect that." Crap, I already have a wife with those processing parameters!

Thanks for the link chargrill. It's an awesome reference to someone else tormenting themselves, and I am glad no one got mad at each other in my node.

Thank you everyone, including ysth & chromatic for your time spent on the issue. I appreciate your input and patience in doling (<-sp?) out your insights and experience. I'm going to go dwell over blokhead's matrix and see if I can make sense of my example, AND DO NOT FEAR, I am not planning on implementing this idea anywhere or taking it to heart that this is how Perl treats these parameters. I realize my results (On multiple paltforms & versions) are random acts of consistency! I really am quite sane, in a more or less, sane-ish way!! brusimm muttering to himself - "random acts of consistency", man where did that come from? as he leaves the room.

Replies are listed 'Best First'.
Re^2: Auto Increment "magic" Inquiry
by chargrill (Parson) on Jan 05, 2007 at 23:27 UTC

    Just for grins, I was trying to see what my local perl would produce. To my surprise, my answer was different! But then I tried a few more things and realized I had misstyped the original problem.

    But since I found this interesting, I thought I'd share. (Note, this behavior might also show up in the off-site link from the original poster in my earlier post in this node, but that's old and off-site.)

    $ perl -e 'my $m = 20; print $m++ + $m++, "\n"' 41 $ perl -e 'my $m = 20; print $m++ + ++$m, "\n"' 42 $ perl -e 'my $m = 20; print ++$m + $m++, "\n"' 43 $ perl -e 'my $m = 20; print ++$m + ++$m, "\n"' 44

    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://593174]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2021-12-04 02:33 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (30 votes). Check out past polls.