[6743] in Perl-Users-Digest
Perl-Users Digest, Issue: 368 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 25 06:07:12 1997
Date: Fri, 25 Apr 97 03:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 25 Apr 1997 Volume: 8 Number: 368
Today's topics:
Re: -Niki Cox Nude (I R A Aggie)
Re: 2D matrices (Kyzer)
bootstrap? <gsarlas@foobar.res-hall.nwu.edu>
Calling Tom Christiansen's ckaddr <neiled@enteract.com>
Re: check command line options? (Mark Mills)
Flush a DBM array contents tied to a DBM file without d <perrot@francenet.fr>
Re: Getting a user's ip address? (I R A Aggie)
Re: Getting E-Mail Address Thorugh CGI (Abigail)
How Does A JS Select Object Receive Data From A CGI Scr (Frank Fisher)
Re: Implemenation of "Virtual Classes" (Steven W McDougall)
Installing perl5.003 <ws7@nhmbs1f.humb.nt.com>
Is there a YACC module? (Bernie Cosell)
Re: Newbie Alert: Help! Netscape only sees my Perl sc (Kyzer)
Re: Object IDs are bad (nuh-uh!) (Paul Wilson)
Perl for VMS ver5.5 <blam@iddis.com>
Re: PERL Programmers...Need your opinions (Kyzer)
Re: Perl5 sin function has dain bramage ?!?!?!?!? (Dominic Dunlop)
please help - cgi database access script / program for <richard@see.my.sig>
Please, help me! Perl-script. <kristiah@stud.idb.hist.no>
Re: Randomly selecting lines of text? (Mark Mills)
Re: raw input (Kyzer)
SQL data in option list graafstr@freemail.nl
User autentication in Windows NT using Perl - I need He mandre@ism.com.br
Re: Who will win? Borland or Microsoft or Programmers? <johntj@bellsouth.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 23 Apr 1997 16:24:53 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: -Niki Cox Nude
Message-Id: <fl_aggie-ya02408000R2304971624530001@news.fsu.edu>
+ Eryq (eryq@enteract.com) wrote:
+
+ : This spam apparently originated from earthlink.net.
Oh, good luck in getting a response back! They don't have a very good
reputation as a responsible ISP.
James
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 25 Apr 1997 09:38:19 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: 2D matrices
Message-Id: <5jpu2b$q3b@info.abdn.ac.uk>
Russ Allbery, while smelling of fish, wrote:
: Kyzer <junkmail@sysa.abdn.ac.uk> writes:
: > From the lips of Russ Allbery sprang:
: >> man perllol has a lot of details on precisely how this works, and more
: > that's perlLoL you mean...
: > Someone write a version of man(1) that isn't case dependant!
: Given that the commands one is trying to get documentation for generally
: *are* case-dependent, that would be a bad thing.
In general, but why should have to type man perlLoL ? It's one of the
misgivings of unix; function names are case dependent (good), but the
man pages are too; therefore they make most function names in unix
lowercase because programmers prefer all-lowercase.
That's just stupidity. (I would welcome a 'man -i' a-la grep -i)
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
This sig is under arrest! It has the right to remain silent!
------------------------------
Date: Thu, 24 Apr 1997 21:37:50 -0500
From: George Sarlas <gsarlas@foobar.res-hall.nwu.edu>
Subject: bootstrap?
Message-Id: <Pine.LNX.3.95.970424213621.4845A-100000@foobar.res-hall.nwu.edu>
I've just started playing with modules and perl5. More specifically, I'm
trying to get some scripts that use dbm files to work, but they keep
barfing on one specific line in the module GDBM_File:
bootstrap GDBM_File $VERSION;
Anyone experience anything like this that can offer some insight? Thanks.
-george sarlas
------------------------------
Date: 25 Apr 1997 04:39:50 GMT
From: "Neil Edmondson" <neiled@enteract.com>
Subject: Calling Tom Christiansen's ckaddr
Message-Id: <01bc5132$dfb49620$979a70cf@nedmondson.iclretail.com>
Thought I try to weed out the typos that people frequently make when
entering their email address on web forms. So I picked up TC's gizmo, the
header of which I've listed here...
#!/usr/bin/perl
#
# addrcheck - mail address checker
# by tchrist@perl.com
# Copyright 1997 Tom Christiansen
# version 1.001 Fri Feb 14 15:20:02 MST 1997
This program works fine - I can execute it from the command line (FreeBSD).
My problem is using it from another perl script that actually does all my
form handling.
Maybe I'm barking up the wrong tree, but I'm trying to call this using
something like:
system ("./ckaddr.pl", "bad@bad.com");
Trouble is it never gets executed. I've played with the path 'til I'm blue
in the face. Can't get it to call. Before I lean on my ISP, I'd
appreciate anyone confirming that I'm taking the right approach, i.e. using
"system".
TIA, Neil
email replies to neiled@enteract.com appreciated.
------------------------------
Date: Fri, 25 Apr 1997 05:37:08 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: check command line options?
Message-Id: <33604211.354643736@news.ntr.net>
On Thu, 24 Apr 1997 12:41:33 +0100, Alastair Aitken
<a.aitken@unl.ac.uk> wrote:
>Jason Yutao Li wrote:
>
>> I am writting a Perl script which has an -device option. It allows
>> users to specify their own tape device name if different than
>> the default name:
>>
>> readtape -device=<tape_device_name>
>
>Are you using @ARGV to collect the option? If so then you could check
>that "-device=<something>" was
>in fact received:
>
>if ($ARGV[1]) {
> ($opt,$val) = split(/=/,$argv[1]);
> if ($opt eq "-device") {
> $device = $val;
The best way to 'trap' errors is prevent them. If you only have *ONE*
argument just get it if it exists, forget about the switch. Number 2,
if you are set on having a switch just use -d (lowers the odds of a
typo considerably). Number 3, look for illegal switches, if one of
your @ARGV vars is /-\w+/ and it isn't one you support, die.
[Hopper, Dennis]: There's mines over there, there's mines over
there, and watch out those goddam monkeys bite, I'll tell ya.
==Apocalypse Now==
------------------------------
Date: 25 Apr 1997 11:35:58 +0200
From: Gildas Perrot <perrot@francenet.fr>
Subject: Flush a DBM array contents tied to a DBM file without dbmclose ?
Message-Id: <rdafmnla0x.fsf@epiphore.francenet.fr>
Hi everybody,
I would like to flush the contents of a modified DBM array tied to a
DBM file without dbmclose (a sort of dbmflush). In fact, the DBM file
is huge and I want to avoid a serie of dbmclose-dbmopen to take in
account modifications to the hash table, modifications which happens
often and I do want as fastiest as possible. Any idea about that ?
Please answer me directly.
Thanks in advance. Gildas.
--
Gildas PERROT, perrot@francenet.fr __o
FranceNet, 28 rue Desaix, 75015 Paris ---_ \<,_
http://www.francenet.fr ---- (_)/ (_)
------------------------------
Date: Wed, 23 Apr 1997 16:20:58 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Getting a user's ip address?
Message-Id: <fl_aggie-ya02408000R2304971620590001@news.fsu.edu>
In article <335E6598.1481@jhuapl.edu>, Ian Feldberg
<ian.feldberg@jhuapl.edu> wrote:
+ Does anyone know of an easy way to get the ip address of a remote user
+ of a Perl script?
Yes. Examine the environmental variables that get passed in from
your httpd.
Hmmm...wrong newsgroup. Followups...
James
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Fri, 25 Apr 1997 04:00:18 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Getting E-Mail Address Thorugh CGI
Message-Id: <E96DsI.KHs@nonexistent.com>
On Fri, 25 Apr 1997 10:24:45 +1000, Anil Gupta wrote in
comp.lang.perl.misc <URL: news:335FF9CD.22B2@inta.net.au>:
++
++ Hi There..
++
++ I was wondering, whether it is possible to get someone's E-Mail address
++ without them having to give it to you?
No.
++ Maybe somehow in Perl thorugh CGi?
Perl is irrelevant. Go ask the question in the cgi group and they'll
tell you you came 4 years too late. Browsers used to send this
information, till scumbacks collected email addresses using web servers
and misused that information.
Of course, you could always try "For the best viewing information,
download foobar browser now", and write foobar browser which sends
out the email information. Judging that 2 out of every 3 webpages
recommend a specific browser, one would think this is a working
strategie. (Or would it say something about the intelligence of
2 out of 3 web authors? Nah....)
++ If you know how I would greatly appreciate it.
Now go home and chisel 5000 times "I will not send out spam"
on a rock.
Abigail
------------------------------
Date: Fri, 25 Apr 1997 05:50:29 GMT
From: frank@primemail.com (Frank Fisher)
Subject: How Does A JS Select Object Receive Data From A CGI Script?
Message-Id: <336045f4.13552964@nntp.a001.sprintmail.com>
How can I populate a JavaScript SELECT object from a perl .cgi script?
I have to use the dynamic JS code similar to the following:
mailList.options[mailList.length] = new Option(newAddress,"")
index = mailList.length
mailList.options[index - 1].text = editString
and build the Select List Box items dynamically vs using:
<select name="somename">
<option> one
<option> two
</select>
My question is: How can I transfer the cgi script file @array data
into the JS code so I can dynamically build the List Box?
In other form objects, I can transfer the cgi data using perl a
$variable place holder in the form object defination such as <INPUT
VALUE="$perlVariable"> and it gets transferred right over perfectly.
However, in this case, the form object <SELECT tag> has no VALUE
option to preload a perl cgi script variable - so how is it done?
--frank
------------------------------
Date: Fri, 25 Apr 1997 09:45:22 GMT
From: swmcd@world.std.com (Steven W McDougall)
Subject: Re: Implemenation of "Virtual Classes"
Message-Id: <E96trM.2pn@world.std.com>
Kevin Atkinson <kevina@clark.net> writes:
>The following is my implemenation of what I call "Virtual Classes".
># For example suppose you have a class which has default tags which
># you can modify. Now a function wants to modify these tags for its
># own purposes. If the function had nothing to work with but a plain
># old Class with global class defaults it will have basically two
># choices. It could either modify the defaults and not worry about
># how it would affect other functions. Or it could store the current
># state of that tag in a variable, modify the variable, than change
># the tag back to original state when its done. In some cases this can
># be a real pain.
What if you did a local() on the package variable?
Then your example
># sub func1 {
># my $frac = virtual Fraction;
># $frac->modify_tag('MIXED', 1);
># my $frac1 = $frac->new(5,3);
># print "$frac1\n"; # Will output "1 2/3"
># }
becomes
sub func1
{
local $Fraction::MIXED = 1;
my $frac = new Fraction 5,3;
print $frac; # Will output "1 2/3"
}
The old value of $Fraction::MIXED is automatically restored when
the local() goes out of scope.
If you want to respect encapsulation,
you could provide a method to return a scalar reference:
sub func1
{
local ${Fraction->MIXED} = 1;
...
}
- SWM
------------------------------
Date: Thu, 24 Apr 1997 20:28:06 GMT
From: Mike Eisenman <ws7@nhmbs1f.humb.nt.com>
Subject: Installing perl5.003
Message-Id: <335FC256.7ED4@nhmbs1f.humb.nt.com>
I am on an HP712 running HP-UX 9.05 and the using the cc compiler that
came bundled with the OS.
# what `which cc`
/bin/cc:
HP92453-01 A.09.19 HP C (Bundled) Compiler
I have been unable to build Perl5.003
Below are the errors I have been getting after typing 'make'
.
.
.
Finding dependencies for gv.o.
Finding dependencies for sv.o.
Finding dependencies for taint.o.
Finding dependencies for toke.o.
toke.c: 56: too much defining - use -H option
Finding dependencies for util.o.
Finding dependencies for deb.o.
.
.
.
Updating makefile...
`sh cflags libperl.a miniperlmain.o` miniperlmain.c
CCCMD = cc -c -D_HPUX_SOURCE +O1
`sh cflags libperl.a perl.o` perl.c
CCCMD = cc -c -D_HPUX_SOURCE +O1
`sh cflags libperl.a malloc.o` malloc.c
CCCMD = cc -c -D_HPUX_SOURCE +O1
`sh cflags libperl.a gv.o` gv.c
CCCMD = cc -c -D_HPUX_SOURCE +O1
`sh cflags libperl.a toke.o` toke.c
CCCMD = cc -c -D_HPUX_SOURCE +O1
toke.c: 113: too much defining - use -H option
toke.c: 119: too much defining - use -H option
toke.c: 422: too much defining - use -H option
*** Error code 1
Stop.
#
Any help you can give would be greatly appreciated.
e-mail: mre@dos.nortel.com
------------------------------
Date: Fri, 25 Apr 1997 02:00:35 GMT
From: bernie@rev.net (Bernie Cosell)
Subject: Is there a YACC module?
Message-Id: <33610f83.30484360@news.infoave.net>
I have a program I'd like to convert from Unix C->Perl. The guts of the
program are a big YACC grammar --- has anyone managed to make a module
that'll accept a YACC grammar and do the right thing with it? [I can
envision how such a thing would work, creating a suite of subroutines which
it would then 'eval' to get them all defined, so that the actual run-time
parsing shouldn't be that awful... the problem is that I don't really know
enough about how YACC does its thing [and sets up that huge state
transition table, etc] so I'm stuck unless someone cleverer than I has
already done it...
Thanks
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: 25 Apr 1997 09:31:58 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: Newbie Alert: Help! Netscape only sees my Perl script as an HTML file.
Message-Id: <5jptme$q3b@info.abdn.ac.uk>
Tad McClellan, while smelling of fish, wrote:
: Richard Schwinn (wpc@waterfordbikes.com) wrote:
: : I've entered a simple program and loaded in my directory on our UNIX
: : server. I can run the program through telnet by invoking PERL directly
: : but I can't get Netscape to recognize the script as a PERL program.
: ^^^^^^^^
: I assume you really meant Navigator here? That is only one (though
: clearly the most well known) of the many products produced by the
: Netscape company.
I'm just thinking here:
Is RS trying to run his perl program locally *from* netscape? (ie file://)
or is he running it from an actual webserver?
: The _server_ is supposed to know that.
: : Here's how I invoke the program from Netscape:
: : <A HREF=http://www.waterfordbikes.com/prall.pl?Passed-argument>Try this
: : to run the program</A>
Most servers only allow running perl programs like so:
http://www.waterfordbikes.com/cgi-bin/prall.pl
or if they use a wrapper (good idea)
http://www.waterfordbikes.com/cgi-bin/cgiwrap/~prall/prall.pl
or whatever is needed.
: Your server is misconfigured, or you are not doing it whatever way
: it _is_ configured for.
Hmm, more the other way around. The human is misconfigured to work with the
server. The human needs reconfiguring ;-)
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
"Cows can vary in length by up to one metre" - Open University
------------------------------
Date: 25 Apr 1997 03:15:09 -0500
From: wilson@cs.utexas.edu (Paul Wilson)
Subject: Re: Object IDs are bad (nuh-uh!)
Message-Id: <5jpp6d$l2k@roar.cs.utexas.edu>
In article <wujsp0gz0y5.fsf_-_@wistaria.i-have-a-misconfigured-system-so-shoot-me>,
Peter Ludemann <ludemann@inxight.com> wrote:
>
>Absolutely correct and correctly so.
>
>If two things LOOK the same, then they ARE the same. It's called
>"referential transparency" and it's a Good Thing, as opposed to
>"pointers" which are a Bad Thing. Why confuse your life with "object
>identity"?
Confusing pointers with addresses is a Bad Thing. A pointer is
language-level thing, and an address is an implementation-level
thing. The mapping between them is often not simple.
>And why do you want to use the memory address for object identity to
>identify it --- an address can change during garbage collection.
Are there any garbage collectors that DON'T deal with this? First off,
it's not an issue in non-copying GC, and copying GC's are highly
overrated.
As far as I know, every copying GC already deals with the issue of
updating addresses consistently to ensure that the pointer abstraction
is maintained at the language level. And this isn't really much of an
added cost---even in pure, lazy FP languages you want to maintain
the reachability graph for efficiency reasons at the implemenation
level. (E.g., you don't want to turn a general graph of of
unreduced combinators or closures into a tree, because then
memoization of lazily computed values may be defeated.)
>not use a time stamp of object creation? Oh, it's for efficiency
>reasons, you say ... ah-ha!
>
>But let's suppose that you really really really do need to identify a
>particular subtree. In other words, you want to NAME it. No problem:
>just create a dictionary (hash table) that maps names to subtrees.
Wow. You think it's a good idea to add a *hashing* cost to what's
conceptually a pointer traversal? And to make more work for either
the programmer or the GC? (Adding extra indexes to data structures
can cause retention of data that will never be used again. If you
use plain tables, the programmer has to remember to remove the table
entries when the corresponding objects die---whenever that is; if
you use weak tables understood by the GC, it adds significant
overhead.)
>That'll let you have two differently named entries which might happen
>to have the same values. And it won't expose pointers. And it'll be
>efficient.
Where's the win? If my language has plain old pointers, it can
efficiently support the abstraction of object identity. (It gets
harder in distributed systems, but still...)
In many cases, cobbling up your own notion of object identity is extra
hassle for the programmer, and quite inefficient to boot.
>Repeat after me: "if two things look the same and act the same, then
>they are the same". Don't depend on some hidden property (pointer) to
>differentiate them. If there are important differences, then don't be
>shy: bring them out in the open and NAME them.
Try repeating this: if identical twins are indistinguishable to me,
then they must be the same person, and I don't need to distinguish
between them. Does that seem right?
The reason for object identity is that the identity of a language-level
object allows you to distinguish between objects known to represent the
same conceptual object and objects which are not known to represent
the same conceptual object (but are otherwise indistinguishable,
given the attributes you've recorded). Sometimes you can make
a safe closed-world assumption in which case a pointer comparison
makes exactly the distinction between sameness and difference
of what the program-level objects represent.
This comes up most clearly when you're representing knowledge about
the real world, but it also comes up in the internals of programs.
When conceptual object identity matters, and encodes useful
knowledge, then having object identity in the language can
often be very useful.
>[I once took an object-oriented database that used object-IDs and
>translated it to a relational form which just used names for things;
>performace improved by about about an order of magnitude. But that's
>another rant for another day ...]
This anecdote doesn't mean much without a lot more information. I
know of programs that run a hundred to a thousand times faster in
some OODBs than in most commercial database systems, and I know
*why*. For some things, a relational (value-oriented) language
works great, because the limitations of the model make life
easy for query optimizers. In other cases, there are awkward
problems that no query optimizer in the world can optimize much,
and using a relational database where you need pointer semantics
just adds orders of magnitude of overhead.
Please don't insult our intelligence by saying "repeat after me:"
followed by something simplistic and poorly-argued. It just acts
as flame bait. The issue of object identity is an important
and deep one, intertwined with the meaning of "meaning". There
are good arguments for it and some good arguments against it,
too. This is not an area where simplistic maxims are useful.
Followups have been directed to comp.lang.misc.
--
| Paul R. Wilson, Comp. Sci. Dept., U of Texas @ Austin (wilson@cs.utexas.edu)
| Papers on memory allocators, garbage collection, memory hierarchies,
| persistence and Scheme interpreters and compilers available via ftp from
| ftp.cs.utexas.edu, in pub/garbage (or http://www.cs.utexas.edu/users/wilson/)
------------------------------
Date: Thu, 24 Apr 1997 13:31:26 -0400
From: William Lam <blam@iddis.com>
Subject: Perl for VMS ver5.5
Message-Id: <335F98EE.62F7@iddis.com>
Hi,
I found the VMS perl5 from upenn, but this perl is build on
VMS ver6.0 . We're using VMS version 5.5 here. Where can
I get the perl for the old version of VMS ??
Thank !!
e-mail blam@iddis.com
------------------------------
Date: 25 Apr 1997 09:25:09 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: PERL Programmers...Need your opinions
Message-Id: <5jpt9l$q3b@info.abdn.ac.uk>
Jerry Bradenbaugh, while smelling of fish, wrote:
: As PERL programmers, please tell me what types of programs you write
Perl programmers write *anything*
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
BENNY: Hey Roger, what do you call the middle of a song? ROGER: Gee I dunno
Ben... A BRIDGE!!!!!!!!
------------------------------
Date: Fri, 25 Apr 1997 10:17:30 +0200
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: Perl5 sin function has dain bramage ?!?!?!?!?
Message-Id: <1997042510173012365@dialup16.ip.lu>
Jack Applin <neutron@fc.hp.com> wrote:
> Perl got the correct answer to 15 significant places. Did you expect
> exactly, precisely, absolutely zero? If so, then you should learn more
> about numeric representation in computers, and why floating-point
> results are rarely mathematically exact.
--
Dominic Dunlop
------------------------------
Date: Fri, 25 Apr 1997 09:56:40 +0100
From: "Richard G. Coleman" <richard@see.my.sig>
Subject: please help - cgi database access script / program for web page
Message-Id: <aiahjIAIHHYzEwli@alchemedia.co.uk>
I wonder if anyone can help me.
I am looking to create a web page that accesses a database (can be in
Access, Paradox, DBase or any other major pc format - even delimited
text if it must be) and displays information from it. The page should
contain a form with a radio button to detect which field (eg title,
subject, area) to search, and a textbox for the query string. No write
function will be included, as it is going to be a directory for people
to view from.
Can anoyne tell me the correct way to proceed. The server will probably
(more than likely) be linux or unix. Do I _have_ to purchase a database
access program for the server, or is it possible to write a script to do
this.
I would be most grateful for any response.
--
Richard G. Coleman | richard@alchemedia.co.uk
Alchemedia Interactive Ltd | http://www.alchem.demon.co.uk/
-------------------------------------------------------------
"Reality is an illusion caused by a lack of alcohol"
------------------------------
Date: Fri, 25 Apr 1997 10:57:26 +0200
From: Kristian Holm <kristiah@stud.idb.hist.no>
Subject: Please, help me! Perl-script.
Message-Id: <336071F6.500C@stud.idb.hist.no>
Hi All!
I'm kind of a rookie in the perl-language, and I don't seem to get any
help from surfing on the Internet.
My beloved teaching supervisor gave me a nice task. The task is as
follows:
I'd need a script that can create a html document which contains:
- a summary of all html documents in a specific catalogue structure.
- when each document where last updated.
The beauty of this task, is that the last updated information, has to be
created by means of the script, checking each page in the structure
against an older copy of it.
Help would be greatly appreciated.
Kristian Holm
kristiah@stud.idb.hist.no
------------------------------
Date: Fri, 25 Apr 1997 07:05:09 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: Randomly selecting lines of text?
Message-Id: <3364534c.359055145@news.ntr.net>
On 24 Apr 1997 20:28:46 GMT, pedersen@seas.smu.edu (Ted Pedersen)
wrote:
>
>Doe anyone have a Perl program that will randomly select (without
>repetition!) a given number of lines from a text file?
>
>Thanks!
>Ted
Slurp'em, Splice'em, Spit'em.
@lines=<FILEYOUOPENED>;
foreach(1..10) { print splice(@lines,rand(@lines),1); }
#ten lines (sue me cause I'm too lazy for for(;;) => )
Might actually be easier on command line...
perl -e 'srand; @l=<>; for(1..10) {print splice(@l,rand(@l),1);}' file
HTH
[Hopper, Dennis]: There's mines over there, there's mines over
there, and watch out those goddam monkeys bite, I'll tell ya.
==Apocalypse Now==
------------------------------
Date: 25 Apr 1997 09:46:47 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: raw input
Message-Id: <5jpui7$q3b@info.abdn.ac.uk>
Sascha Teske, while smelling of fish, wrote:
: hi everybody,
: this is my first time "talking news" so sorry for my maybe dump behavior
OK
: I have a Problem i want to write an more intelligent chat and want to
: use perl is there a way to get data before or without a newline "amen" ?
: don't say RTFM to me, I DID !!!
Perl keeps newlines because it hsn't been told not to.
The easiest way to fix it is:
$my_string_with_newline = "Hello wurld\n";
chop($my_string_with_newline); # now it's "Hello wurld" no newline
chop($my_string_with_newline); # now it's "Hello wurl"
chop($my_string_with_newline); # now it's "Hello wur"
chop is not for removing newlines. chop cuts the last character from a string.
IF there is *NOT* a newline at the end it chops a letter off (or whatever's
there)
A better way is to do this:
$my_string_with_newline =~ s/\n$//
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
Packing class and eating pies!
------------------------------
Date: Fri, 25 Apr 1997 01:51:15 -0600
From: graafstr@freemail.nl
Subject: SQL data in option list
Message-Id: <861866826.25929@dejanews.com>
I am a relative newcomer to Perl. I have implemented some scripts for
searching Oracle databases via the WWW.
Used:
Perl 5.003
HP/UX 10.01
Oracle 7 w/SQLPLUS
Formlib.pl
I want to write a html interface that consists of an option list and a
submit command. The option list must be dynamically filled with data from
the oracle database
eg. all the countries filled in the database
By selecting one of the countries from a list, you wil be able to view all
the data from that specific country.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 24 Apr 1997 22:06:20 -0300
From: mandre@ism.com.br
Subject: User autentication in Windows NT using Perl - I need Help
Message-Id: <3360038C.55BF@ism.com.br>
I need to know how I can check username and password from a Perl script
in a Windows NT 4.0.
Where the users file is located ? How can I check the password ?
Thanks.
mandre@ism.com.br
www.matec.com.br
------------------------------
Date: Thu, 24 Apr 1997 22:51:46 -0400
From: John Johnson <johntj@bellsouth.net>
Subject: Re: Who will win? Borland or Microsoft or Programmers?
Message-Id: <33601C42.39A5@bellsouth.net>
<Many supererogatory newgroups trimmed>
Looks like the programmers may win. I found this on AT&T's website.
Speaking of the Korn shell by David Korn:
"...Introduced in 1983, it has
become the command language of choice
for UNIX . systems and is shipped by most
UNIX vendors. David is currently developing
a version of UNIX . for Windows NT . and
Windows 95 . that will allow the KornShell
and most other UNIX . programs to work
on those systems too."
Interesting, eh ?
See also http://www.att.com/attlabs/people/fellows/korn.html
--
Regards,
John
+------------------------------------------------------+
| Please fix the email address to reply, sorry for the |
| inconvenience, I'm being inundated with junk mail. |
+------------------------------------------------------+
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 368
*************************************