[21963] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4185 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 27 00:05:39 2002

Date: Tue, 26 Nov 2002 21:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 26 Nov 2002     Volume: 10 Number: 4185

Today's topics:
        =?iso-8859-1?Q?Inspired_by_the_Anders_Hejlsberg's_prese <support@danmarinescu.com>
    Re: Compiling perl for transportability <maxslayer@cfl.rr.com>
    Re: GDGraph module <comdog@panix.com>
        invoking script as perl <scriptname> vs. ./scriptname ( (Matt Oefinger)
    Re: More hash questions ctcgag@hotmail.com
    Re: More hash questions <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 27 Nov 2002 03:36:06 GMT
From: "dan marinescu" <support@danmarinescu.com>
Subject: =?iso-8859-1?Q?Inspired_by_the_Anders_Hejlsberg's_presentation...?=
Message-Id: <G4XE9.4582$sn5.246068618@newssvr13.news.prodigy.com>

This is a multi-part message in MIME format.

------=_NextPart_000_00B0_01C29583.14EE4850
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Inspired by the Anders Hejlsberg's presentation (when c# launched) and =
feeling somehow sad about MS Notepad, I decided to write my own =
programmer notepad, called Total Notepad. If anyone is interested in a =
free, small footprint, super fast and professional source beautifier (c, =
c++, java and c#!) plus editor with publishing capabilities (html and =
rtf exports), syntax coloring for about 22 languages (including c, c++, =
java, c#, vb, delphi, fortran, cobol, perl, python, tc/tkl and more.)  =
plus color printing, well, you can find it at =
www.danmarinescu.com/totalnotepad/

Perfect complement for free .net framework, java framework, gcc and bcc =
(free set of gnu compilers). Hey, hey, hey, like I said, it's FREE! =
(under GNU) - I am NOT trying to sell you anything. This is simply the =
perfect tool for real programmers, students, whoever wants to get the =
job done fast, clean and without paying big bucks for super huge tools =
doing anything but you want them to do here and now. :-)


-------------------------------------------------------------------------=
-------

Please compare the following list of features with your programming =
tool.=20

=20

  a.. Price
    a.. Zero Dollars
  b.. Editor
    a.. File size: unlimited
    b.. Max number of bookmarks per file: 10
    c.. Smart bookmarks (new technology): yes! (No other ides have it) =
When you set up a bookmark, you do NOT have to specify the bookmark id. =
Also, when you want to go to a bookmark, you are actually shown the =
book-marked line, instead of the bookmark's id! This is super cool =
(makes your life much easier).
    d.. Line numbering: yes
    e.. Selection modes: 3 (note that other editors have only 1!) the =
tree selection modes are (1) complete lines, (2) regular, (3) columns =
with full drag and drop capabilities.
    f.. Scalable fonts: yes
    g.. Internet Explorer style full screen mode: yes
    h.. HTML and RTF super fast accurate exports: yes
    i.. Language independent Brackets matching: yes
    j.. Syntax coloring for 22 languages (the full list includes, ansi =
c, ansi c++, c#, java, visual basic (including oop features of vb .net), =
delphi / object pascal, standard pascal, fortran, cobol, perl, python, =
java script, vb script, html, xml (any flavor, including xml, wsdl, xsd, =
xsl, xslt, dtd), php, tcl/tk, foxpro (prg), ansi sql, pl sql, transact =
sql, idl and, of course, html and assembly!
    k.. Extra formats supported: Borland forms (dfm & xfm) and windows =
INIs.
    l.. Beautifier UNDO (unlimited undos and redos).
    m.. Cross platform capabilities (works excellent with both Windows =
and UNIX files).
    n.. Tones of new useful short-cats
    o.. Coloring scheme: MS Developer Studio (& .NET) Extended =
(different color for numbers, strings, symbols).
    p.. Just in time instantiation (start at line number) - for easy =
integration with external ide-s, programming tools
    q.. Internet Explorer Full Screen mode: yes (still, same F11).
  c.. Beautifier
    a.. Simple, easy to use, standard front end (gui)
    b.. Over 20 professional options for formatting your source code
    c.. Styles! (new concept, super easy to use).
    d.. Supports the following languages, k&r c, ansi c (both 89 and =
99), ansi c++, java and c#.
    e.. Invokable from the command line (from outside the ide): yes.
    f.. Now, about performance: imagine a very complex c++ file (around =
10,000 lines). To beautify something like that. well, on a regular =
machine (under 2GHz) you may need. under 3 seconds! So, it's very fast!
    g.. Super fine tuning for formatting options.
  d.. Publisher
    a.. HTML export (super fast, over 10,000 / second! Regular 7200 rpm =
WD HDD)
    b.. RTF export (super fast, over 9,000 / second! Regular 7200 rpm WD =
HDD)
    c.. Combined with the editor and the beautifier, this is closing the =
circle! You can create, maintain, beautify/standardize and publish your =
work at ease.
  e.. Integrated command line prompt
    a.. Sometimes, you need to access the command interpreter (this =
case, cmd). It is nice to do that from inside the IDE. Well, we did =
provide that.
    b.. This comes very handy, as you will normally use it with .net =
framework, or gcc or bcc (borland free command line compiler).=20
    c.. This makes sense from a programmer point of view.
=20

=20

Thanks,

Daniel & Team

=20


------=_NextPart_000_00B0_01C29583.14EE4850
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; =
mso-margin-bottom-alt: auto">Inspired=20
by the <B>Anders</B> <B>Hejlsberg</B>=92s presentation (when c# =
launched) and=20
feeling somehow sad about MS Notepad, I decided to write my own =
programmer=20
notepad, called <B>Total Notepad</B>. If anyone is interested in a free, =
small=20
footprint, super fast and professional source beautifier (c, c++, java =
and c#!)=20
plus editor with publishing capabilities (html and rtf exports), syntax =
coloring=20
for about 22 languages (including c, c++, java, c#, vb, delphi, fortran, =
cobol,=20
perl, python, tc/tkl and more=85)<SPAN style=3D"mso-spacerun: =
yes">&nbsp;=20
</SPAN>plus color printing, well, you can find it at <A=20
href=3D"http://www.danmarinescu.com/totalnotepad/"=20
target=3D_top>www.danmarinescu.com/totalnotepad/</A><SPAN=20
style=3D"FONT-FAMILY: 'Arial Unicode MS'"><?xml:namespace prefix =3D o =
ns =3D=20
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; =
mso-margin-bottom-alt: auto"><B>Perfect=20
complement for free .net framework, java framework, gcc and bcc =
</B>(free set of=20
gnu compilers). Hey, hey, hey, like I said, it=92s FREE! (under GNU) =96 =
I am NOT=20
trying to sell you anything. This is simply the perfect tool for real=20
programmers, students, whoever wants to get the job done fast, clean and =
without=20
paying big bucks for super huge tools doing anything but you want them =
to do=20
here and now=85 :-)</P>
<DIV class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt; TEXT-ALIGN: center" =

align=3Dcenter>
<HR align=3Dcenter width=3D"100%" SIZE=3D2>
</DIV>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Please compare the =
following list=20
of features with your programming tool=85 </P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<UL style=3D"MARGIN-TOP: 0in" type=3Ddisc>
  <LI class=3DMsoNormal=20
  style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: =
list .5in"><B>Price<o:p></o:p></B></LI>
  <UL style=3D"MARGIN-TOP: 0in" type=3Dcircle>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Zero=20
    Dollars</LI></UL>
  <LI class=3DMsoNormal=20
  style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: =
list .5in"><B>Editor<o:p></o:p></B></LI>
  <UL style=3D"MARGIN-TOP: 0in" type=3Dcircle>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">File=20
    size: unlimited</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Max=20
    number of bookmarks per file: 10</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Smart=20
    bookmarks (new technology): yes! (No other ides have it) When you =
set up a=20
    bookmark, you do NOT have to specify the bookmark id. Also, when you =
want to=20
    go to a bookmark, you are actually shown the book-marked line, =
instead of=20
    the bookmark=92s id! This is super cool (makes your life much =
easier).</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Line=20
    numbering: yes</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Selection=20
    modes: 3 (note that other editors have only 1!) the tree selection =
modes are=20
    (1) complete lines, (2) regular, (3) columns with full drag and drop =

    capabilities.</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Scalable=20
    fonts: yes</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Internet=20
    Explorer style full screen mode: yes</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">HTML=20
    and RTF super fast accurate exports: yes</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Language=20
    independent Brackets matching: yes</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Syntax=20
    coloring for 22 languages (the full list includes, ansi c, ansi c++, =
c#,=20
    java, visual basic (including oop features of vb .net), delphi / =
object=20
    pascal, standard pascal, fortran, cobol, perl, python, java script, =
vb=20
    script, html, xml (any flavor, including xml, wsdl, xsd, xsl, xslt, =
dtd),=20
    php, tcl/tk, foxpro (prg), ansi sql, pl sql, transact sql, idl and, =
of=20
    course, html and assembly!</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Extra=20
    formats supported: Borland forms (dfm &amp; xfm) and windows =
INIs.</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Beautifier=20
    UNDO (unlimited undos and redos).</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Cross=20
    platform capabilities (works excellent with both Windows and UNIX=20
    files).</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Tones=20
    of new useful short-cats</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Coloring=20
    scheme: MS Developer Studio (&amp; .NET) Extended (different color =
for=20
    numbers, strings, symbols).</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Just=20
    in time instantiation (start at line number) =96 for easy =
integration with=20
    external ide-s, programming tools</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Internet=20
    Explorer Full Screen mode: yes (still, same F11).</LI></UL>
  <LI class=3DMsoNormal=20
  style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: =
list .5in"><B>Beautifier<o:p></o:p></B></LI>
  <UL style=3D"MARGIN-TOP: 0in" type=3Dcircle>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Simple,=20
    easy to use, standard front end (gui)</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Over=20
    20 professional options for formatting your source code</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Styles!=20
    (new concept, super easy to use).</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Supports=20
    the following languages, k&amp;r c, ansi c (both 89 and 99), ansi =
c++, java=20
    and c#.</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Invokable=20
    from the command line (from outside the ide): yes.</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Now,=20
    about performance: imagine a very complex c++ file (around 10,000 =
lines). To=20
    beautify something like that=85 well, on a regular machine (under =
2GHz) you=20
    may need=85 under 3 seconds! So, it=92s very fast!</LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Super=20
    fine tuning for formatting options.</LI></UL>
  <LI class=3DMsoNormal=20
  style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: =
list .5in"><B>Publisher<o:p></o:p></B></LI>
  <UL style=3D"MARGIN-TOP: 0in" type=3Dcircle>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">HTML=20
    export (super fast, over 10,000 / second! Regular 7200 rpm WD=20
    HDD)<B><o:p></o:p></B></LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">RTF=20
    export (super fast, over 9,000 / second! Regular 7200 rpm WD=20
    HDD)<B><o:p></o:p></B></LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Combined=20
    with the editor and the beautifier, this is closing the circle! You =
can=20
    create, maintain, beautify/standardize and publish your work at=20
    ease.<B><o:p></o:p></B></LI></UL>
  <LI class=3DMsoNormal=20
  style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: =
list .5in"><B>Integrated=20
  command line prompt<o:p></o:p></B></LI>
  <UL style=3D"MARGIN-TOP: 0in" type=3Dcircle>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">Sometimes,=20
    you need to access the command interpreter (this case, cmd). It is =
nice to=20
    do that from inside the IDE=85 Well, we did provide=20
    that=85<B><o:p></o:p></B></LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">This=20
    comes very handy, as you will normally use it with .net framework, =
or gcc or=20
    bcc (borland free command line compiler). <B><o:p></o:p></B></LI>
    <LI class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: =
list 1.0in">This=20
    makes sense from a programmer point of =
view=85<B><o:p></o:p></B></LI></UL></UL>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Thanks,</P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Daniel &amp;=20
Team<B><o:p></o:p></B></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00B0_01C29583.14EE4850--



------------------------------

Date: Wed, 27 Nov 2002 02:44:46 GMT
From: "Max" <maxslayer@cfl.rr.com>
Subject: Re: Compiling perl for transportability
Message-Id: <ykWE9.220929$fa.4745288@twister.tampabay.rr.com>

Actually, I hadn't really thought about doing that. But thats an idea.

What I really have to do though is deliver our flavor of Perl. It is very
convenient to have the source on site if there are any tweaks that need
attending and we have many scripts.

Thank you for your response.

"Richard S Beckett" <spikey-wan@bigfoot.com> wrote in message
news:as03m7$ma8$1@newshost.mot.com...
>
> "Max" <pbarone@harris.com> wrote in message
> news:b6a773.0211260608.1b97e23@posting.google.com...
> > Hi All,
> >   Is there a way to compile perl and assorted addons, Tk and DBI,
> > etc., so that I can move it to another machine(the same OS), into
> > another directory.
> >   For example, I compile perl in /opt1/perl580. The machine I am going
> > to install it on will not allow me to create a directory or a link in
> > root called /opt1. So what I would like to be able to do is tar that
> > distribution up and place on the other machine in /app/perl580 or
> > whatever.
> >
> > I know this is a strange request but we deliver perl applications to
> > various sites and have to be able to put our support software
> > anywhere.
> >
> > Thanks,
>
> Yes. You can generate a self contained .exe file from your script. It will
> run on machines without perl installed.
>
> Programs to do this are:
> perl2exe - you'll have to search for this.
> perl dev kit from active state -
> http://www.activestate.com/Products/Perl_Dev_Kit/
>
> R.
>
>




------------------------------

Date: Tue, 26 Nov 2002 23:02:47 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: GDGraph module
Message-Id: <261120022302478104%comdog@panix.com>

In article <uu7si2qrf36d16@corp.supernews.com>, Mick Z.
<knjaz@hotmail.com> wrote:

>     I am experimenting with the GD Graph module in creating a Bar Chart.
> The following code produces a 3 column bar chart, but I cannot get the
> columns to have different colors.  They are all being set to the first value
> in the 'dclrs' array.  Any ideas?

> my $data = GD::Graph::Data->new([
> ["1ST","2ND","3ND"],
> [100,200,150],
> ]);

each data set gets one color.  i don't think you can use GDGraph
to do what you're trying to do.

-- 
brian d foy, comdog@panix.com


------------------------------

Date: 26 Nov 2002 20:59:53 -0800
From: oefinger@mit.edu (Matt Oefinger)
Subject: invoking script as perl <scriptname> vs. ./scriptname (with sciptname x perms)
Message-Id: <e9b08c9f.0211262059.3ed85891@posting.google.com>

Why is the behaviour different when I run my script as perl
<scriptname>
as opposed to doing a chmod +x then running ./scriptname. In the
former case I
have no problems with @INC, while in the latter some of my includes
aren't found in @INC. From what I understand I'd have to recompile
Perl to get @INC changed, so I'm currently using a workaround of just
calling my scripts via perl <scriptname>. Why the difference in
behaviour?

Thanks, 
Matt


------------------------------

Date: 27 Nov 2002 02:15:37 GMT
From: ctcgag@hotmail.com
Subject: Re: More hash questions
Message-Id: <20021126211537.143$Ic@newsreader.com>

Bob <bob@bobber.com> wrote:
> Hi,
>
> I have a hash whose structure ends up being like this (according to
> Data::Dumper):
> $VAR1 = {
>            '29' => '123',
 ...
>            '28' => '184'
>          };
>
> I need to find the highest value, and then retrieve it's corresponding
> key... as the key tells me which element (an array reference) in a
> different array is associated with this high value.
>
> My first thought was to reverse sort by value and then just take the
> first key in the hash.  Do I need to do this?  What is the most
> efficient method for this?  In cases of duplicate values, taking the
> first is fine.

The most efficient way for me is this:
  $highkey = (sort {$hash{$a} <=> $hash{$b}} keys %hash)[-1];


The computer may find this more efficient:

keys %hash; #reset iterator just in case.
my ($highkey, $highvalue) = each %hash;
while (my ($key,$value)=each %hash) {
  ($highkey,$highvalue)=($key,value) if $value>$highvalue;
};

All code untested.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


------------------------------

Date: Wed, 27 Nov 2002 03:26:53 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: More hash questions
Message-Id: <3DE43B69.1040206@rochester.rr.com>

Bob wrote:

 ... 
> I have a hash whose structure ends up being like this (according to 
> Data::Dumper):
> $VAR1 = {
>           '29' => '123',
>           '0' => '120',
>           '1' => '161',
 ...


>         };
> 
> I need to find the highest value, and then retrieve it's corresponding 
> key... as the key tells me which element (an array reference) in a 
> different array is associated with this high value.
> 
> My first thought was to reverse sort by value and then just take the 
> first key in the hash.  Do I need to do this?  What is the most 
> efficient method for this?  In cases of duplicate values, taking the 
> first is fine.
> 

 ...

> B
> 

The most efficient method?  Probably something written in assembler.

If you want to find the most efficient way in Perl, why not

     use Benchmark;

and try out a variety of methods and see?

-- 
Bob Walton



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4185
***************************************


home help back first fref pref prev next nref lref last post