[9809] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3402 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 10 01:07:23 1998

Date: Sun, 9 Aug 98 22:00:21 -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           Sun, 9 Aug 1998     Volume: 8 Number: 3402

Today's topics:
    Re: ActiveState 5.005: Where are the threads? <alfo@perspecta.com>
    Re: ActiveState 5.005: Where are the threads? (Philosopher King)
        Consulting opening (Wall Street Tech)
        Good and simple book for database learning in CGI/Perl <dcbel@dr.cgocable.ca>
    Re: math error <matthies@fsinfo.cs.uni-sb.de>
        MIME types and perl data... <alfo@perspecta.com>
        Perl & Unicode/Japanese Kanji (webjock)
    Re: Perl Docs.. forget the original post (Ronald J Kimball)
    Re: Perl Docs.. forget the original post (Ronald J Kimball)
    Re: Perl guru FAR *PLEASE MAKE SURE YOU READ* (Ronald J Kimball)
    Re: Perl/Tk-Win32? (nobody)
    Re: perlfaq - frequently asked questions about Perl (pa (Ronald J Kimball)
    Re: pretty perl editor for linux (Philosopher King)
    Re: Problem with $/ and \x0D on Win32 (Ronald J Kimball)
    Re: re first language (Philosopher King)
    Re: Sorting for Uniques <adnan@ind.tansu.com.au>
    Re: Sorting for Uniques (Larry Rosler)
    Re: Starting a new script to run in BG (Nem W Schlecht)
    Re: Teaching Perl (Ronald J Kimball)
        Test Results - Asking a question (Ronald J Kimball)
    Re: Test Results - Asking a question (Gary L. Burnore)
    Re: Underwood Typewriter and the backslash (Ilya Zakharevich)
        What is the purpose of Perl <momiji@slip.net>
    Re: What is the purpose of Perl (Miguel Cruz)
    Re: What is the purpose of Perl (Larry Rosler)
    Re: What is the purpose of Perl (Nem W Schlecht)
    Re: What is the purpose of Perl (Gary L. Burnore)
    Re: What is the purpose of Perl (Ronald J Kimball)
    Re: What is the purpose of Perl (Gary L. Burnore)
    Re: What's the difference? (Ronald J Kimball)
    Re: X-file (?=...), case postponed. (Ilya Zakharevich)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 09 Aug 1998 19:08:12 -0700
From: alfo <alfo@perspecta.com>
To: Michael Schilli <mschilli@blaxxun.com>
Subject: Re: ActiveState 5.005: Where are the threads?
Message-Id: <35CE560C.92EDF40C@perspecta.com>

Threads are dependant on an underlying POSIX thread api, which Windows does
not have... If you want threads you'll, unfortunatly, have to make your
perl code platform limited (no Win32 or MacOS).

#alfo

Michael Schilli wrote:

> Hi all,
>
> unfortunately, the only binary 5.005 distribution for Win32
> (ActiveState) doesn't support the new threads features. Anyone knows of
> a binary distribution that includes them?
>
> -- Michael
>





--
Alf O. Watt               alfo@perspecta.com         www.perspecta.com

         perl code is the beat poetry of the information age




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

Date: Mon, 10 Aug 1998 04:35:45 GMT
From: holcojh5@REMOVEMEwfu.edu (Philosopher King)
Subject: Re: ActiveState 5.005: Where are the threads?
Message-Id: <35d0762c.450612546@enews.newsguy.com>

On Sun, 09 Aug 1998 19:08:12 -0700, alfo <alfo@perspecta.com> wrote:

>Threads are dependant on an underlying POSIX thread api, which Windows does
>not have... If you want threads you'll, unfortunatly, have to make your
>perl code platform limited (no Win32 or MacOS).
>
>#alfo
>

Not true. At least not anymore. Quoting from README.win32 in the Perl
5.005_1 distribution:

"Beginning with version 5.005, there is experimental support for
building a perl interpreter that is capable of native threading." 

According to some other docs, threaded binaries will build with VC++,
BC++, or egcs/gcc. Of course this doesn't help the original poster too
much with finding such a binary, but at least the search is not
completely futile.

Later...

Heath

>Michael Schilli wrote:
>
>> Hi all,
>>
>> unfortunately, the only binary 5.005 distribution for Win32
>> (ActiveState) doesn't support the new threads features. Anyone knows of
>> a binary distribution that includes them?
>>
>> -- Michael
>>

--
Heath Holcomb                 * I want to be more like the ocean
holcojh5@REMOVEMEwfu.edu      * No talking man
http://www.wfu.edu/~holcojh5/ * All action
delete REMOVEME to email      * - Perry Farrell


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

Date: Mon, 10 Aug 1998 03:13:07 GMT
From: info@wst.net (Wall Street Tech)
Subject: Consulting opening
Message-Id: <7ztz1.434$fz2.2757315@nntp1.nac.net>

Six month + assignment Wall Street investment bank web group.  Perl, 
ASP, SQL.  Send mail with resume, availability, and rate pasted into 
body to:

dick@iit-inc.com




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

Date: Sun, 9 Aug 1998 20:48:00 -0500
From: "Ryan Belanger" <dcbel@dr.cgocable.ca>
Subject: Good and simple book for database learning in CGI/Perl
Message-Id: <6qlgn5$pp2$1@nr1.ottawa.istar.net>

Hi, I'm looking for a good, simple book to learn how to set up a simple but
good database in CGI/Perl.

Another question... is a CGI/Perl program runs only on UNIX based servers or
can it run on any Win NT servers?

Thanks a lot! :)

Ryan!

P.S. sorry about my english, I'm working on it! :) I'm a french canadian.




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

Date: 10 Aug 1998 00:18:56 GMT
From: Niklas Matthies <matthies@fsinfo.cs.uni-sb.de>
Subject: Re: math error
Message-Id: <6qle9g$5rm$1@hades.rz.uni-sb.de>

In comp.lang.perl.misc, Tom Bridgwater <T.Bridgwater@mindgear.com> writes:
[...]
> I tried those values as the denominator and they failed for me as well
> (I assume 103 should have been 105). I then tested a whole bunch of
> values, the results of which can be found at
> http://www.mindgear.com/perlerr/MathErr.html
> 
> I don't really know what to make of the results, but I see that there is
> definitely a pattern to this strangeness.

Hi, this is really a floating-point rounding error. Try this:

  @exprs = ('23/5 ', '50000 * (23/5)', 'int 50000 * (23/5)');
  for (@exprs) { printf "\%18s = \%58.50f\n", $_, (eval $_); }

It outputs:

             23/5  =       4.59999999999999964472863211994990706443786621093750
    50000 * (23/5) =  229999.99999999997089616954326629638671875000000000000000
int 50000 * (23/5) =  229999.00000000000000000000000000000000000000000000000000

Clear? :)

What you'd probably want to use is "int (foo + 0.5)" instead of "int foo",
which gives you better rounding behaviour.


For why  1 + int $val3 . '.'  *did* work, consider:

  for (1..17) { 
    $x = (1 - "1e-$_");
    printf "number: \%.70g\n", $x;
    print  "string: $x\n";
  }

Which outputs:

  number: 0.90000000000000002220446049250313080847263336181640625
  string: 0.9
  number: 0.9899999999999999911182158029987476766109466552734375
  string: 0.99
  number: 0.99899999999999999911182158029987476766109466552734375
  string: 0.999
  number: 0.9999000000000000110134124042815528810024261474609375
  string: 0.9999
  number: 0.99999000000000004551026222543441690504550933837890625
  string: 0.99999
  number: 0.99999899999999997124433548378874547779560089111328125
  string: 0.999999
  number: 0.99999990000000005263558477963670156896114349365234375
  string: 0.9999999
  number: 0.99999998999999994975240724670584313571453094482421875
  string: 0.99999999
  number: 0.99999999900000002828193146342528052628040313720703125
  string: 0.999999999
  number: 0.9999999998999999917259629000909626483917236328125
  string: 0.9999999999
  number: 0.99999999998999999917259629000909626483917236328125
  string: 0.99999999999
  number: 0.99999999999900002212172012150404043495655059814453125
  string: 0.999999999999
  number: 0.99999999999989996890548127339570783078670501708984375
  string: 0.9999999999999
  number: 0.9999999999999900079927783735911361873149871826171875
  string: 0.99999999999999
  number: 0.99999999999999900079927783735911361873149871826171875
  string: 0.999999999999999
  number: 0.99999999999999988897769753748434595763683319091796875
  string: 1
  number: 1
  string: 1

You can see two things here:

(1) The (binary) floating-point format isn't very "compatible" with long
    decimal fractions (the numbers should all read 0.99...9 actually).

(2) When converting numbers to strings internally, perl takes in account
    only the first 15 significant digits (if you replace the precision
    of 70 by 15 in the 'printf' above, you get exactly the same output
    for 'number' and 'string').

So,  1 + int $val3 . '.'  actually is

  1 + int((<to-string>(229999.99999999997089616954326629638671875)) . '.')
                     # 123456 7890123456  => rounds to 230000.000000000
which in turn is

  1 + int('230000' . '.')

which in turn is

  1 + int('230000.')

which in turn is

  1 + 230000

which in turn is

  230001

which is what you expected as the result, but is pure luck that it got
rounded the right way: if perl would round to 17 significant digits,
230000 would have been the result!

The bottom line: Even simple maths can be quite tricky on computers. :)

PS: The graphs you put on the web page look nice; how did you create them?

-- Niklas


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

Date: Sun, 09 Aug 1998 19:20:53 -0700
From: alfo <alfo@perspecta.com>
Subject: MIME types and perl data...
Message-Id: <35CE5905.2F727371@perspecta.com>



I have some code which creates message object, these are passed to
arbitrary 'messageHander' object ( I have a message handler object that
can be inherited by objects interested in messages, override
messageHander::recieveMessage and your good). I want to 'type' the
content of these message and I'm wondering if anyone has suggestions as
to a good, general purpose way to do this.

My first inkling is to use MIME types. Also, I would love to be able to
easily forward perl native references ( arrays, hashed, regexes & etc)
with good type codes. So: has anyone got a list of 'official' or
preferred MIME types for the various perl internal data types?

For e.g..:

application/x-perl-scalar-ref
application/x-perl-array-ref
application/x-perl-hash-ref
application/x-perl-object-ref        <- since the object knows what it
is, this should be enough.

etc...

PS, you can find a list of current (RFC1521) media types here:

ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types

Thanks for any thoughts and please CC me in your response.

#alfo

--
Alf O. Watt               alfo@perspecta.com         www.perspecta.com

         perl code is the beat poetry of the information age




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

Date: Mon, 10 Aug 98 02:41:19 GMT
From: webjock@nospaminteraxia.com (webjock)
Subject: Perl & Unicode/Japanese Kanji
Message-Id: <6qlmoe$t6u$1@nntp2.ba.best.com>

       

I have implemented a search engine that searches both "English" and "Japanese"

The search engine works fine if they enter in words in english (normal ascii). 
The output prints out Englidh/Kanji fine..

However, if I STDIN a unicode set of text (Kanji), the search engine dies... 
It just hangs...

What can I do??

-
HD
 


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

Date: Mon, 10 Aug 1998 00:24:32 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl Docs.. forget the original post
Message-Id: <1ddiex8.12ya3aunioolcN@bay1-189.quincy.ziplink.net>

David Meyer <dmeyer9@email.msn.com> wrote:

> I have reviewed this newsgroup for years.... and never posted a question.
> Why? Because they are really not very helpful.  It is nice... an unhelpful
> news group.  Read the FAQ... they expect for people who are not
> specialists in the language to become one.

I imagine if you wanted to rebuild your car engine, you might be
expected to become a specialist in auto mechanics.

> It is funny listening to them
> speak among themselves... I wonder why Larry does not frequent...
> etc...etc.  Why? because  he taught a group of people to become
> specialists in a language but did not teach them manners.

Actually, Larry does not frequent the newsgroup because of people like
you (and me, at the time when I started following this newsgroup)
complaining about the curt replies to posters of FAQs.  The FAQs and the
rude replies (note that curt and rude are not the same thing) are still
frustrating, but I no longer make a fuss about it.
The FAQ is there for a reason.  If you don't want to bother reading it,
then don't bother posting to the newsgroup.  Standard Operating
Procedure for usenet.

> So now we have a group of Monsters monitoring a news group.  Do you want
> some good advice?  Read the news group for information on to where to find
> information.

If you want information, first go to the FAQ and the standard
documentation.  If you still can't find the information, then come to
comp.lang.perl.misc, tell us where you've already looked for an answer
(or why you're still not sure of the answer), and then ask your
question.  You will not get flamed.
Watch for a post from me with the subject 'Test Results - Asking a
question'.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 00:29:28 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl Docs.. forget the original post
Message-Id: <1ddis05.hwq18xqpbp8pN@bay1-189.quincy.ziplink.net>

David Meyer <dmeyer9@email.msn.com> wrote:

> I have reviewed this newsgroup for years.... and never posted a question.
> Why? Because they are really not very helpful.  It is nice... an unhelpful
> news group.  Read the FAQ... they expect for people who are not
> specialists in the language to become one.

I imagine if you wanted to rebuild your car engine, you might be
expected to become a specialist in auto mechanics.

> It is funny listening to them
> speak among themselves... I wonder why Larry does not frequent...
> etc...etc.  Why? because  he taught a group of people to become
> specialists in a language but did not teach them manners.

Actually, Larry does not frequent the newsgroup because of people like
you (and me, at the time when I started following this newsgroup)
complaining about the curt replies to posters of FAQs.  The FAQs and the
rude replies (note that curt and rude are not the same thing) are still
frustrating, but I no longer make a fuss about it.
The FAQ is there for a reason.  If you don't want to bother reading it,
then don't bother posting to the newsgroup.  Standard Operating
Procedure for usenet.

> So now we have a group of Monsters monitoring a news group.  Do you want
> some good advice?  Read the news group for information on to where to find
> information.

If you want information, first go to the FAQ and the standard
documentation.  If you still can't find the information, then come to
comp.lang.perl.misc, tell us where you've already looked for an answer
(or why you're still not sure of the answer), and then ask your
question.  You will not get flamed.
Watch for a post from me with the subject 'Test Results - Asking a
question'.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 00:29:21 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl guru FAR *PLEASE MAKE SURE YOU READ*
Message-Id: <1ddiffu.1xacsa834enkkN@bay1-189.quincy.ziplink.net>

B. Oiledanimalbyproducts <sp@m.block> wrote:

> Subject: Perl guru FAR *PLEASE MAKE SURE YOU READ* 

You may not have realized just how obnoxious a subject line like that
is.

> *The documentation is crystal clear to you because you wrote it or were
> involved with writing it.

Wrong.  I have never been involved with writing the documentation for
Perl.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 9 Aug 1998 23:56:19 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: Perl/Tk-Win32?
Message-Id: <6qlcv3$mif@newsserver.trl.OZ.AU>

Sorry, my mistake - The Perl that came with MKS Toolkit was first on
the path and it apparently doesn't have it.

Thank you,
AC.

Dan Baker (dtbaker_@flash.net) wrote:
: nobody wrote:
: > 
: > Can anyone tell me if the Tk package runs under Win95?  'use Tk' fails
: > on the standard bindist5.004_02 and the Tk package off CPAN seems to
: > require UNIX.
: ----------
: hhmmm, the standard GS download I got off CPAN was
: perl5_00402-bindist04-bc.zip.While I have not messed with trying to
: write any test programs of my own using TK, I did stumble across some
: examples in the install, and they seem to run fine on my machine.
: (vanilla p133 running windows95). I'd say it may be best to go looking
: for the example in your install.

: Dan

: # If you would like to reply-to directly, remove the _ from my username
: * Use of my email address regulated by US Code Title 47,
: Sec.227(a)(2)(B)  *


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

Date: Mon, 10 Aug 1998 00:29:22 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <1ddio7u.r1yan3k8vql8N@bay1-189.quincy.ziplink.net>

Peter A Fein <p-fein@uchicago.edu> wrote:

> I'm not, but thanks for the trip back to grade school.  Usually
> though, the FAQ is for the newsgroup itself, not the topic of the
> newsgroup.  We've already got one such FAQ, posted twice weekly. ;)

Huh?  That just doesn't make sense.  Usually the frequently asked
questions are about the topic of the newsgroup, not the newsgroup
itself.
Unless the FAQ is only supposed to contain questions like "What does
'clpm' stand for?"?

:-)

And the twice-weekly posted 'FAQ' is actually a pointer to various
resources, including the actual Perl FAQ.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 02:37:50 GMT
From: holcojh5@REMOVEMEwfu.edu (Philosopher King)
Subject: Re: pretty perl editor for linux
Message-Id: <35ce5aef.443639810@enews.newsguy.com>

On Sat, 08 Aug 1998 10:38:34 +0200, Thomas Jespersen
<thomas@daimi.aau.dk> wrote:

>Greg Dickson wrote:
>> 
>> Does anyone know of a color syntax editor for perl preferably
>> 
>> I know this is pretty naff but Ive got used to this in
>> my other programing environments and it would just be nice
>
>Looking at your .signature I think you are using Linux. If that is the
>case get cperl-mode for emacs at CPAN/misc/emacs/cperl-mode/

If you don't like cperl-mode or can't get it to work, recent versions
of Emacs have a built-in Perl mode with syntax highlighting. Just do
M-x perl-mode (where M is Alt or Esc) to turn it on. You may also want
to put a line like:
#-*-Perl-*- 
somewhere near the beginning in your scripts to make Emacs recognize
your code as Perl every time you load the script. Regular perl mode
doesn't have a menu on the menubar, but I have written some code that
you can stick in your .emacs file if you want a simple one (email
me if you want it). You could also try nedit, which is a little more 
like a Windows editor if that's the environment you're coming from.

Anyway, good luck...

Heath

--
Heath Holcomb                 * I want to be more like the ocean
holcojh5@REMOVEMEwfu.edu      * No talking man
http://www.wfu.edu/~holcojh5/ * All action
delete REMOVEME to email      * - Perry Farrell


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

Date: Mon, 10 Aug 1998 00:29:23 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Problem with $/ and \x0D on Win32
Message-Id: <1ddiok0.vigzvx1y6ws87N@bay1-189.quincy.ziplink.net>

Bob Lanteigne <bob.p.lanteigne@mcdermott.com> wrote:

>   tr /\x0d/\x0d\x0a/;

There's no use in listing more characters on the right hand side of a
translation than on the left hand side.  tr/// does a one-to-one
translation.

You may have meant:

s/\x0d/\x0d\x0a/g;

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 03:12:20 GMT
From: holcojh5@REMOVEMEwfu.edu (Philosopher King)
Subject: Re: re first language
Message-Id: <35cf6094.445084838@enews.newsguy.com>

On Thu, 06 Aug 1998 16:48:50 -0500, ray <ralba@distorted.net> wrote:

>My first language was basic about 10 years ago.  After coding for a
>couple of years in that language I decided that perhaps programming was
>not for me.   I completely dropped the idea of programming until about
>three years ago when the Internet came about. Now I am trying
>desperately to understand Perl. For the most part it reads simple,
>however, I sometimes find it difficult to get what I want from it due to
>my lack of programming experience.  And since I am self teaching myself,
>I have no one to correct my mistakes.
>
>Do you think at this stage of the game, that I should perhaps
>investigate learning assembly to assist with my understanding of Perl, C
>and other languages?
>

I won't say that this would be a complete waste of time, but if you're
having trouble with Perl, I don't think you want to put yourself
through that kind of hell. It's good stuff to know and it can help you
with C, but it's probably not going to help you much with Perl. The
kinds of issues that are confusing in Perl (at least for me) are
things like regular expressions, variable scoping, and Perl's syntax;
things that are not going to come up in a low level language like
assembly because they are primarily higher level language issues. If
you want programming experience, I would recommend sticking it out
with C or maybe trying  Java. I can tell you from firsthand experience
that finding and correcting your own mistakes is much easier with any
of these languages than with assembly code.

>Also, I would like to mention, that if I could be a cook, I would be
>very happy.
>

Better a cook than an assembly language programmer. At least you won't
have to buy a new pair of glasses every week ;)

Later...

Heath

--
Heath Holcomb                 * I want to be more like the ocean
holcojh5@REMOVEMEwfu.edu      * No talking, man
http://www.wfu.edu/~holcojh5/ * All action
delete REMOVEME to email      * - Perry Farrell


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

Date: Mon, 10 Aug 1998 10:36:28 +1000
From: Adnan Music <adnan@ind.tansu.com.au>
Subject: Re: Sorting for Uniques
Message-Id: <35CE408C.276A8C5F@ind.tansu.com.au>

George H wrote:

> Is there an easy way to sort an array for uniques? ... like the 'sort -u'
> command line in UNIX.  I am reading an array of clients from a huge file
> and I want to sort it for unique client names.  I was hoping to sort
> without runing a UNIX command.
>
> Thanks in advance,
>
> george@tapestry.net

Pass your array to following function and you'll get array of sorted and
unique
elements as a result:

sub UniqElements
{
    my %seen ;
    my @unique = grep( defined($seen{$_}) ? 0 : (($seen{$_} = 1), 1) , @_ );

    return sort keys %seen;
}




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

Date: Sun, 9 Aug 1998 19:09:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting for Uniques
Message-Id: <MPG.1037f61ba8479bb09897be@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <35CE408C.276A8C5F@ind.tansu.com.au> on Mon, 10 Aug 1998 
10:36:28 +1000, Adnan Music <adnan@ind.tansu.com.au> says...
> George H wrote:
> > Is there an easy way to sort an array for uniques? ... like the 'sort -u'
> > command line in UNIX.  I am reading an array of clients from a huge file
> > and I want to sort it for unique client names.  I was hoping to sort
> > without runing a UNIX command.

You didn't bother to search for 'unique' in the wondeful Perl FAQ before 
posting this question, George!

 ... 
> sub UniqElements
> {
>     my %seen ;
>     my @unique = grep( defined($seen{$_}) ? 0 : (($seen{$_} = 1), 1) , @_ );
> 
>     return sort keys %seen;
> }

This is discussed, Adnan, with several approaches that are much more 
succinct than yours, in perlfaq4: "How can I extract just the unique 
elements of an array?"

 -- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 9 Aug 1998 20:54:38 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: Starting a new script to run in BG
Message-Id: <6qljsu$9g@abattoir.cc.ndsu.nodak.edu>

[courtesy copy e-mailed to author(s)]

In comp.lang.perl.misc, Brandon Pulsipher  <Brandon@xmission.com> wrote:
>     I am running AS Perl on WinNT 4.0.  I am hoping there is solution
>to my dilemma.  I would like to have a webpage (Perl Script) load and
>when it does, spawn another process (Perl script, or subroutine) that
>runs in the background until it finishes.  Basically, the first time
>each day that a certain script on my site is called up, I want it to run
>a maintenance script.  I don't want this to run and have the user wait,
>however, as it could take a while.
>    Any suggestions here?  I hope I made sense.  Please CC me on a
>response.  I only get the digest.  Thanks!

Can you do a fork() call on your WinNT machine?

At the top of your script:
$SIG{CHLD}='IGNORE';

Then wherever else in your script (probably at the end);

if ( .. check time and see if it already ran today ...) {
    if ($child = fork()) {
	print STDERR scalar localtime(time),
	    "Running cleanup (PID: $child) - should be logged in HTTP error-log file.\n";
	exit();
    } else {
	cleanup();	# or exec("cleanup.pl");
	exit();
    }
}

-- 
Nem W Schlecht                  nem@plains.nodak.edu
NDUS UNIX SysAdmin        http://www.nodak.edu/~nem/
"Perl did the magic.  I just waved the wand."


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

Date: Mon, 10 Aug 1998 00:29:24 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Teaching Perl
Message-Id: <1ddipni.15wuvo6yuvlrzN@bay1-189.quincy.ziplink.net>

Tad McClellan <tadmc@metronet.com> wrote:

> : and tr/// 
> 
> 
>    That does not use regexes _at all_!
> 
>    If the original poster adds coverage of tr///, maybe he should
>    send that part to you  ;-)

>From the Camel book, 2nd ed, Chapter 2, pg 74:
(Section: Pattern Matching Operators)

tr/SEARCHLIST/REPLACEMENTLIST/cds
y/SEARCHLIST/REPLACEMENTLIST/cds

  Strictly speaking, this operator doesn't belong in a section on
  pattern matching because it doesn't use regular expressions.


But they put it in the section on pattern matching anyway.  So I don't
think it's a big deal if someone in the newgroup does it too.  :-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 00:29:27 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Test Results - Asking a question
Message-Id: <1ddir2o.ko3po912eveh5N@bay1-189.quincy.ziplink.net>

Inspired by a post from John Moreno [1], I posted the following under an
assumed name:

  Subject:      Can't figure out how to remove newlines
  From:         "Terrence E. S. Thompson" <thompson@m-net.arbornet.org>
  Date:         Tue, 28 Jul 1998 23:19:38 -0400
  Message-ID:   <35BE94CA.3621E77A@m-net.arbornet.org>

  Hi, I've got a problem that is just driving me crazy.  I've looked
  in the manual and the faq, but I'm just not getting it.  How exactly
  do I remove a newline from the end of a string?

  I tried this:

  $string =~ s/(.+)\n$/$1/;

  but it doesn't seem to work.

  Sorry if this a dumb question, but I'm really stuck.
  Thanks for any help!


I am happy to report that John was absolutely right.  I received
absolutely no flames in response to the question.  Instead, I got five
helpful responses (via mail and/or the newsgroup), including one from
Abigail.  And one UCE.  :-)

So, if you've looked for an answer in the manual and the FAQ, be sure to
mention it when you ask your question!


[1]
Subject: Re: What a Crappy World (oh, yes!)
From: phenix@interpath.com (John Moreno)
Date: Wed, 24 Jun 1998 18:42:59 GMT
Message-ID: <1db4tg2.1p0byl3u1qa2iN@roxboro0-044.dyn.interpath.net>

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 04:39:05 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: Test Results - Asking a question
Message-Id: <35d27942.282456363@nntpd.databasix.com>

[snip]

>  And one UCE.  :-)


So if you get the UCE'ers account yanked, it'll be a bonus.

-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: 10 Aug 1998 02:26:52 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Underwood Typewriter and the backslash
Message-Id: <6qllpc$94h$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jeffrey Drumm
<drummj@mail.mmc.org>],
who wrote in article <35cd69ee.612982005@news.mmc.org>:
> On 7 Aug 1998 14:20:55 GMT, cpierce1@cp500.fsic.ford.com (Clinton Pierce)
> wrote:
> 
> >I like the new cover to The Perl Journal, with the attempted run
> >of ./Configure on the Underwood, but I have a question.  Since the
> >Underwood Typewriter has no backslash key (\), does Perl now support
> >trigraphs for those architectures?
> 
> (snip)
> 
> No such special support has yet been added. The current workaround:

Stop spreading FUD!  Starting from 5.005, trigraphs are fully
supported!  See L<perlre/"Creating custom RE engines">.

Ilya


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

Date: Sun, 09 Aug 1998 17:44:21 -0700
From: Eric Umehara <momiji@slip.net>
Subject: What is the purpose of Perl
Message-Id: <35CE4264.2E0AEE50@slip.net>

I'm learning perl  and am curios whatis the purpose of Perl?? What can
it do and hwat has it done.



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

Date: 10 Aug 1998 01:39:45 GMT
From: mnc@diana.law.yale.edu (Miguel Cruz)
Subject: Re: What is the purpose of Perl
Message-Id: <6qlj11$aok$1@news.ycc.yale.edu>

In article <35CE4264.2E0AEE50@slip.net>, Eric Umehara  <momiji@Slip.Net> wrote:
> I'm learning perl and am curious what is the purpose of Perl?? What can it
> do and what has it done.

Perl can bend steel bars and move mountains. Perl can tie back the hands of
time. Perl is good for the goose and for the gander. Perl can beat up Mike
Tyson with one hand tied behind its back. Perl can make a rock so heavy it
can't lift it. 

Perl has saved the rainforests, it has been to the moon, and it has cured
all major diseases. It has exceeded all known bounds. It has mapped the
universe and created an exact duplicate. Perl has danced with angels and
dined with Shakespeare. 

Didn't you read the manual?

miguel


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

Date: Sun, 9 Aug 1998 19:12:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: What is the purpose of Perl
Message-Id: <MPG.1037f6cecc0c4a1c9897bf@nntp.hpl.hp.com>

In article <6qlj11$aok$1@news.ycc.yale.edu> on 10 Aug 1998 01:39:45 GMT, 
Miguel Cruz <mnc@diana.law.yale.edu> says...
> In article <35CE4264.2E0AEE50@slip.net>, Eric Umehara  <momiji@Slip.Net> wrote:
> > I'm learning perl and am curious what is the purpose of Perl?? What can it
> > do and what has it done.
 ...
> Didn't you read the manual?

Or perlfaq1: "What is Perl?" and  "Can I do [task] in Perl?" and others.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 9 Aug 1998 21:39:53 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: What is the purpose of Perl
Message-Id: <6qlmhp$uj@abattoir.cc.ndsu.nodak.edu>

[courtesy copy e-mailed to author(s)]

In comp.lang.perl.misc, Eric Umehara  <momiji@Slip.Net> wrote:
>I'm learning perl  and am curios whatis the purpose of Perl?? What can
>it do and hwat has it done.

Welcome to a wonderful world where your code production time is greatly
reduced and you have a ton of fun programming. ;-)

Check out 'http://www.perl.com/' - the definitive site for Perl and all of
it's aspects.

-- 
Nem W Schlecht                  nem@plains.nodak.edu
NDUS UNIX SysAdmin        http://www.nodak.edu/~nem/
"Perl did the magic.  I just waved the wand."


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

Date: Mon, 10 Aug 1998 04:17:24 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: What is the purpose of Perl
Message-Id: <35cf73f6.281099924@nntpd.databasix.com>

On 10 Aug 1998 01:39:45 GMT, in article <6qlj11$aok$1@news.ycc.yale.edu>,
mnc@diana.law.yale.edu (Miguel Cruz) wrote:

>In article <35CE4264.2E0AEE50@slip.net>, Eric Umehara  <momiji@Slip.Net> wrote:
>> I'm learning perl and am curious what is the purpose of Perl?? What can it
>> do and what has it done.
>
>Perl can bend steel bars and move mountains. Perl can tie back the hands of
>time. Perl is good for the goose and for the gander. Perl can beat up Mike
>Tyson with one hand tied behind its back. Perl can make a rock so heavy it
>can't lift it. 
>
>Perl has saved the rainforests, it has been to the moon, and it has cured
>all major diseases. It has exceeded all known bounds. It has mapped the
>universe and created an exact duplicate. Perl has danced with angels and
>dined with Shakespeare. 
>
>Didn't you read the manual?

Now here's an example of someone who _SHOULD_ be flamed, but Miguel answers
him politely instead.  

My first question would by WHY would he be learning perl if he didn't know
what it did and WHY doesn't he know what it does if he's LEARNING it.


-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: Mon, 10 Aug 1998 00:36:12 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: What is the purpose of Perl
Message-Id: <1ddisav.mykw5xoxbj3zN@bay1-189.quincy.ziplink.net>

Gary L. Burnore <gburnore@databasix.com> wrote:

> Now here's an example of someone who _SHOULD_ be flamed, but Miguel answers
> him politely instead.  

We just can't seem to get it right, can we?

;-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 10 Aug 1998 04:48:09 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: What is the purpose of Perl
Message-Id: <35ce7b6d.283011207@nntpd.databasix.com>

On Mon, 10 Aug 1998 00:36:12 -0400, in article
<1ddisav.mykw5xoxbj3zN@bay1-189.quincy.ziplink.net>, rjk@coos.dartmouth.edu
(Ronald J Kimball) wrote:

>Gary L. Burnore <gburnore@databasix.com> wrote:
>
>> Now here's an example of someone who _SHOULD_ be flamed, but Miguel answers
>> him politely instead.  
>
>We just can't seem to get it right, can we?
>
>;-)

Hehehe. Yup. I mean nope. I mean...

-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: Mon, 10 Aug 1998 00:29:25 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: What's the difference?
Message-Id: <1ddiq6z.li906515l105lN@bay1-189.quincy.ziplink.net>

John Porter <jdporter@min.net> wrote:

> [mailed only]

Oops, looks like it was posted only instead of mailed only.

Sorry I didn't reply, I've only been half-keeping up with clpm this week
- and the subject header for this thread begins with a 'W'.  :-) 

> Ronald J Kimball wrote:
> > 
> > [1] There is even a way to use word characters, but we won't worry about
> > that right now.  :-)
> 
> O.k, I guess I'm not quite at guru status yet.
> So how is it done?

Well, Rick Delaney already posted an example.  Just put whitespace
between the operator and the first delimiter.

s ack! this can't be right. something is amiss;
m this is fun too;

For even more fun, try using one of the letters that has special meaning
when backslashed, such as s or w.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 10 Aug 1998 02:01:11 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qlk97$6o4$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Patrick Timmins
<ptimmins@netserv.unmc.edu>],
who wrote in article <6qf8qv$64c$1@nnrp1.dejanews.com>:
> I'm still not getting this.

I have no idea why.

  a) Do you understand that /(?=.*)/ will do the same as // ?
  b) Do you understand that extra () creates extra elements?

Ilya


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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