Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion faster execution

Path: archiver1.google.com!postnews1.google.com!not-for-mail
From: train2ve...@hotmail.com (venus)
Newsgroups: comp.lang.perl.misc
Subject: Re: faster execution
Date: 25 Sep 2001 01:53:07 -0700
Organization: http://groups.google.com/
Lines: 37
Message-ID: <bce84cea.0109250053.4c2e7ac9@posting.google.com>
References: <bce84cea.0109240016.6638f273@posting.google.com> <3dttqt4gm4leokkep17m2dibllab32b8is@4ax.com>
NNTP-Posting-Host: 161.142.78.82
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1001407987 14594 127.0.0.1 (25 Sep 2001 08:53:07 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 25 Sep 2001 08:53:07 GMT

Hi...

 What if I have an array that has different keys pointing to the same
value?

      %LOCATION = (
	"GBE",   'Gaborone,,BC',
        "GBC",   'Gaborone,,BC', 
        "ADL",   'Amman,,JD', );

    instead of :
      %LOCATION = (
        'Gaborone,,BC',    "GBE",   
        'Amman,,JD',       "ADL",   );


I tried this:

       	%LOCATIONS = reverse %LOCATION;
        while (<INPUT_FILE>) {
           ($city, $statecode, $countrycode, $date1, $max1, $min1,
$cond1, $date2, $max2, $min2, $cond2,
         $date3, $max3, $min3, $cond3, $date4, $max4, $min4, $cond4,
         $date5, $max5, $min5, $cond5, $date6, $max6, $min6, $cond6 )
= split (/,/);
   
   $location = "$city,$statecode,$countrycode";

 	if( exists $LOCATIONS{$location} ){
		print OUTPUT_FILE "$LOCATIONS{$location},$max1,$min1,$cond1\n";

but this will eliminate those repeated values and only prints one of
the associated key. Any other way to do it?

Appreciate if you could help.
regards,
venus