[6789] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 414 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 2 13:27:15 1997

Date: Fri, 2 May 97 10:00:24 -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, 2 May 1997     Volume: 8 Number: 414

Today's topics:
     Re: [++] Re: Question: regexp reduction? (Quentin Fennessy)
     Re: [++] Re: Question: regexp reduction? (Eric Bohlman)
     Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-p (A.Deckers)
     Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-p <usenet-tag@qz.little-neck.ny.us>
     [Q] Child process <hclim@castor.usc.edu>
     Re: data type request <seay@absyss.fr>
     Re: dos2unix (Reini Urban )
     Re: hashes, -d's "x", and Data::Dumper <seay@absyss.fr>
     Re: Hostname <seay@absyss.fr>
     Re: Hostname <burleigh@hackberry.chem.niu.edu>
     Re: How do I round things off? <seay@absyss.fr>
     Re: How do I round things off? <rootbeer@teleport.com>
     How to use Unix domain sockets under Linux <Jay.Jensen@csipros.com>
     Re: I need help with Perl <burleigh@hackberry.chem.niu.edu>
     limiting user log written in perl? (Pearl Fox)
     Re: limiting user log written in perl? <burleigh@hackberry.chem.niu.edu>
     Re: Looking for mailing list cgi program <burleigh@hackberry.chem.niu.edu>
     Re: Looking for mailing list cgi program <rootbeer@teleport.com>
     Re: moderation <usenet-tag@qz.little-neck.ny.us>
     Re: Multithreading in perl? (Mark Daku)
     Re: Need Help making random number! (Quentin Fennessy)
     Re: Notice to antispammers (Timothy Hall)
     Procedure to count unique lines (Aram Mirzadeh)
     Re: Procedure to count unique lines (Eric Bohlman)
     Re: Q: Cutting a string by position (like cut(1) can) <burleigh@hackberry.chem.niu.edu>
     Re: recursive directtory tree walk (Parillo)
     Re: select and FD_ macro's? <seay@absyss.fr>
     Re: using modems from perl (Scott Garee)
     Re: What is the best way of learning Perl? <seay@absyss.fr>
     Re: What is the best way of learning Perl? <rootbeer@teleport.com>
     Re: Write form to variable <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 May 1997 14:01:00 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: [++] Re: Question: regexp reduction?
Message-Id: <5kcs2s$2t8$1@amdint2.amd.com>

In article <3369826F.5197@tibinc.com>, Bill Cowan  <billc@tibinc.com> wrote:
>Quentin Fennessy wrote:
>> 
>> In article <33665DA6.41C67EA6@fir.fbc.com>,
>> Ying Chen  <yingchen@fir.fbc.com> wrote:
>> [...]
>> >let say if one has a arbiturary regexp -
>> >is there a way (maybe algorithm) to tell if
>> >the regexp can be reduced/simplified??
>> 
>> I don't think there is an automatic technique for reducing
>> or simplifying regexps.  Of course, there is still Jeffrey...
>> And reading his book.
>> 
>> --
>> Quentin Fennessy                        AMD, Austin Texas
>
>Using /x option (e.g. "s/pattern/replace/x") should help to simplify a
>complex regular expression.  The /x allows comments/whitespace inside
>regexp to explain each part of pattern step-by-step. A good example is
>on page 71, Camel II.

I understood Ying Chen to ask something different -- can a regular
expression be automatically reduced to a simpler regexp (a simpler
expression).  Think about algebraic expressions, and simplifying
those.  That is possible and relatively easy to program.  But
simplifying arbitrary regexps is hard.

Using /x and whitespace doesn't simplify it as an expression, it
makes it more readable and allows comments.
-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: Fri, 2 May 1997 14:34:52 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: [++] Re: Question: regexp reduction?
Message-Id: <ebohlmanE9K5u5.50@netcom.com>

Quentin Fennessy (quentin@remington.amd.com) wrote:

: I understood Ying Chen to ask something different -- can a regular
: expression be automatically reduced to a simpler regexp (a simpler
: expression).  Think about algebraic expressions, and simplifying
: those.  That is possible and relatively easy to program.  But
: simplifying arbitrary regexps is hard.

If you're talking about "pure" regexps (i.e. not using any Perl-specific 
extensions like backreferencing), then they correspond to DFAs, and there 
is an algorithm for minimizing the number of states in a DFA, so you 
could translate, minimize and then back-translate (note, though, that 
this might actually result in a longer regexp).



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

Date: 2 May 1997 14:20:02 GMT
From: I-hate-cyber-promo@man.ac.uk (A.Deckers)
Subject: Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-process,programmer,regex}
Message-Id: <slrn5mju0i.4u2.I-hate-cyber-promo@news.rediris.es>

In comp.lang.perl.misc,
	tadmc@flash.net wrote:
[about "reject HTML" provision in RFD]
>I think the provision is not meant to exclude HTML as _contents_
>but to exclude HTML encoding of the entire post itself (eg.
>posting from a misconfigured Netscrape).
>
>Right?

Correct, though I admit the language I chose to express this leaves
something to be desired.

I currently do this by rejecting articles based on Content-Type
headers. Basically what it boils down to is that anything not
text/plain or multipart/digest gets bounced, and I'm not even sure the
latter should get through.

If a more elaborate mechanism of scanning the message body seems
desirable and practical, it could be implemented, at the discretion of
the moderation panel.

That's one of the roles that I envisage for the moderation panel:
deciding on the best technical approach the script should implement to
meet the criteria set out in the charter.

Cheers,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
        Perl FAQ: <URL:http://www.perl.com/perl/faq/>
    Perl archive: <URL:http://www.perl.com/CPAN/>


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

Date: 2 May 1997 16:26:12 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-process,programmer,regex}
Message-Id: <5kd4j4$q7g$1@news.netusa.net>


Posted and mailed.

A.Deckers <I-hate-cyber-promo@man.ac.uk> wrote:
>	tadmc@flash.net wrote:
>[about "reject HTML" provision in RFD]
>>I think the provision is not meant to exclude HTML as _contents_
>>but to exclude HTML encoding of the entire post itself (eg.
>>posting from a misconfigured Netscrape). Right?
>I currently do this by rejecting articles based on Content-Type
>headers. Basically what it boils down to is that anything not
>text/plain or multipart/digest gets bounced, and I'm not even sure the
>latter should get through.

I don't know what "multipart/digest" is myself. quoted-printable
can easily be undone, and doing so is advisable since uu.net sometimes
converts posts going through its moderator forwarding to q-p. There
is a multipart type for pgp signatures, that maybe should be acceptable
too.

>If a more elaborate mechanism of scanning the message body seems
>desirable and practical, it could be implemented, at the discretion of
>the moderation panel.

An excess of "&nbsp;" in the post is a good sign of HTML content, IMO.

>That's one of the roles that I envisage for the moderation panel:
>deciding on the best technical approach the script should implement to
>meet the criteria set out in the charter.

So I guess it is going to be a perl script, huh? :^)

Elijah
------
uses a perl script for moderating alt.sex.stories.moderated


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

Date: 2 May 1997 09:16:43 -0700
From: Lim Han Chiew <hclim@castor.usc.edu>
Subject: [Q] Child process
Message-Id: <Pine.SV4.3.94.970502091353.28777C-100000@castor.usc.edu>



I'm very new to Perl.

I've a CGI script which I want to start a child process while the
parent process returns a message to the browser and then exit. Meanwhile,
the child process should continue executing until it has completed its
task.

My problem is that when the parent exits, it kills the child process too.

How can I overcome this problem in Perl 4?

I suspect the parent sends a signal to the child process when it exits. Is
there a way in Perl 4, for the child process to ignore the signals
sent by the parent?


Thanks in advance...
Han Chiew





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

Date: Fri, 02 May 1997 16:56:12 +0100
From: Douglas Seay <seay@absyss.fr>
To: mallela reddy <rkm@cs.wayne.edu>
Subject: Re: data type request
Message-Id: <336A0E9C.68F2459F@absyss.fr>

[posted and mailed]

mallela reddy wrote:
> 
> Respected Sir/Madam,
> I am a student from wayne state university.
> I have a problem with the data type. I want to
> convert $45.5625 into $45.60 or $45.55 not by using
> chop twice.
> please mail to me the solution. I need this as I
> have to submit the project today at 12:30 Pm.

Why did you post this just 40 minutes after you asked the same question
with the post "request for help" <3368ACDF.23C9@cs.wayne.edu>?  Did you
think that doubling the requests would double the chance that someone
would do your homework for you?

Also, don't expect Usenet responses within a few hours.  It sometimes
happens, but sometimes it doesn't.  Usenet is not built for speed.

And why did you say "12:30pm"?  I have no idea what timezone you're in,
so that is absolutely meaningless to me.  Remember that Usenet is bigger
than your back yard, and not everyone is in the same timezone, state,
country, or even continent as you.

 - doug

Oh yea, the answer is still sprintf().


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

Date: Fri, 02 May 1997 15:08:31 GMT
From: rurban@buehnen-graz.com (Reini Urban )
Subject: Re: dos2unix
Message-Id: <336a010a.28113865@news.sime.com>

On 1 May 1997 16:16:21 GMT, Kyzer wrote:
>As for doing the entire job of dos2unix in a perl script, you need to support
>the multitude of dos text formats, but if you can get the correct one, you
>just need to execute one very long tr/// composed of almost pure octal :)

BTW: 
where can I find such a 'compressed pure octal' for
tr/<ascii-set>/<Latin-1-set>/

<ascii-set>:      dos850 octals
<Latin-1-set>:    ISO 8859-1 (Latin I) octals

Would have needed it quite often so far, but was to lazy top looking for it
consequently enough.
--                                          - Reini
AutoCAD stuff:   http://xarch.tu-graz.ac.at/autocad/


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

Date: Fri, 02 May 1997 16:23:49 +0100
From: Douglas Seay <seay@absyss.fr>
Subject: Re: hashes, -d's "x", and Data::Dumper
Message-Id: <336A0705.7268636A@absyss.fr>


Ilya Zakharevich wrote:
> 
> [A complimentary Cc of this posting was sent to Mike Campbell
> <mcampbel@tvmaster.turner.com>],
> who wrote in article <r5911zgoky.fsf@tvmaster.turner.com>:
> > ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> >
> >
> > > > Given:
> > > >    use Data::Dumper;
> > > >
> > > >    $myhash{'A'}{'0'}{'X'} = "hello";
> > > >    $myhash{'A'}{'0'}{'W'} = "world";
> > > >
> > > >    $myhash{'A'}{'1'} = "now";
> > > >    $myhash{'A'}{'1'}{'X'} = "is";
> > > >    $myhash{'A'}{'1'}{'W'} = "the";
> > >
> > > Your code is broken, you forgot to put
> > >     use strict;
> > > at the top (as anyone should- unless you understand the complications you
> > > get into if you drop it).
> >
> > And how exactly does the lack of "use strict;" in this context "break"
> > the code?
> 
> Insert it, and you will see.

OK, I see the perfectly reasonable error message.  Could you explain
what was going on without the "
use strict;" directive.  How was that being treated earlier?  I'm not
trying to belittle the importance of strict, I just wanna know what
magic was happening under the hood.

- doug


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

Date: Fri, 02 May 1997 17:27:53 +0100
From: Douglas Seay <seay@absyss.fr>
To: Magnus S|derstr|m MNF94 <masoders@news.abo.fi>
Subject: Re: Hostname
Message-Id: <336A1609.2B51DE67@absyss.fr>

Magnus S|derstr|m MNF94 wrote:
> 
>                                 Hello,
> 
>                                 I have a small problem that I would need to solve somehow:
> 
>                                 I need to get the hostname of the computer that I am currently
>                                 logged into. I tried to look at the man pages, found a
>                                 gethostbyaddr, but the man page itself didn't explain anything
>                                 intelligent about the command.
> 
>                                 Is that the command to use, and if so, how do is it to be used?
>                                 Or can I get the hostname by another way? From an enviromental
>                                 variable?
> 
>                                 Thanks,
> 
>                                 Magnus

I don't know of something that works on every platform (Unix, NT, OS/2,
VMS, OS/400, etc).  I think that there is a generalized tool at CPAN,
but I just use `uname -m`.  Not portable, but it works on Unix and
that's good enough for me.

Often there is an environment variable HOST, but that is defined by some
shell (I forget which).  I wouldn't count on it always being there.

- doug


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

Date: Fri, 02 May 1997 10:31:26 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: Hostname
Message-Id: <336A08CE.5875@hackberry.chem.niu.edu>

Magnus S|derstr|m MNF94 wrote:
> 
>                                 Hello,
> 
>                                 I have a small problem that I would need to solve somehow:
> 
>                                 I need to get the hostname of the computer that I am currently
>                                 logged into. I tried to look at the man pages, found a
>                                 gethostbyaddr, but the man page itself didn't explain anything
>                                 intelligent about the command.
> 
>                                 Is that the command to use, and if so, how do is it to be used?
>                                 Or can I get the hostname by another way? From an enviromental
>                                 variable?
> 
>                                 Thanks,
> 
>                                 Magnus
> --
> 
>          masoders@aton.abo.fi
>         "Impressive young Gates, but you are not a Unix yet"


you're doing this is Perl, right? because you posted
to a Perl newsgroup. But you want information from
the operating system? Perl has the command 'system'., and
backticks `.
on unix, you can do:
>hostname
in perl, you can write
$hostname = `hostname`;
==========================================================
 - darin
 burleigh@hackberry.chem.niu.edu
 '2 kinds of green, look out!' - dieter rot


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

Date: Fri, 02 May 1997 17:19:47 +0100
From: Douglas Seay <seay@absyss.fr>
To: Tom Kruk <tomkruk@perfekt.net>
Subject: Re: How do I round things off?
Message-Id: <336A1423.283C0385@absyss.fr>

[posted and mailed]

Tom Kruk wrote:
> 
> Have
> you ever had this problem?
> 
> You are doing some kind of math procedure in perl and you are
> multiplying decimals like (tax) .0825 and the result is an answer
> with as many decimals. I was wondering if someone could help
> me or point me in the right direction,
> 
> If I get something like 80.0456 how do I round it to 80.05 or how do I cut
> off the 56
> to get 80.04 ???
> 
> If anyone could answer I would greatly appreciate it!!
> 
> Thanks
> 
> Tom


Check your newsreader.  This very question has been beaten to death over
the past two or three days.

 - doug


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

Date: Fri, 2 May 1997 08:57:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Kruk <tomkruk@perfekt.net>
Subject: Re: How do I round things off?
Message-Id: <Pine.GSO.3.96.970502085219.2421E-100000@kelly.teleport.com>

On Fri, 2 May 1997, Tom Kruk wrote:

> Subject: How do I round things off?
> 
> Have 
> you ever had this problem?

Have
you seen the FAQ? :-)  Hope this helps!

   http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
   http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq4/Does_perl_ha
	ve_a_round_function_.html

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Fri, 02 May 1997 10:25:55 -0500
From: Jay Jensen <Jay.Jensen@csipros.com>
Subject: How to use Unix domain sockets under Linux
Message-Id: <336A0783.202C@csipros.com>

I am trying to get a client/server going on linux 1.2.13 using perl
5.003 and unix domain sockets.  I am trying basically what is shown
in the blue camel book:

Code from clnt.pl:

$r = '/tmp/svrsock';

socket(SOCK,PF_UNIX,SOCK_STREAM,0) or die "socket: $!";
connect(SOCK, sockaddr_un($r)) or die "connect: $!";
while (<SOCK>)
{
 ...
}

*******************************************************************
Code from svr.pl:
 ...
$r = '/tmp/svrsock';
$uaddr = sockaddr_un($r);
socket(Server, PF_UNIX,SOCK_STREAM,0) or die "socket: $!";
bind (Server, $uaddr) or die "bind: $!";
listen(Server,SOMAXCONN) or die "listen: $!";

for ( ; $paddr = accept(Client,Server); close Client)
{
 ...
}
print "accept failed: $!\n";

The Problem:
This code works fine under Solaris 2.5.1, but breaks under linux.  The
output from svr.pl after it exits:
	accept failed: Illegal seek
This seems to be an errno for lseek indicating that the file
descriptor is associated with a pipe, socket, or FIFO, which it
certainly is.

Can unix domain sockets be used with linux, and if so, any suggestions?

Thanks,

Jay R Jensen




-- 
Jay R. Jensen
Computing Solutions Inc.
jay.jensen@csipros.com


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

Date: Fri, 02 May 1997 10:16:16 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: I need help with Perl
Message-Id: <336A0540.7B13@hackberry.chem.niu.edu>


Jeremy James wrote:
> 
> Hello -
> 
> I'm just beginning to learn Perl and I'm really confused about the
> compilation process - the implimentation of Perl for database
> manipultion.
> 
> I am working on a large web page - much like amozon.com ** lots of
> databases** I'm learning Perl to acomplish this tremendous job.
> 
> Please E-mail me at spudm@grove.ufl.edu if your interested in talking me
> through some of this.
> 
> Thank you

look up all the FAQ's on the web.
Then post a specific problem.
you'll get much better help that way.
-- 
==========================================================
 - darin
 burleigh@hackberry.chem.niu.edu
 '2 kinds of green, look out!' - dieter rot


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

Date: Fri, 02 May 1997 16:21:26 GMT
From: fox@securenet.net (Pearl Fox)
Subject: limiting user log written in perl?
Message-Id: <5kcq77$apq@news.securenet.net>

Hi,

I would like to know how to program my user log for my web page from
the program easylog to limit showing only the last 20 users of my web
page and no more.

How do I do this please?

TIA
Pearl
Pearl S. Fox,
Montreal (Que.)
http://www.securenet.net/members/fox/index.html



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

Date: Fri, 02 May 1997 10:39:46 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: limiting user log written in perl?
Message-Id: <336A0AC2.36AC@hackberry.chem.niu.edu>

Pearl Fox wrote:
> 
> Hi,
> 
> I would like to know how to program my user log for my web page from
> the program easylog to limit showing only the last 20 users of my web
> page and no more.
> 
> How do I do this please?
> 
> TIA
> Pearl

with a name like 'Pearl' you're asking us?
anyway, you some code. where did you get it? if you
bought it, then ask your supplier to help you. If some
one gave it away for free, then you need to invest some time
learning to program. really, its well worth it. 

is this code in perl? can you read the source? is there
 a list array called something like @web-site-vistors?

==========================================================
 - darin
 burleigh@hackberry.chem.niu.edu
 '2 kinds of green, look out!' - dieter rot


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

Date: Fri, 02 May 1997 10:26:41 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: Looking for mailing list cgi program
Message-Id: <336A07B1.2BE@hackberry.chem.niu.edu>


jvinci@cybergate.net wrote:
> 
> I am the editor of an e-mail newsletter, and am currently looking for a
> cgi program that will alow people to subscribe/unsubscribe from my
> webpage and then collect the address into a file that can be imported in
> my e-mail program (I guess this might mean that the program will have to
> insert a comma between each address).
> 
> I am currently using webcom for my web isp and they have such a program,
> however, they have limited cgi capabilities so I would like to switch.
> 
> If anyone know of a program for purchase or freeware, please let me
> know.  The only one that I know of is from Selena Sol but it won't allow
> my subscribers to unsubscribe.
> 
> Thanks a lot,
> 
> John Vinci

If you use code, then either find someone to support it,
or supoort it your self.

If you support it yourself, then you need to learn some
programming.

Perl is easy to learn. And its easy to modify.

-- 
==========================================================
 - darin
 burleigh@hackberry.chem.niu.edu
 '2 kinds of green, look out!' - dieter rot


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

Date: Fri, 2 May 1997 08:46:04 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: jvinci@cybergate.net
Subject: Re: Looking for mailing list cgi program
Message-Id: <Pine.GSO.3.96.970502084500.2421B-100000@kelly.teleport.com>

On Thu, 1 May 1997 jvinci@cybergate.net wrote:

> I am the editor of an e-mail newsletter, and am currently looking for a
> cgi program that will alow people to subscribe/unsubscribe from my
> webpage

Aren't you using Majordomo or something similar? MD has web interfaces
available. Hope this helps! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 2 May 1997 16:39:33 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: moderation
Message-Id: <5kd5c5$q8t$1@news.netusa.net>


Douglas Seay  <seay@absyss.fr> wrote:
>Moderation seems to be the buzz word of the day.  I can't say I like it,
>but it might be better than the insanity of today.  I  know squat about
>Usenet moderation rules, but everything I've seen has been human
>moderated.  I'm not sure how well that would work here.  Maybe there is

There are plenty of robomoderated groups. One of the more popular systems
has the "moderator" send a FAQ or list of rules to all first time posters
and then gives them a magic word to put into their post. After one post
with the cookie, they are auto-approved for perpetuity. Simple, somewhat
effective.

>too much stuff, moderation would be a full time job, or would need to be
>distributed amoung several people like with alt.humor.best-of-usenet.

For a discussion group timing is very important so human moderation would
be ver difficult.

>Would it be possible to build an auto-moderating robot that looks at the
>sender's address and if the sender is on the "approved" list, allow the
>post, otherwise send a copy of the FAQ and forward the post to the human
>moderator(s).  The human(s) could then accept or reject the post

Yes. Indeed it has been done already.

>depending upon content, complexity, phase of the moon, personal whim,
>whatever.  As for this "approved" list, it isn't be in our best
>interests to keep this a closed, good-ol-boy network, so this list
>should be fairly open.  If someone has been approved for posting by the
>human moderator(s) 3 times, they are on the list.  Maybe also build some

Eliminate the human element of the moderation altogether.

>sort of Perl test, and if someone can score well enough (knows the
>basics), then let them on the list.

That Idea Sucks.(TM)

>Note that I'm not offering to be a moderator nor to write this robot
>approval system.  I'm just shooting the breeze.  But I would like to
>know what the rest of you think.  As I've never seen the creation of a
>moderated group, I don't know what problems await.

Heh. I moderate a group. I want to do as little work as possible. You
can be damn sure I do not read most of the stuff I approve. The perl
script throught it was topical, that's good enough for me.

>Oh yea, I think this moderated group should be in addition to a
>open-to-anybody group.  Cutting people off from any Usenet source of
>help would be counter productive.

One rule I do follow for my group is the post must come from a replyable
address. If that could keep Tom Christianson in a perl group, it would
stop cutting people off from Usenet help.

Elijah
------
alt.sex.stories.moderated script <URL:ftp://ftp.netusa.net/users/eli/jmdigest>


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

Date: 02 May 1997 09:40:17 -0400
From: daku@nortel.ca (Mark Daku)
Subject: Re: Multithreading in perl?
Message-Id: <esqsp063sce.fsf@nortel.ca>

> Anyone know of way (a module?) to write multithreaded scripts?
> 
> I've done the fork thing, but it won't do my current project. I really need
> a multithreaded solution.
> 

Well multi-threading isn't truely here yet for perl.  But maybe soon.
What I have done in the past is set up a named socket between the parent
and child processes.  I've tended to invent my own comm protical each time
I've done this.  However a good rule of thumb I use is that I set up a socket
for each Object that needs to talk to it's parent.  Useally I fork off a 
child as an Object, or cluster of Objects.  These Object clusters are
forked uselly when I need more than one instance of the object.

Another approach is shared memory but I haven't used shared memory in perl
if it's possible.

Oh yah this is a "Bugger " to debug.

Mark Daku
daku@nortel.ca


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

Date: 2 May 1997 14:03:14 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: Need Help making random number!
Message-Id: <5kcs72$2ur$1@amdint2.amd.com>

In article <01bc52c5$58ea0d20$4571e8cb@Kornet.soback.kornet.nm.kr>,
=E@gH#(Jake Shin) <netj@nuri.net> wrote:
[..]
>I'm trying to make randomized number.
>but I don't know the method.
[..]

Jake-
	Check out rand() and srand() in perlfunc(1).


-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: 2 May 1997 16:07:09 GMT
From: thall@lexis-nexis.com (Timothy Hall)
Subject: Re: Notice to antispammers
Message-Id: <5kd3fd$qcg@mailgate.lexis-nexis.com>

 
I R A Aggie (fl_aggie@hotmail.com) wrote:
: In article <33677293.445344F5@mail.please>, David Nadler
: <nojunk@mail.please> wrote:
 
: [about serving up email addresses on a silver platter to spammers]
 
: + concerned, I'll be consulting my attorneys to see whether that's
: + a tortious invasion of my privacy.  You do not have my consent
: + to publish my email address in a form easily scanned by junk
: + mailers.
 
: Go ahead. Your attorney will get a good laugh when he cashes your
: check. Hint: compiling a list of freely available information is
: not a violation of anything, unless you're using a proprietary format
: without license.
 
: James

I am not an attorney, nor do I play one on TV, this is not legal advice , it
is my opinion, and only *my* opinion (Employer not responsible yadayadayada)
this is not an "invasion of privacy" issue as much as an "use in such a way
as to bring ridicule or to cause harm to character or professional status, or
to harrass or annoy, or to cause to be harrassed or annoyed...".  That means,
I think, that if I post your e-mail address in a place that results in one of
these things, (eg: I put your name and email address on the guestbook of the
Overthrow of Pedophilia Laws Nazi Militia, and you lose your job, wife,
standing (personal or professional) in the community, or are harrassed or
annoyed, and you can *prove* in a civil court that I entended /or could have
reasonably expected to cause/ harm by my actions, you could prevail. Mal-
icious intend is hard to prove. And cyber-law is still a little flakey. If
you don't like what Tom is doing, send him a reasonable email and request he
not do it. It can't hurt, and it is a lot cheaper than a lawyer and court
costs. But then, what isn't.

   _____
 _-     -_       
(         )         |By US Code Title 47, Sec.227(a)(2)(B),
 \(@) (@)/          |a computer/modem/printer meet the
  \  ^  /  ^        |definition of a telephone fax machine.
   ( o )  /|\       |By Sec.227(b)(1)(C), it is unlawful to 
    |-|  / | \      |send any unsolicited advertisement to  
        /  |  \     |such equipment, punishable by action to
Searching for signs |recover actual monetary loss, or $500,
of intellegent life |whichever is greater, for each violation.
on the Information  |
  Super-Highway...  |


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

Date: 2 May 1997 14:19:00 GMT
From: awm@luers.qosina.com (Aram Mirzadeh)
Subject: Procedure to count unique lines
Message-Id: <slrn5mjtuf.l8.awm@luers.qosina.com>

Greetings, 

I have a 3.4MB text file with one entry per line.  I'm trying to count the
number of times each line item is listed.  I tried doing it via sort and 
count the number of items before the item itself changes, to no avail, and
it was VERY VERY slow.  

Has anyone already done this?  I would appreciate any pointers. 

Thanks. 

<Aram>


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

Date: Fri, 2 May 1997 15:13:32 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Procedure to count unique lines
Message-Id: <ebohlmanE9K7MK.1yJ@netcom.com>


Aram Mirzadeh (awm@luers.qosina.com) wrote:
: I have a 3.4MB text file with one entry per line.  I'm trying to count the
: number of times each line item is listed.  I tried doing it via sort and 
: count the number of items before the item itself changes, to no avail, and
: it was VERY VERY slow.  

Try using a hash keyed by item to store the counts.  This should require 
only one pass over the data (unlike sorting).



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

Date: Fri, 02 May 1997 10:12:47 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: Q: Cutting a string by position (like cut(1) can)
Message-Id: <336A046F.7647@hackberry.chem.niu.edu>

Andrew Pollock wrote:
> 
> Hi,
> 
> How do you dissect a string based on column? (Like the way cut(1) works?)
> I know all about splitting on whitespace, but I've got a string where
> tokens don't always appear, and splitting on whitespace is impractical.
> 
> Thanks in advance
> 
> Andrew
> --
> ----
> Andrew Pollock          Programmer/System Administrator
> apollock@bit.net.au     http://staff.bit.net.au/apollock
> Brisbane Internet Technology

try
man perlfunc
look for substr
or look it up in the camel.
-- 
==========================================================
 - darin
 burleigh@hackberry.chem.niu.edu
 '2 kinds of green, look out!' - dieter rot


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

Date: 2 May 1997 15:18:57 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: recursive directtory tree walk
Message-Id: <5kd0l1$9uk@linet06.li.net>

Two questions.

1. Has anybody tested this under Windows 95?
   It works great for the current directory,
   but does not seem to push any files from
   subdirectories into @allfiles.

2. How should I declare @allfiles so that I
   can use strict? It seems that I need it in
   wanted as well as in the calling routine.

Lars Gregersen (lg@kt.dtu.dk) wrote:

: The code below saved the full path of every file in and below
: 'c:\\files\\perl' in the array @allfiles.


: use File::Find;

: find(\&wanted, 'c:\\files\\perl');

: sub wanted
: {
:   push @allfiles, $File::Find::name;
: }


: I hope this helps.

:   Lars

: Lars Gregersen
: Technical University of Denmark
: Department of Chemical Engineering
: E-mail  : lg@kt.dtu.dk
: Homepage: http://www.gbar.dtu.dk/~matlg/


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

Date: Fri, 02 May 1997 17:23:11 +0100
From: Douglas Seay <seay@absyss.fr>
To: Rob J Meijer <rob@flnet.nl>
Subject: Re: select and FD_ macro's?
Message-Id: <336A14EF.62750B0A@absyss.fr>

[posted and mailed]


Rob J Meijer wrote:
> 
> I am triing to write a litle single process server deamon,
> but in the Camel book i can find some info on select, but non
> on a way to find out what handles are ready.
> What would be the perl equivalents to the following macro's found in c?
> 
> FD_SET(fd, &fdset)
> FD_CLR(fd, &fdset)
> FD_ISSET(fd, &fdset)
> FD_ZERO(&fdset)
> 
> Or does perl require other methods of finding out what socket handles
> are ready?

You read the man page?  What did you not understand about $rout, $wout
and $eout?  And for all that FD_crap, the example in perlfunc has the
code for doing that.  Just reread the man page.

- doug


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

Date: 2 May 1997 09:48:47 -0500
From: garee@convex.com (Scott Garee)
Subject: Re: using modems from perl
Message-Id: <5kcusf$5jj@mikey.convex.com>

Here's a sample code I provided to a customer for automating IO
to a modem from perl.  The sample reads commands from the keyboard
and sends them to the modem and returns results.  Should be trivial
to replace with automated IO.

Customer wanted it quick, so I shelled to stty for tty settings.
Would be nice to use ioctl's in perl if .ph's are available.
A nice exercise for the student. :)

#!/usr/local/bin/perl
$tty=shift;
$tty="/dev/$tty" if $tty !~ /\//;
open(OUT,">$tty") || die "Open failed: $!";
open(IN,"<$tty") || die "Open failed: $!";
select(OUT);$|=1;
select(IN);$|=1;
select(STDIN);$|=1;
select(STDOUT);$|=1;
system("stty 9600 >$tty");
system("stty -echo raw>$tty");
vec($vin,fileno(IN),1)=1;
vec($vin,fileno(STDIN),1)=1;
for (;;) {
  local($num,$vout,$char,$response,$cmd);

  ($num)=select($vout=$vin,undef,undef,3);
  if ($num) {
    if (vec($vout,fileno(IN),1)) {
      do {
	sysread(IN,$char,1);
	$response.=$char;
      } while ($char ne "\r" && $char ne "\n");
      print STDOUT "$response";
      $response="";
    }
    if (vec($vout,fileno(STDIN),1)) {
      while (sysread(STDIN,$char,1) && $char ne "\n") {
	$cmd.=$char;
      }
      print OUT "$cmd\r";
      $cmd="";
    }
  }
}
-- 
Scott Garee = garee@convex.hp.com http://www.convex.com
Hewlett Packard - Convex Technology Center - Richardson, TX
Avoid sweeping generalizations... They're never true. - me


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

Date: Fri, 02 May 1997 17:17:10 +0100
From: Douglas Seay <seay@absyss.fr>
To: Philippe Benichou <benichop@reality.cse.fau.edu>
Subject: Re: What is the best way of learning Perl?
Message-Id: <336A1386.396CAAFF@absyss.fr>

[posted and mailed]

Philippe Benichou wrote:
> 
> What is the best way for learning Perl?  Looking at other people's scripts
> is too confusing, and the O'Rielly book doesn't explain things well

The camel is a bit much, but stick with it.  If you already know several
programming languages, there is enough info here to learn Perl.  I
learned Perl with a few scripts a friend sent me plus the first edition
of the Camel.  Nowdays I'd say to start with Randal's Llama (also from
ORA).  Go to http://www.perl.com/ and look at TomC's book reviews.

I'll say that I don't think that Perl is a good first language, I don't
even think it is a great second language.  Perl was designed to replace
much shells, awk, sed, and small C programs.  You should have a basic
idea about shells and C if you want to learn Perl quickly.


> Phil (please email responses)

Rude.  Why do you feel that you can post in a public forum, but can't be
bothered to read it to get your response?

- doug


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

Date: Fri, 2 May 1997 08:44:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Philippe Benichou <benichop@reality.cse.fau.edu>
Subject: Re: What is the best way of learning Perl?
Message-Id: <Pine.GSO.3.96.970502084211.2421A-100000@kelly.teleport.com>

On 2 May 1997, Philippe Benichou wrote:

> What is the best way for learning Perl?  Looking at other people's scripts
> is too confusing, and the O'Rielly book doesn't explain things well.

Which O'Reilly book? The Camel is a reference, but the Llama is a
tutorial. Have you tried the Llama? I recommend it. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Fri, 2 May 1997 08:47:18 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Eric Harley <erich@powerwareintl.com>
Subject: Re: Write form to variable
Message-Id: <Pine.GSO.3.96.970502084624.2421C-100000@kelly.teleport.com>

On Thu, 1 May 1997, Eric Harley wrote:

> how would I write a format to a variable instead of writing it out to a
> file handle? 

It sounds like you want formline, documented in perlfunc(1). Hope this
helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

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 414
*************************************

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