in reply to Re: Get All Duplicated Elements in an Array (Once, without shifting)
in thread Get All Duplicated Elements in an Array (Once, without shifting)

Well, the one thing you're missing is that %hash{$_}++ is illegal syntax, unless you've already projected forward about three years and are using Perl 6.

-- Randal L. Schwartz, Perl hacker


Comment on •Re: Re: Get All Duplicated Elements in an Array (Once, without shifting)
Re: •Re: Re: Get All Duplicated Elements in an Array (Once, without shifting)
by thor (Priest) on Oct 15, 2002 at 12:40 UTC
    Are you really that bored that you have to rip on people for a typo? How old are you again?

    thor

      If you consider that a "rip on people", you've not been around here for very long.

      {grin}

      On a more serious note... has it really gotten so weird in here that I can't even point out when code won't compile?

      What boilerplate do I need to precede every posting with? Something like:

      Attention!
      The following comment is never meant personally. You are not your code. I most likely do not even know you personally, and don't make presumptions about your character or habits based on a single posting. I'm only commenting on the ability for the code you posted to do its stated task, with particular attention being paid to :
      • Security
      • Maintainability
      • Avoiding needless reimplementation
      • Contribution to the community
      If I sound like I'm flaming, please re-read the message a few more times until you see that it's about the code and the Perl community, and not about you personally. That is all. Thank you.
      Would that help?

      -- Randal L. Schwartz, Perl hacker

        My profile says that I've been around for almost 2 years now, so I'd say that I've been here long enough. It's fine to point out errors, but the manner in which you do it leaves a lot to be desired. In your boilerplate, you suggest reading the post a few more times. Unfortunately, first impressions are everything. If I read something and think it's offensive, I'm sure as hell not going to re-read it, just to see if the poster's intentions were neutral. It's human nature to take things at face value unless a deeper meaning is suspected. A simple "I think you meant $hash{$_}++" would have sufficed. However, you decided to get clever. Remember, that tone of voice is lost in written communication. Though you may have meant what you said in jest, I took it the wrong way, and I let it be known. Also of note, this can't be the first time that someone has called you on your tone, otherwise you wouldn't have gone to the trouble of making a boilerplate to pre-defend your words (I realize that you're not serious about the boilerplate, but still, more time than I would have bothered putting in to it).

        To summarize, you may be a very good Perl coder, but if people close their ears before listening to what you have to say, your contribution to the community is minimized.

        thor

        I was fortunate enough to take a class taught by Randall Schwartz. Not only was it my first introduction to Perl, it was my first introduction to ANY form of coding. I thought he was fantastic and if I was fortunate enough to have my code commented on by Merlyn, then you can believe that I would take whatever he said to heart (regardless of the tone of delivery). I am so sick and tired of all the PC BS and all of these 'Adults' crying over little things like this. The Bottom line is this: If you don't like criticism, don't ask for it !! At least he didn't tell you to RTFM !!!! Get over it, cry in silence then FIX YOUR CODE AND MOVE ON !!!!
Re: •Re: Re: Get All Duplicated Elements in an Array (Once, without shifting)
by demerphq (Chancellor) on Oct 18, 2002 at 17:35 UTC
    While it is true that %hash{$_}++ is illegal syntax, it is interesting to note that %hash->{$_}++ is not. (But it only works on actual hashes and not hash references.) AFAIK its a bug, but one that has basically become a feature.
    use Data::Dumper; use strict; use warnings; my %hash; %hash->{$_}=$_ foreach 0..5; print Dumper(\%hash); __END__ $VAR1 = { '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5 };
    It embarrassed the crap out of me when I discovered this. I was reviewing some code of my colleagues, (relatively new to perl at the time) and identified these as compile time errors. He politely told me what I was full of :-) and then showed me it compiled (and worked) fine. Luckily he had a few other subtle bugs that I found so I managed to avoid looking like a complete moron. :-)

    --- demerphq
    my friends call me, usually because I'm late....

Re^3: Get All Duplicated Elements in an Array (Once, without shifting)
by graq (Curate) on Aug 11, 2006 at 13:43 UTC

    How much of an estimate is 'about' and are you still confident with your prediction? :P

    -=( Graq )=-