[13796] in Perl-Users-Digest
Perl-Users Digest, Issue: 1206 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 28 00:05:45 1999
Date: Wed, 27 Oct 1999 21:05:16 -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: <941083516-v9-i1206@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Oct 1999 Volume: 9 Number: 1206
Today's topics:
adding data to beginning of file <amwalker@gate.net>
Re: adding data to beginning of file <lr@hpl.hp.com>
Re: adding data to beginning of file <rootbeer@redcat.com>
Re: Circular buffering (Neil Cherry)
Re: comparing text with words <ltl@rgsun40.viasystems.com>
Re: comparing text with words <lr@hpl.hp.com>
Re: comparing text with words (Abigail)
DBM passwords (Jim)
Re: DBM passwords (Martien Verbruggen)
Re: Drop the last item from the Environment string (CGI <wyzelli@yahoo.com>
Re: Email::Valid module and rfc compliant addresses (Abigail)
EXECUTE <procname> with Oraperl (NetComrade )
file sorting,, repeated <spyder@pikesville.net>
Re: file sorting,, repeated <spyder@pikesville.net>
Re: file sorting,, repeated <bwalton@rochester.rr.com>
Re: file sorting,, repeated <lr@hpl.hp.com>
Re: file sorting,, repeated <spyder@pikesville.net>
Forcing a submit brsuresh@my-deja.com
hashing issues from Perl Cookbook (trying to do CS grap <jjjoy@tri.sbc.com>
How to compare files in different directories ? <achin@inprise.com>
Re: HTML Table to Array? <rootbeer@redcat.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Oct 1999 21:02:38 -0400
From: Aaron Walker <amwalker@gate.net>
Subject: adding data to beginning of file
Message-Id: <3817A0AE.AB1C957B@gate.net>
I am attempting to write a perl script that writes data to the beginning
of a file. The way I plan on doing this is by reading in the current
data file into say @data, then writing the current data into the file,
then writing the data in @data after the current data. Is there a
fuction that does this or another easier way of doing this in perl?
thanks,
Aaron
------------------------------
Date: Wed, 27 Oct 1999 19:14:44 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: adding data to beginning of file
Message-Id: <MPG.12815161731c944398a147@nntp.hpl.hp.com>
In article <3817A0AE.AB1C957B@gate.net> on Wed, 27 Oct 1999 21:02:38 -
0400, Aaron Walker <amwalker@gate.net> says...
> I am attempting to write a perl script that writes data to the beginning
> of a file. The way I plan on doing this is by reading in the current
> data file into say @data, then writing the current data into the file,
> then writing the data in @data after the current data. Is there a
> fuction that does this or another easier way of doing this in perl?
perlfaq5: "How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the beginning of a
file?" Though I would say 'prepend' instead of 'add' or' append'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 27 Oct 1999 20:45:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: adding data to beginning of file
Message-Id: <Pine.GSO.4.10.9910272045170.29843-100000@user2.teleport.com>
On Wed, 27 Oct 1999, Aaron Walker wrote:
> Subject: adding data to beginning of file
Have you seen section five of the FAQ? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 28 Oct 1999 01:30:23 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: Re: Circular buffering
Message-Id: <slrn81f9n2.b7n.njc@dmc.uucp>
On 27 Oct 1999 17:37:35 GMT, M.J.T. Guy wrote:
>In article <slrn81bddi.36g.njc@dmc.uucp>, Neil Cherry <ncherry@home.net> wrote:
>>I'm interested in using circular buffering in my Perl program. Does
>>anyone have code examples of how to accomplish this?
>
>Use an array, say @buff, to hold the buffer.
>
>Then push @buff, $item; # add $item to @buff
> my $item = shift @buff # take $item from @buff
>
>Contrary to what you might guess, these are efficient operations even
>if the buffer gets large ( O(1) most of the time ), as Perl is careful
>to avoid unnecessary shifting or copying of arrays.
I see I have caused some confusion but I have gained further knowledge
in the process. I was unaware of push/pull shift/unshift etc.
What I meant by circular buffers is a fixed size array were a pointer
points to the current position in the array to put new characters and
a pointer that points to the last read character. I come from an
assembly/C background and these are common in interrupt routines. I
have to read characters from the serial port and need to send a bunch
first then react to the characters then send a response based on the
the characters just read.
--
Linux Home Automation Neil Cherry ncherry@home.net
http://members.home.net/ncherry (Text only)
http://meltingpot.fortunecity.com/lightsey/52 (Graphics GB)
------------------------------
Date: 28 Oct 1999 00:48:08 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: comparing text with words
Message-Id: <7v86g8$1l8$1@rguxd.viasystems.com>
Larry Rosler <lr@hpl.hp.com> wrote:
:>The following snippet uses the same method, but has a *much* lower golf
:>score:
:>my $string = 'sub { local $_ = shift;' .
:> join('||' => map "/$_/o" => @pats) . '}';
Have you guys declared that '=>' counts as a single char in
golf now? I mostly buy into your argument that it makes things
clearer (mostly), but surely you aren't going to increase your
handicap for the sake of clarity. :-)
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Wed, 27 Oct 1999 19:03:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: comparing text with words
Message-Id: <MPG.12814ede7f626fa898a146@nntp.hpl.hp.com>
In article <7v86g8$1l8$1@rguxd.viasystems.com> on 28 Oct 1999 00:48:08
GMT, lt lindley <ltl@rgsun40.viasystems.com> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> :>The following snippet uses the same method, but has a *much* lower golf
> :>score:
>
> :>my $string = 'sub { local $_ = shift;' .
> :> join('||' => map "/$_/o" => @pats) . '}';
>
> Have you guys declared that '=>' counts as a single char in
> golf now? I mostly buy into your argument that it makes things
> clearer (mostly), but surely you aren't going to increase your
> handicap for the sake of clarity. :-)
'*much* lower' ne 'lowest possible'. Compare that code to what it
replaced.
Actually, the 'fat comma' feels so natural by now that I didn't even
notice it! Read it as 'to' in the code above.
There seems to be a schism developing over this. Randal wants me to
stop showing it here (and show it only in hash initializations); TomC
approves of it as an arument separator; Abigail has been using it more
often as the controversy increases. :-)
Randal's main objection is worth passing on. In code like this:
join FOO => @bar;
join FOO, @bar;
the semantics depend on whether FOO is a bareword or a (constant)
subroutine. This may be a trap for the unwary.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 27 Oct 1999 21:39:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: comparing text with words
Message-Id: <slrn81fdqf.66b.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCXLIX September MCMXCIII in
<URL:news:MPG.12814ede7f626fa898a146@nntp.hpl.hp.com>:
^^
^^ There seems to be a schism developing over this. Randal wants me to
^^ stop showing it here (and show it only in hash initializations); TomC
^^ approves of it as an arument separator; Abigail has been using it more
^^ often as the controversy increases. :-)
I tend to use it in function calls between arguments that play
different roles. For instance, after the first arguments of split,
join, push, splice, etc.
^^ Randal's main objection is worth passing on. In code like this:
^^
^^ join FOO => @bar;
^^
^^ join FOO, @bar;
^^
^^ the semantics depend on whether FOO is a bareword or a (constant)
^^ subroutine. This may be a trap for the unwary.
Well, yes, while this is true, this isn't an argument about using =>
in certain contexts. It would be an argument about *any* construct
that autoquotes barewords - including hash indexing.
$hash {FOO}
is the same trap for the same unware people.
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 28 Oct 1999 02:56:57 GMT
From: jim@jimmo.freeuk.com (Jim)
Subject: DBM passwords
Message-Id: <3818bac3.12929153@news.freeuk.net>
Hello,
I have just writen a perl script to write to a DBM file my web server.
However, when i download the dbm file back to my hard drive and try to
view it in access2000 it asks me for a password.
What password ??? I didn't assign one as far a i know ??
Any ideas so i can view the contents offline ??
Many thanks
Jim
------------------------------
Date: Thu, 28 Oct 1999 03:08:12 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: DBM passwords
Message-Id: <w6PR3.190$z73.5185@nsw.nnrp.telstra.net>
On Thu, 28 Oct 1999 02:56:57 GMT,
Jim <jim@jimmo.freeuk.com> wrote:
> Hello,
>
> I have just writen a perl script to write to a DBM file my web server.
Did you do this with the dbmopen functions, or one of the dbm modules?
> However, when i download the dbm file back to my hard drive and try to
> view it in access2000 it asks me for a password.
access 2000? Is that MS Access? I don't think that can read dbm files
at all. The dbm in dbmopen is not the dbm in Microsoft, AFAIK. I guess
that that may be your problem.
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Thu, 28 Oct 1999 13:02:56 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Drop the last item from the Environment string (CGI)
Message-Id: <ItPR3.4$5I2.1371@vic.nntp.telstra.net>
Tom Phoenix <rootbeer@redcat.com> wrote in message
news:Pine.GSO.4.10.9910271054440.29843-100000@user2.teleport.com...
> On Wed, 27 Oct 1999, Wyzelli wrote:
>
> > I need to drop the last item from a CGI environment (POST), everything
> > after the & before the last item. I need to lose the full name=value
> > pair.
> >
> > Does anyone know a simple way to do this?
>
> This request is unclear. Here are two possible interpretations.
>
> 1. You want to make a CGI program which ignores part of its input. (Why?)
> You can do this with the CGI module, though, by simply ignoring or
> deleting the item.
I guess this is the closer of the two.. I shall elaborate (this as much for
my personal edification and enlightenment).
I have a cgi form which sends some 30 fields in a post. This data is
written to a text file which another program then interprets. This 'other
program' I have no control over. The format as specified is the entire
environment string (complete with &, = etc).
The input is read by:
read(STDIN, $buffer, $ENV{"CONTENT_LENGTH"})
In order to get a little nicer for the user, I manipulate $buffer string to
perform simple input error checking on required fields. This involves
splitting the variable. The results are then printed out to the user as
html giving them a choice to complete a second (or subsequent) form.
Original post data is included as hidden fields to auto-fill the second
form, dynamically created by a second script, which takes as it's input, the
post of data provide from the form output by the first. This prints a form
similar to the originating form, but with all the user info already
completed. This form then supplies data to the first script as though it
were the first form. No problems so far.
Now the tricky bit. I am trying to keep track of how many times this user
completes this form (not for permanent records, just to display for
something like form # x on each subsequent form). The way I came up with to
do this is to add another variable to the forms, which I increment each time
through the loop. All fine except I do NOT want to write this variable into
the output file, as it is extraneous information and stuffs up the 'other
program'.
I was originally using CGI for this except for a reason I have not yet been
able to fathom, reading the environment before the $query = new CGI; line
causes the script to hang. The other issue is that CGI takes all the &, =,
+ etc out so before I print to the file I have to put them all back as 'the
other program' wants them.
The way I am accomplishing this at the moment is by splitting and then
joining the environment string minus the last item. I just figured I was
doing it the hard way.
I was reading something about the index of an array in a post yesterday, and
whilst it was not exactly what I need, I think it is on the right track.
If I could read the environment into an array, find out how many items are
in the array, then print the array minus the last item, I think that may be
something like what I need to accomplish.
I confess this is not so much a need as I have it working, as an attempt to
find a better way.
Any comments are appreciated.
Wyzelli
------------------------------
Date: 27 Oct 1999 20:33:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Email::Valid module and rfc compliant addresses
Message-Id: <slrn81f9uf.66b.abigail@alexandra.delanet.com>
brian d foy (brian@smithrenaud.com) wrote on MMCCXLVIII September
MCMXCIII in <URL:news:brian-ya02408000R2710990948100001@news.panix.com>:
[]
[] if you want RFC822 compliant email addresses, check out abigail's
[] RFC::RFC822::Validate module. it uses Parse::RecDescent rather
[] than a regex kludge. :)
That's RFC::RFC822::Address.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 27 Oct 1999 17:58:14 GMT
From: netcomradeNOSPAM@earthlink.net (NetComrade )
Subject: EXECUTE <procname> with Oraperl
Message-Id: <38173caa.252575960@news.earthlink.net>
DOes anybody know how to EXECUTE procedures from ORAPERL?
A piece of code would be nice....
We had been experience a problem where the scripts simply exits
Thanx
------------------------------
Date: Wed, 27 Oct 1999 22:23:08 -0400
From: "V.B." <spyder@pikesville.net>
Subject: file sorting,, repeated
Message-Id: <3817B38C.C1A12A54@pikesville.net>
HI!
im back with my sorting questions. what am i doing wrong?
this is my code:
open (FILE,"<./stats.log")
@rate = (map substr($_, 1 + rindex $_,"\0") =>
reverse sort
map +(split /;/)[6]."\0$_" =>
<FILE>);
close (FILE);
open (FILE,">./rate.log")
print FILE @rate;
this is the info i want sorted:
Stats.log
Test2; 1; 1; 0; 3.05681818181818; 0.0458333333333332;
148.257575757576; 9; 9; 941060527
Test3; 1; 1; 0; 1.36363636363636; 0.889328063241107;
-20.7509881422927; 6; 6; 941060527
test4; 1; 0; 0; 20;
0; 2000;
3; 3; 941005792
test5; 0; 1; 0; 0;
0.05;
-5; 3; 3; 941005792
SF; 1; 0; 0; -8.33333333333333;
0; -833.333333333333; 4;
4; 941005824
Aki; 0; 0; 0; 0;
0;
0; 0; 0; 941047957
^
this is how it comes
out:
Rate.log
test4; 1; 0; 0; 20;
0;
2000; 3; 3; 941005792
Test2; 1; 1; 0; 3.05681818181818; 0.0458333333333332;
148.257575757576; 9; 9; 941060527
Aki; 0; 0; 0; 0;
0;
0; 0; 0; 941047957
SF; 1; 0; 0; -8.33333333333333;
0; -833.333333333333; 4;
4; 941005824
test5; 0; 1; 0; 0;
0.05;
-5; 3; 3; 941005792
Test3; 1; 1; 0; 1.36363636363636;
0.889328063241107; -20.7509881422927; 6; 6; 941060527
^
i want the carated column sorted, highest value first. Any thoughts
here?
vince
------------------------------
Date: Wed, 27 Oct 1999 22:34:08 -0400
From: "V.B." <spyder@pikesville.net>
Subject: Re: file sorting,, repeated
Message-Id: <3817B620.7953B02B@pikesville.net>
well that got messed up,, lol
anyways
im back with my sorting questions. what am i doing wrong?
this is my code:
open (FILE,"<./stats.log")
@rate = (map substr($_, 1 + rindex $_,"\0") =>
reverse sort
map +(split /;/)[6]."\0$_" =>
<FILE>);
close (FILE);
open (FILE,">./rate.log")
print FILE @rate;
this is the info i want sorted:
Stats.log
Test2; 0; 148.257575757576; 9; 9;
Test3; 0; -20.7509881422927; 6; 6;
test4; 1; 2000; 3; 3;
test5; 0; -5; 3; 3;
SF; 1; 0; -833.333333333333; 4; 4;
Aki; 0; 0; 0; 0;
this is how it comes out:
Rate.log
test4; 1; 2000; 3; 3;
Test2; 1; 148.257575757576; 9; 9;
Aki; 0; 0; 0; 0;
SF; 1; -833.333333333333; 4; 4;
test5; 0; -5; 3; 3;
Test3; 1; -20.7509881422927; 6; 6;
i want the third column sorted, highest value first. Any thoughts here?
vince
------------------------------
Date: Wed, 27 Oct 1999 23:04:48 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: file sorting,, repeated
Message-Id: <3817BD50.32C46842@rochester.rr.com>
"V.B." wrote:
...
> this is my code:
>
> open (FILE,"<./stats.log")
> @rate = (map substr($_, 1 + rindex $_,"\0") =>
> reverse sort
> map +(split /;/)[6]."\0$_" =>
> <FILE>);
> close (FILE);
> open (FILE,">./rate.log")
> print FILE @rate;
>
> this is the info i want sorted:
>
> Stats.log
>
> Test2; 0; 148.257575757576; 9; 9;
> Test3; 0; -20.7509881422927; 6; 6;
> test4; 1; 2000; 3; 3;
> test5; 0; -5; 3; 3;
> SF; 1; 0; -833.333333333333; 4; 4;
> Aki; 0; 0; 0; 0;
>
> this is how it comes out:
>
> Rate.log
>
> test4; 1; 2000; 3; 3;
> Test2; 1; 148.257575757576; 9; 9;
> Aki; 0; 0; 0; 0;
> SF; 1; -833.333333333333; 4; 4;
> test5; 0; -5; 3; 3;
> Test3; 1; -20.7509881422927; 6; 6;
>
> i want the third column sorted, highest value first. Any thoughts here?
>
> vince
Well, there are a couple of problems:
1. The two open statements need semicolons, or it won't compile.
They also need " or die ...".
2. If you want to sort the third column, the [6] should be [2].
You don't even have a seventh column of data.
3. Your data is numeric, so you probably want to be doing a
numeric sort instead of a lexical sort. Add
{$a<=>$b}
after the word "sort" in your code. You might consider
deleting the "reverse" and making that
{$b<=>$a}
--
Bob Walton
------------------------------
Date: Wed, 27 Oct 1999 20:34:19 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: file sorting,, repeated
Message-Id: <MPG.12816416a5f047a198a148@nntp.hpl.hp.com>
In article <3817B38C.C1A12A54@pikesville.net> on Wed, 27 Oct 1999
22:23:08 -0400, V.B. <spyder@pikesville.net> says...
> im back with my sorting questions. what am i doing wrong?
>
> open (FILE,"<./stats.log")
or die "Couldn't open stats.log. $!\n";
> @rate = (map substr($_, 1 + rindex $_,"\0") =>
> reverse sort
> map +(split /;/)[6]."\0$_" =>
> <FILE>);
> close (FILE);
> open (FILE,">./rate.log")
> print FILE @rate;
OK, so you are trying to do a reverse sort based on the *string* which
is the seventh field when splitting on /;/. (I would split on
/\s*;\s*/, but that's not the real problem.)
> this is the info i want sorted:
>
> Stats.log
>
> Test2; 1; 1; 0; 3.05681818181818; 0.0458333333333332;
> 148.257575757576; 9; 9; 941060527
I assume that this is a folded line. The seventh field is a string
representation of a floating-point number. Unfortunately, these don't
sort properly as strings, but must be converted into their internal
binary representations, which are then sorted as strings. This is the
trickiest of all the string conversions.
The recipe for how to do that in a hardware-independent (i.e., 'endian'-
independent) way, assuming IEEE standard binary encoding, is given in
Appendix B of our paper
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/sorting.html>.
BEGIN {
my $big_endian = pack('N', 1) eq pack('L', 1); # 1
sub double_sort ($) {
($big_endian ? pack 'd', $_[0] : reverse pack 'd', $_[0]) ^ # 2
($_[0] < 0 ? "\xFF" x 8 : "\x80" . "\x00" x 7) # 3
}
}
Comments on this code:
1. An experiment to determine the endian-ness.
2. Packing according to the endian-ness.
3. Fudging the bits so that negative numbers sort below positive
numbers.
> i want the carated column sorted, highest value first. Any thoughts
> here?
You can use 'reverse' on the sorted results if you wish, but it is
easier simply to negate the arguments to double_sort().
Uri Guttman will make this a lot easier by encapsulating the packing
functions into the Sort::Records module, available Real Soon Now. :-)
In the meantime, use the code above, or -- last resort -- use the
Schwartz to do simple number comparisons instead of string comparisons.
Worse things have happened.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 28 Oct 1999 03:44:56 GMT
From: "V.B." <spyder@pikesville.net>
Subject: Re: file sorting,, repeated
Message-Id: <3817C59A.DD9180CA@pikesville.net>
Bob Walton wrote:
> "V.B." wrote:
> ...
> > this is my code:
> >
> > open (FILE,"<./stats.log")
> > @rate = (map substr($_, 1 + rindex $_,"\0") =>
> > reverse sort
> > map +(split /;/)[6]."\0$_" =>
> > <FILE>);
> > close (FILE);
> > open (FILE,">./rate.log")
> > print FILE @rate;
> >
> > this is the info i want sorted:
> >
> > Stats.log
> >
> > Test2; 0; 148.257575757576; 9; 9;
> > Test3; 0; -20.7509881422927; 6; 6;
> > test4; 1; 2000; 3; 3;
> > test5; 0; -5; 3; 3;
> > SF; 1; 0; -833.333333333333; 4; 4;
> > Aki; 0; 0; 0; 0;
> >
> > this is how it comes out:
> >
> > Rate.log
> >
> > test4; 1; 2000; 3; 3;
> > Test2; 1; 148.257575757576; 9; 9;
> > Aki; 0; 0; 0; 0;
> > SF; 1; -833.333333333333; 4; 4;
> > test5; 0; -5; 3; 3;
> > Test3; 1; -20.7509881422927; 6; 6;
> >
> > i want the third column sorted, highest value first. Any thoughts here?
> >
> > vince
>
> Well, there are a couple of problems:
>
> 1. The two open statements need semicolons, or it won't compile.
> They also need " or die ...".
>
> 2. If you want to sort the third column, the [6] should be [2].
> You don't even have a seventh column of data.
>
> 3. Your data is numeric, so you probably want to be doing a
> numeric sort instead of a lexical sort. Add
>
> {$a<=>$b}
>
> after the word "sort" in your code. You might consider
> deleting the "reverse" and making that
>
> {$b<=>$a}
> --
> Bob Walton
Thanks,, ill try that,,, there were 8 or 9 columns, but i had there were 8 or
9
columns,, i had to shorten it down for the ng. ill try using {$a<=>$b}.
i didnt realize it wouuld be necessary. all the code was cut short for the ng
also,,, next time ill include.
Thanks
Vince
------------------------------
Date: Thu, 28 Oct 1999 01:56:16 GMT
From: brsuresh@my-deja.com
Subject: Forcing a submit
Message-Id: <7v8afv$u94$1@nnrp1.deja.com>
I need to get a webpage form, change the ACTION attribute of the FORM
tag to my webserver and force a SUBMIT ACTION. Can some one tell me how
to force the SUBMIT ?
Thanks for your responses.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 28 Oct 1999 03:44:45 GMT
From: J. Joy <jjjoy@tri.sbc.com>
Subject: hashing issues from Perl Cookbook (trying to do CS graph) please help!
Message-Id: <7v8grd$2km$1@nnrp1.deja.com>
I was following the example of the Perl Cookbook (p.141) although they
specifically talk about computer science type graphs on p. 151. I
cannot figure out how to even start with the p.151 stuff so I used
p.141.
Basically I have two points with a cost in between them, and these
two points are either a parent or a child, or both.
(For the CS geeks this is a DAG, directed acyclic graph.)
So I have 1 and 4, with a cost of 4. And 1 and 3 with a cost of 2.
1 is parent to 3 and 4. The cost is the cost of traversing the link
(which isn't important for this explanation). My input file for that
reads:
1 4 4
1 3 2
and so on. First column parent, second column child, third is cost.
I can represent the 1 and the 4, and the 1 and a 3 via this code:
(where the 1 is "$parent" and 4 and 3 are $child).
push( @{$ppm{$parent}}, $child );
That works great. What I don't know is how to also track the cost
for the link. Is there some way to say for a given $parent and
give child the $cost is blah.
Or have I made this way more complicated that I need to?
What I want to do is:
be able to know who is the parent(s) for a given child and their cost
and know who is the child(ren) for a given parent.
I have tried to adapt C data structures from well-known books but
that was not working for me.
Thank you, I hope this is enough explanation.
jennifer
(and in case you are wondering this is NOT for a data structure class
or something like that, the hard part shouldn't be this, but it is
for me!)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 28 Oct 1999 11:10:21 +0800
From: Adrian Chin <achin@inprise.com>
Subject: How to compare files in different directories ?
Message-Id: <3817BE9D.7EE6A3C7@inprise.com>
Hi
I need to compare files attributes and existence in two diffrerent
directory ?
Do you have any solutions ?
Adrian
------------------------------
Date: Wed, 27 Oct 1999 19:46:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HTML Table to Array?
Message-Id: <Pine.GSO.4.10.9910271946140.29843-100000@user2.teleport.com>
On Wed, 27 Oct 1999, Hank Marquardt wrote:
> Is there a function/module that takes a html file, looks for tables
> and then will return an array of values based on individual rows/cell
> contents?
Sure there is. But maybe no one has written it yet. :-)
But start with HTML::Parser from CPAN. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 1206
**************************************