unique function?
am 26.03.2007 13:12:39 von ukhas jean
--===============1046211337==
Content-Type: multipart/alternative; boundary="0-1971847138-1174907559=:62817"
Content-Transfer-Encoding: 7bit
--0-1971847138-1174907559=:62817
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hello,
=20
I have an list of version nos. (some version nos. being repetitive) ...=
like for eg.=20
@arr =3D qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
=20
I want to get only the unique values in @arr. i.e. version nos. 7.2.0.6=
and 7.2.0.5
is there an inbuilt perl-function that does this??
=20
(PS: I have done this using for and if-loops; but was wondering if ther=
e was an easier way)
=20
-- Raghu
=20
---------------------------------
Now that's room service! Choose from over 150,000 hotels=20
in 45,000 destinations on Yahoo! Travel to find your fit.
--0-1971847138-1174907559=:62817
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hello,
I have an list of version nos.=
(some version nos. being repetitive) ... like for eg.
@arr =
=3D qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
=
I want to get only the unique values in @arr. i.e. version nos. 7.=
2.0.6 and 7.2.0.5
is there an inbuilt perl-function that does=
this??
(PS: I have done this using for an=
d if-loops; but was wondering if there was an easier way)
&nb=
sp;
-- Raghu
Now that's room service!
hotelsearchpage;_ylc=3DX3oDMTFtaTIzNXVjBF9TAzk3NDA3NTg5BF9zA zI3MTk0ODEEcG=
9zAzIEc2VjA21haWx0YWdsaW5lBHNsawNxMS0wNw--
">Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Tr=
avel to find your fit.
--0-1971847138-1174907559=:62817--
--===============1046211337==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1046211337==--
Re: unique function?
am 26.03.2007 13:26:49 von Dan Rawson
ukhas jean wrote:
> Hello,
>
> I have an list of version nos. (some version nos. being repetitive) ... like for eg.
> @arr = qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
>
> I want to get only the unique values in @arr. i.e. version nos. 7.2.0.6 and 7.2.0.5
> is there an inbuilt perl-function that does this??
>
> (PS: I have done this using for and if-loops; but was wondering if there was an easier way)
>
> -- Raghu
>
>
This is an FAQ.
perldoc -q array . . . then search for "duplicate elements"
Dan
--
The information contained in this communication and any attachments is confidential
and may be privileged, and is for the sole use of the intended recipient(s). Any
unauthorized review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please notify the sender immediately by replying to this
message and destroy all copies of this message and any attachments. ASML is neither
liable for the proper and complete transmission of the information contained in this
communication, nor for any delay in its receipt.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: unique function?
am 26.03.2007 13:28:43 von Brian Raven
Daniel Rawson <> wrote:
> ukhas jean wrote:
>> Hello,
>> =
>> I have an list of version nos. (some version nos. being
>> repetitive) ... like for eg. @arr =3D qw{7.2.0.6 7.2.0.5 7.2.0.6
>> 7.2.0.5 7.2.0.6}; =
>> =
>> I want to get only the unique values in @arr. i.e. version nos.
>> 7.2.0.6 and 7.2.0.5 is there an inbuilt perl-function that does
>> this?? =
>> =
>> (PS: I have done this using for and if-loops; but was wondering if
>> there was an easier way)
>> =
>> -- Raghu
>> =
>> =
> This is an FAQ.
> =
> perldoc -q array . . . then search for "duplicate elements"
Or just 'perldoc -q duplicate'
HTH
-- =
Brian Raven =
==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================
The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =
Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: unique function?
am 26.03.2007 13:31:09 von Bill Luebkert
ukhas jean wrote:
> Hello,
>
> I have an list of version nos. (some version nos. being repetitive) ...
> like for eg.
> @arr = qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
>
> I want to get only the unique values in @arr. i.e. version nos. 7.2.0.6
> and 7.2.0.5
> is there an inbuilt perl-function that does this??
>
> (PS: I have done this using for and if-loops; but was wondering if there
> was an easier way)
How about just using a hash:
my @arr = qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
my %h = ();
++$h{$_} foreach @arr;
print "$_\n" foreach sort keys %h;
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: unique function?
am 27.03.2007 10:30:27 von Michael.Pollak
Dies ist eine mehrteilige Nachricht im MIME-Format.
--===============1771047065==
Content-Type: multipart/alternative;
boundary="=_alternative 002EBCF6C12572AB_="
Dies ist eine mehrteilige Nachricht im MIME-Format.
--=_alternative 002EBCF6C12572AB_=
Content-Type: text/plain; charset="utf-8"
content-transfer-encoding: quoted-printable
> Date: Mon, 26 Mar 2007 04:31:09 -0700
> From: Bill Luebkert
> Subject: Re: unique function?
> To: ukhas jean
> Cc: Active Perl
> Message-ID: <4607AEFD.6080309@roadrunner.com>
> Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed
>=20
> ukhas jean wrote:
> > Hello,
> >=20
> > I have an list of version nos. (some version nos. being repetitive)=20
....=20
> > like for eg.
> > @arr =3D qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
> >=20
> > I want to get only the unique values in @arr. i.e. version nos.=20
7.2.0.6=20
> > and 7.2.0.5
> > is there an inbuilt perl-function that does this??
> >=20
> > (PS: I have done this using for and if-loops; but was wondering if=20
there=20
> > was an easier way)
>=20
> How about just using a hash:
>=20
> my @arr =3D qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
> my %h =3D ();
> ++$h{$_} foreach @arr;
> print "$_\n" foreach sort keys %h;
>=20
>=20
Here an another solution:
@myhash{@arr}=3D('init') x @arr;
print "$_ value: $myhash{$_} \n" foreach sort keys %myhash;
Regards Michael
------------------------------------------------------------ ---------------=
------------------------------------------------------------ -------=20
FIDUCIA IT AG=20
FiduciastraÃe 20=20
76227 Karlsruhe=20
Sitz der Gesellschaft: Karlsruhe=20
AG Mannheim HRB 100059=20
Vorsitzender des Aufsichtsrats: Erwin Kuhn=20
Vorsitzender des Vorstands: Michael Krings=20
Vorstand: Klaus-Peter Bruns, Hans-Peter Straberger, Eckhardt Werner=20
Umsatzsteuer-ID.Nr. DE143582320, http://www.fiducia.de=20
------------------------------------------------------------ ---------------=
------------------------------------------------------------ -------=20
--=_alternative 002EBCF6C12572AB_=
Content-Type: text/html; charset="utf-8"
content-transfer-encoding: quoted-printable
> Date: Mon, 26 Mar 2007 04:31:09 -0700
> From: Bill Luebkert <dbecoll@roadrunner.com>
> Subject: Re: unique function?
> To: ukhas jean <ukh_dtl@yahoo.com>
> Cc: Active Perl <activeperl@listserv.ActiveState.com>
> Message-ID: <4607AEFD.6080309@roadrunner.com>
> Content-Type: text/plain; charset=3DISO-8859-1; format=3Dflowed
>
> ukhas jean wrote:
> > Hello,
> >
> > I have an list of version nos. (some version nos. being repetitiv=
e)
....
> > like for eg.
> > @arr =3D qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
> >
> > I want to get only the unique values in @arr. i.e. version nos.
7.2.0.6
> > and 7.2.0.5
> > is there an inbuilt perl-function that does this??
> >
> > (PS: I have done this using for and if-loops; but was wondering
if there
> > was an easier way)
>
> How about just using a hash:
>
> my @arr =3D qw{7.2.0.6 7.2.0.5 7.2.0.6 7.2.0.5 7.2.0.6};
> my %h =3D ();
> ++$h{$_} foreach @arr;
> print "$_\n" foreach sort keys %h;
>
>
Here an another solution:
@myhash{@arr}=3D('init') x @arr;
print "$_ value: $myhash{$_} \n" foreach
sort keys %myhash;
Regards Michael
000">------------------------------------------------------- ---------------=
------------------------------------------------------------ ------------ =
span>
000">FIDUCIA IT AG
000">FiduciastraÃe 20
000">76227 Karlsruhe
000">Sitz der Gesellschaft: Karlsruhe
000">AG Mannheim HRB 100059
000">Vorsitzender des Aufsichtsrats: Erwin Kuhn
000">Vorsitzender des Vorstands: Michael Krings
000">Vorstand: Klaus-Peter Bruns, Hans-Peter Straberger, Eckhardt Werner =
span>
000">Umsatzsteuer-ID.Nr. DE143582320, http://www.fiducia.de
000">------------------------------------------------------- ---------------=
------------------------------------------------------------ ------------ =
span>
--=_alternative 002EBCF6C12572AB_=--
--===============1771047065==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1771047065==--