[15557] in Perl-Users-Digest
Perl-Users Digest, Issue: 2970 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 7 06:05:31 2000
Date: Sun, 7 May 2000 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957693907-v9-i2970@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 7 May 2000 Volume: 9 Number: 2970
Today's topics:
Re: @array holding %hash <lr@hpl.hp.com>
Re: @array holding %hash <nospam@devnull.com>
Re: [problem solved] sorting hashes by value rather tha <nospam@devnull.com>
AS400 V3R2 and Perl 5.003 <hkleef@anysystems.demon.nl>
Re: converting input to <p></p> pairs via perl <nospam@devnull.com>
Re: Cookie & redirect <vlatko@vlptel.com>
Re: Cookie & redirect <mdjukic@dial.pipex.com>
Re: File Locking? <home@cordova.net>
How do I get the subroutine name of a coderef? (Steve Leibel)
Re: looking for Parse::Yapp simple example <francois@fdesar.net>
Re: More CPerl-mode problems under NT (Ilya Zakharevich)
Re: More CPerl-mode problems under NT <aperrin@davis.DEMOG.Berkeley.EDU>
parsing Unix mailbox <cadams@teleport.com>
Re: parsing Unix mailbox <tmp0001@unixsnedkeren.dk>
Re: Quality of perl implementations <gellyfish@gellyfish.com>
Re: Reading delimited file into hash <home@cordova.net>
Regexp char class: mixing ranges and negation? <ter@my-deja.com>
Re: sorting hashes by value rather than by key in a for <nospam@devnull.com>
Re: sorting hashes by value rather than by key in a for <nospam@devnull.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 6 May 2000 23:53:18 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: @array holding %hash
Message-Id: <MPG.137eb2ba1425abd298aa1d@nntp.hpl.hp.com>
In article <brian-0605002307060001@75.providence-05-10rs.ri.dial-
access.att.net> on Sat, 06 May 2000 23:07:06 -0400, brian d foy
<brian@smithrenaud.com> says...
> In article <8f2irt$qmo$1@216.155.33.54>, The WebDragon <nospam@devnull.com> wrote:
...
> >I'm just curious, being a *gag choke* newbie to some pf the more elegant
> >ways that perl works. what is so 'tricky' about
> >
> > | + @{ $AoA[$i] } = @array; # way too tricky for most programmers
> >
> >and how and when would I use such a construct?
>
> it's probably better just to write
>
> $array[$i] = \@array;
You mean:
$AoA[$i] = \@array;
But that has different semantics. The exact equivalent is:
$AoA[$i] = [ @array ];
And why anyone would choose to write it the 'way too tricky' way is
beyond me!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 May 2000 07:55:39 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: @array holding %hash
Message-Id: <8f37hr$920$3@216.155.33.54>
In article <MPG.137eb2ba1425abd298aa1d@nntp.hpl.hp.com>, Larry Rosler
<lr@hpl.hp.com> wrote:
| In article <brian-0605002307060001@75.providence-05-10rs.ri.dial-
| access.att.net> on Sat, 06 May 2000 23:07:06 -0400, brian d foy
| <brian@smithrenaud.com> says...
| > In article <8f2irt$qmo$1@216.155.33.54>, The WebDragon
| > <nospam@devnull.com> wrote:
|
| ...
|
| > >I'm just curious, being a *gag choke* newbie to some pf the more
| > >elegant
| > >ways that perl works. what is so 'tricky' about
| > >
| > > | + @{ $AoA[$i] } = @array; # way too tricky for most
| > > | programmers
| > >
| > >and how and when would I use such a construct?
| >
| > it's probably better just to write
| >
| > $array[$i] = \@array;
|
| You mean:
|
| $AoA[$i] = \@array;
|
| But that has different semantics. The exact equivalent is:
|
| $AoA[$i] = [ @array ];
|
| And why anyone would choose to write it the 'way too tricky' way is
| beyond me!
that's why I want to know ! I mean, there HAS to be a reason that such a
method of parsing the line was included, aside from the possibility that
it was accidental. =;)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 7 May 2000 08:12:53 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: [problem solved] sorting hashes by value rather than by key in a foreach loop
Message-Id: <8f38i5$920$4@216.155.33.54>
In article <8f37db$920$2@216.155.33.54>, The WebDragon
<nospam@devnull.com> wrote:
| In article <MPG.137e779a9c8a354598aa1c@nntp.hpl.hp.com>, Larry Rosler
| <lr@hpl.hp.com> wrote:
|
| | In article <8f2jki$qmo$3@216.155.33.54> on 7 May 2000 02:15:46 GMT,
| | The
| | WebDragon <nospam@devnull.com> says...
| |
| | ...
| |
| | > but if I wanted to still use the keys, but sort by the VALUE of
| | > that
| | > key
| | > for %gamePlayMult, how would I write this?
| |
| | perlfaq4: "How do I sort a hash (optionally by value instead of
| | key)?"
|
|
| yup, saw that, tried it, got tons of
| # [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
| [Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
| Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
| as a result..
|
| methinks the FAQ could be a little more clear on the use of that $a and
| $b in the context of
|
| use strict;
|
| any further thoughts?
ahh nevermind, I discovered what was happening and worked through it to
achieve a working routine that does what I wanted.
the docs REALLY need to be more succinct about the possibilities of
generating that error..
you see, an inadvertant use of an 'undef' value can also trigger that
response.. even if you would think it would assume a zero value for
comparison purposes if you are used to other similar languages... :)
*sigh* but, I got it working.. thanks for the attempted assistance
anyway :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Sun, 07 May 2000 10:16:30 +0200
From: "H.J. van Kleef" <hkleef@anysystems.demon.nl>
Subject: AS400 V3R2 and Perl 5.003
Message-Id: <3915265E.BAF6F1BE@anysystems.demon.nl>
Hi,
Is there anyone who can help me obtain the 5.003 version of perl for an
AS400 running V3R2?
Thanks
------------------------------
Date: 7 May 2000 07:47:50 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: converting input to <p></p> pairs via perl
Message-Id: <8f3736$920$0@216.155.33.54>
In article
<brian-0605002311250001@75.providence-05-10rs.ri.dial-access.att.net>,
brian@smithrenaud.com (brian d foy) wrote:
| In article <8f2j8b$qmo$2@216.155.33.54>, The WebDragon
| <nospam@devnull.com> wrote:
|
| >breaking this down into a two-pass procedure, what I can derive that I
| >need to do is this:
|
| >first search for every \n that is not also followed by another \n, and
| >replace it with <br>
|
| >then for every chunk of data terminated with \n\n, surround the chunk
| >with <p></p> and put the \n\n after the </p>
|
| >if the last chunk of data has no \n\n after it, or has a <br> at the
| >end
| >(from the first pass), be sure to also wrap it in a <p></p> pair and
| >REMOVE the terminating <br>, adding back a \n\n after the final </p>
|
| >if that looks correct mostly, how would I write sugh beasts using
| >regexps? Anyone?
|
| this seems like a rather complicated way of doing this. it's much
| easier to:
|
| $/ = "\n\n";
|
| while( <> )
| {
| print "<p>$_</p>";
| }
|
well, since the input is coming from a TEXTAREA input field and being
passed to the *same* script (since the entire form is being generated
via CGI.pm) the while( <> ) construct won't work for me ..
| if all of this is wrapped in <p> tags, then there is no need for
| the <br> tags. if there are going to be <br> tags everywhere, why
| use <p>? ;)
two reasons.
#1 : correct html. correct html. correct html. correct html. I like
correct html. I like things that work because they are done correctly
and thus their behaviour is predictable. correct html. need I go on?
#2 :
<p>this is a long multiline paragraph that is going to wrap properly
within a table and probably have a lot of text inside it rambling on and
on and on and on etc etc ad nauseum til I terminate it with </p>
<p>this is a short list of items<br>
that I don't want to break up<br>
and have show a paragraph break<br>
like \n\n show up until I'm ready for it</p>
<p>I like this for these reasons:<br>
+ this is a good thing<br>
+ this is another good thing</p>
<P>I dislike it for these reasons:<br>
- this is a bad thing<br>
- this is another bad thing<br>
- this is yet another very bad thing</p>
get the idea ?
see the original post for the script and the "bad" output, as opposed to
my preferred "good" output, and you'll clearly see what the above is all
about.
arbitrary <br> tags within a resizable table paragraph do NOT good
formatting practices make.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Sat, 6 May 2000 23:08:55 -0500
From: Vlatko Primorac <vlatko@vlptel.com>
Subject: Re: Cookie & redirect
Message-Id: <Pine.LNX.4.10.10005062255500.5559-100000@michelangelo.vlptel.com>
> I'd like to send a cookie and then redirect, but it doesn't work at all.
> Here is my portion of code:
>
> my
> $cookie=$q->cookie(-name=>'moonkey_exchange',-value=>'Hi',-expires=>'+37y');
>
> print $q->header(-cookie=>$cookie);
>
> #print CGI->redirect(-uri=>$url,-nph=>1);
You should not mix normal header generation with CGI->redirect. You will
only end up with double header sent, or something even worse. If you
decided to use CGI->redirect call, it will create html headers for you. If
you want to set a cookie, you should add it to the CGI module generated
header, not send a partial header with the cookie, then send the complete
one from CGI module without a cookie. perldoc on CGI will tell you not to
send your own headers if you're using the CGI->redirect.
To add a cookie to CGI->redirect generate header, here's a code example
from http://developer.irt.org/. I hope it works for you, I've never tried
it myself. Beware, some browsers might not be entirely happy accepting
the cookie within the 30x server response, so I would recommend testing
the code behavior on all versions of browsers you claim to support.
Good luck, and please let me know if it worked for you.
Vlatko
use CGI qw(:cgi);
my $q = CGI->new();
my $cookie = $q->cookie(
-name => 'yummy_cookie',
-value => 'chocolate chip',
-domain => '.irt.org',
-expires => '+10d',
-path => '/'
);
print $q->redirect(
-url => 'http://www.irt.org/index.htm',
-cookie => $cookie
);
------------------------------
Date: Sun, 7 May 2000 10:09:52 -0700
From: "Marko Djukic " <mdjukic@dial.pipex.com>
Subject: Re: Cookie & redirect
Message-Id: <8f3brg$13$1@lure.pipex.net>
Vlatko,
You appear to be using cgi.pm.....................unfortunately, the
header command issues a 'Content-type.....' directive. This is not what
you want, as the redirect will not work.................been there done it.
We finally decided not to use cgi.pm and things worked fine.
Regards
Marko Djukic
Vlatko Primorac wrote in message ...
>
>> I'd like to send a cookie and then redirect, but it doesn't work at all.
>> Here is my portion of code:
>>
>> my
>>
$cookie=$q->cookie(-name=>'moonkey_exchange',-value=>'Hi',-expires=>'+37y');
>>
>> print $q->header(-cookie=>$cookie);
>>
>> #print CGI->redirect(-uri=>$url,-nph=>1);
>
>You should not mix normal header generation with CGI->redirect. You will
>only end up with double header sent, or something even worse. If you
>decided to use CGI->redirect call, it will create html headers for you. If
>you want to set a cookie, you should add it to the CGI module generated
>header, not send a partial header with the cookie, then send the complete
>one from CGI module without a cookie. perldoc on CGI will tell you not to
>send your own headers if you're using the CGI->redirect.
>
>To add a cookie to CGI->redirect generate header, here's a code example
>from http://developer.irt.org/. I hope it works for you, I've never tried
>it myself. Beware, some browsers might not be entirely happy accepting
>the cookie within the 30x server response, so I would recommend testing
>the code behavior on all versions of browsers you claim to support.
>
>Good luck, and please let me know if it worked for you.
>
>Vlatko
>
>
>use CGI qw(:cgi);
>
>my $q = CGI->new();
>my $cookie = $q->cookie(
> -name => 'yummy_cookie',
> -value => 'chocolate chip',
> -domain => '.irt.org',
> -expires => '+10d',
> -path => '/'
> );
>print $q->redirect(
> -url => 'http://www.irt.org/index.htm',
> -cookie => $cookie
> );
>
------------------------------
Date: Sun, 07 May 2000 01:10:16 -0600
From: Peter <home@cordova.net>
Subject: Re: File Locking?
Message-Id: <391516D8.F14AB4E1@cordova.net>
Gabe wrote:
>
> A CGI script opens up a text database and writes to it.
>
> What happens if that script is executed simultaneously by two separate
> users? Do I have a problem? Will the data get mangled? Do I need to look
> into some sort of file locking module? Where can I find information about
> this issue? A perldoc reference would be fine.
You might want to look at this:
http://www.rede.com/samples/dblock.html
It is a TC script from the must have "Perl Cookbook". The page is in
frames
so you can start the script multiple times (pop up in windows) and see
the locks granted as appropriate.
Peter
------------------------------
Date: Sun, 07 May 2000 00:21:25 -0700
From: stevel@coastside.net (Steve Leibel)
Subject: How do I get the subroutine name of a coderef?
Message-Id: <stevel-0705000021250001@192.168.100.2>
Suppose I have a coderef:
$fooref = \&foo;
Later in the program for debugging purposes I would like to recover the
name of the referenced subroutine from the coderef. In other words given
$fooref, how do I get "foo"?
Needless to say simply dereferencing, as in
$name = &$fooref; # doesn't work
doesn't give me back the name, it calls the subroutine.
Thanks,
Steve L
stevel@coastside.net
------------------------------
Date: Sun, 07 May 2000 11:30:26 +0200
From: =?iso-8859-1?Q?Fran=E7ois=20D=E9sarm=E9nien?= <francois@fdesar.net>
Subject: Re: looking for Parse::Yapp simple example
Message-Id: <391537B2.90C3D146@fdesar.net>
Tim Richardson wrote:
>
> I want to use Parse::Yapp to process a BAI bank statement. The grammar
> is simple, but I've never used Bison or Yapp. Writing the grammar
> doesn't look too hard, but I don't understand how I put everything
> together. For instance, what does a lexer look like? I'm wondering if
> anyone has a simple, complete example of a Perl script that parses
> something simple using Parse::Yapp.
>
Well, sorry to be late for this answer, but the clpm volume is so high
I simply cannot follow it :-(
Well, I wrote the Parse::Yapp module, so maybe I can help ;-)
You're right, writing a grammar is not *that* difficult, but there are
some pitfalls you should be aware, mostly when using rules which can
be empty. The bison tutorial is a *very* good starting point to understand
those pitfalls.
To put everything together, you've got with Parse-Yapp tarball two examples:
the first one is the (simple) Calc.yp, and the other one is the YappParse.yp
which is Parse::Yapp parser source.
Both of them have their scanner/lexer included in the .yp file, and "to put
everything together", just follow the way I do it, it rather simple.
YappParse.yp lexer is a little bit more sophisticated in a sense it changes
state between sections, a technique which can be very useful in many lexers.
If you have questions, don't hesitate to ask me directly,
François
------------------------------
Date: 7 May 2000 04:19:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: More CPerl-mode problems under NT
Message-Id: <8f2qsq$7p5$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Andrew Perrin - Demography
<aperrin@davis.DEMOG.Berkeley.EDU>],
who wrote in article <u5kitwr5f4d.fsf@davis.DEMOG.Berkeley.EDU>:
> This behavior is reproducible under the following condition:
[etc]
Not with 4.29. ;-) [I did not make it the default yet.]
Ilya
------------------------------
Date: 06 May 2000 21:39:33 -0700
From: Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU>
Subject: Re: More CPerl-mode problems under NT
Message-Id: <u5ksnvvc6t6.fsf@davis.DEMOG.Berkeley.EDU>
Tom Phoenix <rootbeer@redcat.com> writes:
> On 6 May 2000, Andrew Perrin - Demography wrote:
>
> > The problem is that commonly, when I begin a new line by typing the
> > characters m or s (possibly others, but these are the ones I've
> > noticed because they begin 'my' and 'sub', respectively),
>
> I don't have a solution, but I'd guess that they're trying to be m// and
> s/// - do you also notice this with the letter y? If so, maybe that's a
> clue about where to look in the code to see what to fix.
Excellent detective work - y does it too.
>
> > Any advice will be appreciated.
>
> Turn off syntax coloring. :-)
'Doctor, it hurts when I do this!'
'Well, don't do that...'
ap
--
---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography - University of California at Berkeley
2232 Piedmont Avenue #2120 - Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199
------------------------------
Date: Sat, 06 May 2000 23:55:48 -0700
From: Christopher Adams <cadams@teleport.com>
Subject: parsing Unix mailbox
Message-Id: <39151374.C9B8963B@teleport.com>
I am just starting to plan a routine that will run something like this:
1- Email messages will come into a Unix style mailbox. The subject of
each message will have a unique string (a client's name/identifier).
There will be a text file of email addresses, each address beginning
with the unique string.
2- Either each message will be parsed as it arrives, or the entire
mailbox will be parsed at night (using cron). The message or mailbox
will be queried for the unique string(name) and if it matches the string
in the text file, the email will be forwarded to that address, adding
some stock text to each one.
I am fairly new to Perl, so I would like to find out if my approach is
a good one and if anyone has done this sort of thing before. Are there
any scripts that I could look at to get some ideas?
--
Christopher Adams
cadams@teleport.com
------------------------------
Date: Sun, 07 May 2000 09:33:51 +0200
From: Thorbjoern Ravn Andersen <tmp0001@unixsnedkeren.dk>
Subject: Re: parsing Unix mailbox
Message-Id: <39151C5F.F09EE153@unixsnedkeren.dk>
Christopher Adams wrote:
> I am fairly new to Perl, so I would like to find out if my approach is
> a good one and if anyone has done this sort of thing before. Are there
> any scripts that I could look at to get some ideas?
Yes. I found MIME::Tools from www.cpan.org very helpful in writing
something similar. You want your script to be called from ~/.forward or
~/.procmailrc
When you are at CPAN, search for SMTP to find a module to help you send
an email.
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://www.mip.sdu.dk/~ravn
------------------------------
Date: 7 May 2000 02:22:36 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Quality of perl implementations
Message-Id: <8f2ggs$sh8$1@orpheus.gellyfish.com>
On Sun, 07 May 2000 06:33:24 +0930 Henry wrote:
> In article <MPG.137cc17b59c765498aa08@nntp.hpl.hp.com>, Larry Rosler
> <lr@hpl.hp.com> wrote:
>
>> > Look, don't get me wrong, I think Perl's great. It forgives me when I
>> > make mistakes, and I forgive it when it makes mistakes. That makes for
>> > a very warm and fuzzy relationship. Tolerance is, however, not a trait
>> > of mission-critical programming languages (and compilers) - they are
>> > cold, prickly, but can be relied upon when the <objectionable object>
>> > hits the fan.
> ...
>> I am troubled by your laissez-faire attitude with regard to perl.
>
> ??? My dictionary (getting a lot of use lately, it seems) defines
> laissez-faire as a government policy of non-interference. Given that
> definition, I'm not sure I understand the above sentence. Sorry.
>
Perhaps you should have consulted a French dictionary - I suppose its
best put as 'leave it be' ... Though one would generally make the
metaphoric leap from the received definition as you have it above to the
more general sense without difficulty.
>
>> Should encouraging willing contributors to invest more time on quality
>> of implementation become a higher priority than continually adding
>> features?
>
> I don't think so. If someone needs mission-critical code, they already
> have plenty of languages and compilers to choose from that will give it
> to them. I don't think we need another one.
>
I think you missed Larry's point which was that instead of striving to
add new and ever more exotic features to Perl we should direct our
attentions to improving the quality of the implementation, not so that
people might make avionics programs with it, but so that it can be
objectively said to be correct. At least I think thats what he meant :)
/J\
--
I know you can read my thoughts, boy: Meow, Meow, Meow, Meow, Meow,
Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow.
--
fortune oscar homer
------------------------------
Date: Sun, 07 May 2000 01:23:49 -0600
From: Peter <home@cordova.net>
Subject: Re: Reading delimited file into hash
Message-Id: <39151A05.DD990C42@cordova.net>
agodfrey1118@my-deja.com wrote:
>
> I need to read a text file (/share/answer.txt) into a hash. The file is
> currently delimited with ~ but delimiting character could be changed if need
> be. I can work out the rest of the script if I could get that file imported.
> I have only written a few scripts before but I'm having trouble getting
> started with this one b/c I can't figure out how to get that to work, even
> after RTFM. TIA for any help.
You should know how to do that. I suggest looking at the use of hash
slices (search this ng for examples).
If you are creating something other than a throwaway I would suggest
using the following:
http://search.cpan.org/doc/JWIED/DBD-CSV-0.1022/lib/DBD/CSV.pm
Peter
------------------------------
Date: Sun, 07 May 2000 06:51:03 GMT
From: Tim Richardson <ter@my-deja.com>
Subject: Regexp char class: mixing ranges and negation?
Message-Id: <8f33ol$j4s$1@nnrp1.deja.com>
I'm lazy. I want a regular expression that will match all visible
characters (7-bit will do) except , and /
I don't think there is any notation that lets me specify such a
character class easily, so I am stuck with making ranges that exclude
the characters I don't want.
This would be a real pain if I wanted to move beyond 7-bit characters.
What are some smarter ways of doing this?
I am interested in a regular expression because I am working with the
RecDescent module, which uses regular expressions to find tokens. I
have some text fields which are not allowed to contain . and /
--
Tim Richardson
(search string: qweeblebeast)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 7 May 2000 07:51:10 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: sorting hashes by value rather than by key in a foreach loop
Message-Id: <8f379e$920$1@216.155.33.54>
In article
<Pine.GSO.4.10.10005061951330.3921-100000@user2.teleport.com>, Tom
Phoenix <rootbeer@redcat.com> wrote:
| On 7 May 2000, The WebDragon wrote:
|
| > @Gkeys = sort {
| > $scoresG{$a} <=> $scoresG{$b}
| > ||
| > length($namesList{$a}) <=> length($namesList{$b})
| > ||
| > $namesList{$a} cmp $namesList{$b}
| > } keys %scoresG;
| >
| > all I wind up with is tons of this:
|
| > # [Sat May 6 22:28:24 2000] Dev:Pseudo: # Use of uninitialized value.
|
| Could you have some keys in %scoresG which don't have defined values in
| %namesList? Cheers!
my %namesList = (
fun => "Fun Factor",
play => "Playability",
bots => "Bots",
flow => "Flow",
weap => "Items",
theme => "Theme",
arch => "Architecture",
light => "Lighting",
textu => "Textures",
sound => "Sound"
);
my %gameplayMult = (
fun => '0.35',
play => '0.2',
bots => '0.2',
flow => '0.15',
weap => '0.1',
);
my $environBaseMult = '0.3';
my %environMult = (
theme => '0.25',
arch => '0.2',
light => '0.2',
textu => '0.2',
sound => '0.15',
);
# (default values only; the keys are consistent either way.. these get
input later in the script and put in the hash before the above bits get
executed)
my %scoresG = (
fun => undef,
play => undef,
bots => undef,
flow => undef,
weap => undef,
);
my %scoresE = (
theme => undef,
arch => undef,
light => undef,
textu => undef,
sound => undef,
);
possible, but unlikely. good thought though. :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 7 May 2000 07:53:15 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: sorting hashes by value rather than by key in a foreach loop
Message-Id: <8f37db$920$2@216.155.33.54>
In article <MPG.137e779a9c8a354598aa1c@nntp.hpl.hp.com>, Larry Rosler
<lr@hpl.hp.com> wrote:
| In article <8f2jki$qmo$3@216.155.33.54> on 7 May 2000 02:15:46 GMT, The
| WebDragon <nospam@devnull.com> says...
|
| ...
|
| > but if I wanted to still use the keys, but sort by the VALUE of that
| > key
| > for %gamePlayMult, how would I write this?
|
| perlfaq4: "How do I sort a hash (optionally by value instead of key)?"
yup, saw that, tried it, got tons of
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
# [Sun May 7 03:51:44 2000] Dev:Pseudo: # Use of uninitialized value.
[Sun May 7 03:51:44 2000] Dev:Pseudo: File 'Primus 8.5GB:Web
Pages:cgi-scripts:ncrp:nctest4.acgi'; Line 274
as a result..
methinks the FAQ could be a little more clear on the use of that $a and
$b in the context of
use strict;
any further thoughts?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 2970
**************************************