Account Options

  1. Sign in
Google Groups Home
« Groups Home
"; for(var i = 0; i ' + '' + '' + google_ads[i].line1 + '
' + '' + google_ads[i].line2 + '
' + '' + google_ads[i].line3 + '
' + '' + google_ads[i].visible_url + '
'; } var fill_ad_div = function() { var ad_div = document.getElementById("google_ads_site"); if (ad_div) { ad_div.innerHTML = narrowAds; } else { setTimeout(fill_ad_div, 10); } } fill_ad_div(); } function adsIframeHtml() { if (window.location) { if ("https:" === location.protocol) return "

"; } return "

Message from discussion Incrementing a value in a slice
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Greg Bacon  
View profile  
 More options May 28 1999, 3:00 am
Newsgroups: comp.lang.perl.misc
From: gba...@itsc.uah.edu (Greg Bacon)
Date: 1999/05/28
Subject: Re: Incrementing a value in a slice
In article <x7emk1i36u....@home.sysarch.com>,
        Uri Guttman <u...@sysarch.com> writes:
: >>>>> "GB" == Greg Bacon <gba...@itsc.uah.edu> writes:
:   GB>     my @uniq;
:   GB>     my %seen;
:
:   GB>     while (<>) {
:   GB>         chomp;
:
:   GB>         push @uniq, $_ unless $seen{$_}++;
:   GB>     }
:
:   GB>     my $mode = shift @uniq;
:   GB>     for (@uniq) {
:   GB>         $mode = $_ if $seen{$_} > $seen{$mode};
:   GB>     }
:
: greg, you can do better than that! why two loops? why the push into
: @uniq?

It's a pedagogical issue.  I wanted to show how to collect the
information she wanted and then show one possible way to use it.
Playing Perl golf (fewest (key)strokes wins!) with people who have lots
of experience is fine, but it's not going to help much for people who
are still trying to get the hang of it.

Greg
--
VMS is a text-only adventure game. If you win you can use Unix.
    -- Bill Davidsen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2011 Google