[8038] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1663 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 17 22:06:29 1998

Date: Sat, 17 Jan 98 19:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 17 Jan 1998     Volume: 8 Number: 1663

Today's topics:
    Re: Book review wanted - GET IT FOR FREE <flavell@mail.cern.ch>
    Re: Calling Perl for Win32 from Visual Basic 5.0 <rootbeer@teleport.com>
    Re: Enumeration under perl <merlyn@stonehenge.com>
    Re: fork variables <rootbeer@teleport.com>
        GetOpts::Std and 'Use of Uninitialized variable' errors <mhazen@franklin.uga.edu>
        getting info from web users <dyang@mork.uni.uiuc.edu>
    Re: getting info from web users (brian d foy)
    Re: Getting the first two chars of a string - URGENT! <rjk@coos.dartmouth.edu>
    Re: Helpful people (Michael Watson)
        How do you convert a number to a string? <duhsty@mountain-inter.net>
    Re: How do you convert a number to a string? (brian d foy)
    Re: How do you convert a number to a string? <duhsty@mountain-inter.net>
    Re: How to do random pornography in Perl. (Andy Lester)
        How to search for duplicate elements (J1T1W1)
    Re: HTTP post <rootbeer@teleport.com>
        I need some help pleeze <jhodges@datasync.com>
    Re: I need some help pleeze (brian d foy)
    Re: Install Perl Compiler in cgi-bin? <rootbeer@teleport.com>
    Re: Is there a way to list all source used by perl pgm? <rootbeer@teleport.com>
    Re: Looking for better Text::GenderFromName <adinfo@DollarDirectory.Com>
        new FAQ for Perl for Win32? (Len Weisberg)
        novice question: ranking array elements (Ralph Brands)
    Re: perl4 vs. perl5 verification <rootbeer@teleport.com>
    Re: Problems running Perl 5 on NT 4.0/Netscape Enterpri <rootbeer@teleport.com>
    Re: Q: Regional Sort by ZIP code? <flavell@mail.cern.ch>
        Question about @INC and require <gnielson@charlotte.infi.net>
    Re: reexporting symbols in modules <rootbeer@teleport.com>
    Re: Search engines and hiding directories <rootbeer@teleport.com>
    Re: Sockets and Perl and Deadlock <rootbeer@teleport.com>
    Re: source into binary code <rootbeer@teleport.com>
    Re: Syntax errors with nested braces??? <rjk@coos.dartmouth.edu>
    Re: system call from within a cgi script <webmaster@fccj.cc.fl.us>
    Re: system call from within a cgi script (brian d foy)
    Re: What is wrong with this script? <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 18 Jan 1998 00:45:15 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Book review wanted - GET IT FOR FREE
Message-Id: <Pine.HPP.3.95a.980118004222.28377A-100000@hpplus02.cern.ch>

On Sat, 17 Jan 1998, Jerry Davis wrote:

> REGARDLESS YOU OWE IT TO YOURSELF TO CHECK THIS SITE OUT!

Well done!  It works every time.

Whenever I overrule my filter, I always find that the postings
it was suppressing were spot-on.

A line all in caps was just too easy.  Keep it up.




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

Date: Sat, 17 Jan 1998 17:58:42 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: marcelg@popd.ix.netcom.com
Subject: Re: Calling Perl for Win32 from Visual Basic 5.0
Message-Id: <Pine.GSO.3.96.980117175757.1296J-100000@user2.teleport.com>

On Fri, 16 Jan 1998 us,ppp,marcelg@popd.ix.netcom.com wrote:

> Does anybody have a suggestion on how to call perl scripts from Visual
> Basic 5.0 ? 

Try the same way you call non-Perl scripts. If you're not sure what that
method is, check your docs or a newsgroup about VB. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 17 Jan 1998 18:42:38 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Ralph J Smith <rjsmith@ilnds.com>
Subject: Re: Enumeration under perl
Message-Id: <8cra66k169.fsf@gadget.cscaper.com>

>>>>> "Ralph" == Ralph J Smith <rjsmith@ilnds.com> writes:

Ralph> Does Perl have a way to do enumeration.

Ralph> 	enum{RED,WHITE,BLUE,GREEN};

    {
	my $i = 0;
	use constant
	    RED => $i++,
	    WHITE => $i++,
	    BLUE => $i++,
	    GREEN => $i++,
	    ;
    }

Or, if you don't mind a little more magic :-),

    BEGIN {
	no strict refs;
	my $i = 0;
	for (qw(RED WHITE BLUE GREEN)) {
	    *$_ = do { my $j = $i++; sub () { $j } };
	}
    }

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 226 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sat, 17 Jan 1998 18:38:11 -0800
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: fork variables
Message-Id: <Pine.GSO.3.96.980117183451.1296R-100000@user2.teleport.com>

On Sat, 17 Jan 1998, it was written:

>                 FORK:{
>                         if($pid = fork) {
>                                 #parent
>                                 @notsolongtime=&not_such_a_long_subroutine
>                         }else(defined $pid) {
>                                 #child
>                                 @longtime=&data_from_a_longtime_subroutine;
>                                 exit;
>                         };
>                 };

You do know what will happen if $pid is not defined, right?

>                 wait;
>                 print "@notsolongtime";     #THIS DOESN'T WORK, WHY???!!

Lots of possible reasons. One of them is that the code to set that
variable didn't do what you thought it did. 

>                 print "@longtime";

If you're hoping that this will have a value from the child process, you
should stop hoping. :-)

>         };

> It seems that in the parent process which is proceeded after finnishing
> the fork doesn't receive the data got in the child process, because
> @notsolongtime isn't printed. 

@notsolongtime doesn't have anything to do with the child process, at
least in the code you posted. If you're still having troubles, could you
make a small but complete and runnable program which demonstrates what
trouble you're having? Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 21:39:35 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
Subject: GetOpts::Std and 'Use of Uninitialized variable' errors?
Message-Id: <34C16B67.9A11BBF4@franklin.uga.edu>

This relates to Perl 5.004 under Redhat Linux 5.0, and the behavior is
exhibiting itself with GetOpts::Std from the standard distribution.

I'm in the final stretch of trying to clean up a program I've been
writing, so I'm calling Perl with the '-w' flag. I can't use the '-T'
flag (as far as I know) because of two things: one of the command line
options allows the user to point anywhere they wish to for a config file
(which I parse as carefully as I know how), and secondly, the nature of
the program builds large arrays of files, directories and their
subdirectories using File::Find, and even if it works, I'm cautious
about stuffing 400 directories into $ENV{'PATH'}. This program does
nothing to files except generate complex file age reports, so I'm not
too worried about overeager users using it to hack other files (all
output is to STDOUT). I could be wrong about that was well, but seeing
as this is a script only accessible by root anyhow, if the a user other
than myself can run it in the first place, I've got more serious
problems. :-)

Now on the the crux of my question. I'm using GetOpt::Std in this
program, and my question relates to the following block:

getopts('dhvf:');
   $debug=1 if ($opt_d);
   showHelp() if ($opt_h);
   versionInfo() if ($opt_v);
   $configFile=$opt_f if (defined $opt_f);

I've noticed two things about thus far which have me perplexed:

1) If I try to initialize a variable ahead of time which getopts() would
return a value in, getopts will not return a value properly. This is to
say, if I include a line befre the call to getopts() which said "my
$opt_v;" $opt_v will never be set to '1' by getopts() even if I call my
program with a '-v' option. Is there a reason for this behavior?

2) If I try to test the status of a variable set by getopt() using "if
($opt_d = 1)" I get a "Use of Uninitalized variable" error for that
line, but if I test via "if ($opt_d)" I get no error. Can someone
explain to me the difference? I've read the documentation on GetOpts and
the module reference part of the Camel book forwards and backwards, but
I have a feeling the answer for this behavior lies elsewhere.

Thanks in advance for an explanations!

-mh.
----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?




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

Date: 18 Jan 1998 01:33:29 GMT
From: "Steve Michaels" <dyang@mork.uni.uiuc.edu>
Subject: getting info from web users
Message-Id: <01bd23af$d182c860$94197e82@dilbert>


is it possible to write a perl script that would get info about people that
came to your page?  My admin allows me to run shell scripts, and I was
wondering if this is possible.

Steve

(like using the ENV variables and stuff)


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

Date: Sat, 17 Jan 1998 21:11:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: getting info from web users
Message-Id: <comdog-ya02408000R1701982111070001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd23af$d182c860$94197e82@dilbert>, "Steve Michaels" <dyang@mork.uni.uiuc.edu> posted:

>is it possible to write a perl script that would get info about people that
>came to your page?  My admin allows me to run shell scripts, and I was
>wondering if this is possible.

yes.  but it's nothing Perl specific, so you might want to ask in a 
forum the discusses such things.  perhaps 
comp.infosystems.www.authoring.cgi?

however, if there are Perl specific issues in your task, come back here :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 17 Jan 1998 18:55:03 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: wcb4@erols.com
Subject: Re: Getting the first two chars of a string - URGENT!
Message-Id: <34C144D7.1E8CE537@coos.dartmouth.edu>

[posted and mailed]

William Byrd wrote:
> 
> On Fri, 16 Jan 1998 23:28:01 -0500, Chipmunk <rjk@coos.dartmouth.edu>
> wrote:
> 
> >$first2 = $string;
> >substr($first2, -length($first2)-2)) = '';
>
> just outta curiosity, why set the $first2 equal to the full string
> first and not just:
> 
> $first2 = substr($string,0,2);
> 
> is there some advantage?
> 
> If I am missing something obvious, please remember, I have only
> written a few perl scripts, mostly for cgi's, so I am still talking
> the perl baby talk.

No, there is no advantage.

The original question was so simple that anyone who had read the
documentation or a good Perl book should have known the answer,
and several people had already pointed the original poster in
the correct direction.

So, I had a little fun by posting a silly but working solution.

TMTOWTDI, but some ways are better than others.  Your solution to
this problem is the best way to do it.

Chipmunk


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

Date: Sun, 18 Jan 1998 01:08:42 GMT
From: nospam@iquest.net (Michael Watson)
Subject: Re: Helpful people
Message-Id: <69rkd6$b8a$1@news.iquest.net>

Heck, just post your question. Perhaps you're wanting realtime response in 
support of your questions, but this is a newsgroup. There's a time lag until 
it's posted, and another lag until folks read and respond. Be ok with that, 
and many times you'll have gotten to be a better programmer in the process of 
solving the troubles before you get a response.

In article <69nhda$dn5$1@droppa.tpgi.com.au>, "Brett" <brett@moggy.com> wrote:
>I'm at the earliest stages of learning Perl (and finding it hard to get
>motivated).  Eventually I want to be able to write Perl scripts myself for
>the net, and to use that knowledge to help others learn (as I do with my
>Graphic Arts skills and Webdesigning).
>The problem is, when I am trying to figure stuff out, I can't find anyone to
>help me.  Australia is a dumb place to be if you want to learn something.
>You guys (northern hemispherians) are always offline and in bed when I am
>trying to find helpful people on IRC or wherever.
>Can anyone here help me solve a problem that is too difficult to explain in
>one posting?
>I'd like to hear from you guys - talk to me...
>
>regards,
>Brett Phillips
>
>http://www.moggy.com
>
>


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

Date: 18 Jan 1998 01:23:23 GMT
From: "Dustin Stable" <duhsty@mountain-inter.net>
Subject: How do you convert a number to a string?
Message-Id: <01bd23b0$13675fc0$465af4cc@default>


How do you convert numbers to strings in Perl?

Please send replies to this post to adowad@uniserve.com.

Thanks,
Alex


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

Date: Sat, 17 Jan 1998 20:38:45 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How do you convert a number to a string?
Message-Id: <comdog-ya02408000R1701982038450001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd23b0$13675fc0$465af4cc@default>, "Dustin Stable" <duhsty@mountain-inter.net> posted:

>How do you convert numbers to strings in Perl?

no need to do that since perl does it for you already.  

perhaps you are having some other difficulties though?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 18 Jan 1998 01:46:21 GMT
From: "Dustin Stable" <duhsty@mountain-inter.net>
Subject: Re: How do you convert a number to a string?
Message-Id: <01bd23b3$48ef4380$425af4cc@default>

Dear Brian,

> no need to do that since perl does it for you already.  
Thanks...

Alex


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

Date: 18 Jan 1998 00:50:37 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: How to do random pornography in Perl.
Message-Id: <69rjkt$gag$1@usenet51.supernews.com>

: My newsletter, "The Tiny Lobster" shows you how.

: http://www.jbum.com/jbum/tl/

Those amused by this may also want to check out My Favorite Joke, on my
home page listed in my sig.

xoxo,
Andy


--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: 18 Jan 1998 01:41:14 GMT
From: j1t1w1@aol.com (J1T1W1)
Subject: How to search for duplicate elements
Message-Id: <19980118014100.UAA25860@ladder01.news.aol.com>

All,
  is there a trivial script to search for duplicate elements in an array and
print their totals. If so can someone provide me with an answer. Thanks in
advance.

R/ J1T1W1


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

Date: Sat, 17 Jan 1998 17:53:27 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Smith and O'Halloran <inwap@best.com>
Subject: Re: HTTP post
Message-Id: <Pine.GSO.3.96.980117175138.1296H-100000@user2.teleport.com>

On 16 Jan 1998, Smith and O'Halloran wrote:

> The blank line comes AFTER Content-Length, not before.
> 
> You'll find answers to questions like this in comp.lang.perl.misc .

Alas, that's true. But you _should_ find such answers in docs, FAQs, or a
newsgroup about the protocol or about CGI scripting, since there's nothing
Perl-specific about where the blank line goes; that's the same if you're
programming in any language. Cheers!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 19:48:54 -0500
From: Jay Hodges <jhodges@datasync.com>
Subject: I need some help pleeze
Message-Id: <34C15176.2983@datasync.com>

I have written a survey results tabulation script and am having a
strange problem.  The problem code is listed below:

     if ($sex == "M") {$sex_a++;}
  elsif ($sex == "F") {$sex_b++;}

These lines look harmless but in fact when executed the "M" counter gets
incremented every time executed (regardless of the value of the $sex
variable) and the 'elsif' part doesnt get evaluated.  Furthermore, if I
comment out the 'if' line and change the 'elsif' to an 'if' THAT line
now gets evaulated as TRUE (no matter what is in the $sex variable).  I
am not new to programming and have written in several languages.  I have
just began to write in PERL and this problem is stumping me.  Am I as
stupid as I feel?  Someone help please!

Thanx...J


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

Date: Sat, 17 Jan 1998 21:17:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: I need some help pleeze
Message-Id: <comdog-ya02408000R1701982117090001@news.panix.com>
Keywords: from just another new york perl hacker

Please read this information on how to choose a good subject for a post:
       <URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>

In article <34C15176.2983@datasync.com>, jhodges@datasync.com posted:

>I have written a survey results tabulation script and am having a
>strange problem.  The problem code is listed below:
>
>     if ($sex == "M") {$sex_a++;}
>  elsif ($sex == "F") {$sex_b++;}

oy.  looks like you have a numerical comparison operator for a 
string comparison.  i would also guess that you weren't using
the -w switch to turn on optional warnings (which would have 
complained about this).

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 17 Jan 1998 18:25:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: thomasbererton@position-it.com
Subject: Re: Install Perl Compiler in cgi-bin?
Message-Id: <Pine.GSO.3.96.980117181611.1296N-100000@user2.teleport.com>

On Fri, 16 Jan 1998 thomasbererton@position-it.com wrote:

> Subject: Install Perl Compiler in cgi-bin?

Maybe I'm misunderstanding what you're asking about, but everyone should
know that under no circumstances should anyone install anything as
versatile as a perl binary into a server's cgi-bin directory. The rule to
use is that anything in a cgi-bin directory should do only what you want
it to do, no matter what input it gets. Perl is too powerful for that.

> I would like to use Malcolm Beattie's wonderful Perl Compiler, however,
> all I have to work with is my ISP's linux perl install (5.004_01).
> 
> Is there any way to get the Compiler to work without installing it into
> the default perl install directories?

It shouldn't need to be installed into any special directories. (After
all, Perl runs on some systems don't have /usr or whatever.) But, of
course, any programs you produce may need to go into a certain directory -
that is, the cgi-bin directory, say. 

BTW, there's normally little or no need (or benefit) to compiling CGI
scripts. If you're hoping for greater speed, check out mod_perl for
Apache, though. 

> I've been able to get additional modules to install properly in an
> arbitrary directory and then access them using a BEGIN block like: 
> 
> BEGIN { push(@INC, "/users/perluser/my_perl_library"); }

You could also 'use lib'. That's a little easier to use, and it puts your
libraries first.

> .... however, Compiler-a3 doesn't seem to like being installed in an
> arbitrary directory.

I don't think that the problems you're seeing are the result of the
installation directory. Of course, -a3 means that it's an alpha release,
and that bugs and problems are to be expected. :-)  Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 17:40:09 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Richard Frenkel <infobord@shore.net>
Subject: Re: Is there a way to list all source used by perl pgm?
Message-Id: <Pine.GSO.3.96.980117173457.1296F-100000@user2.teleport.com>

On 16 Jan 1998, Richard Frenkel wrote:

> I use CPAN modules extensively and it takes my Sparc 1.43 CPU seconds to 
> assemble all the code from the calls inside calls inside calls inside
> calls (you get the idea) and .02 CPU seconds to run the thing.
> 
> Without proof, I strongly suspect if I could gather all the modules in
> one file the parsing of the file would be much faster than fetching them
> from all over the file system.

That _might_ be true, but I have my doubts. It would (at least) be a
complex file to produce and maintain, since you wouldn't simply
concatenate the different files. Still, I don't want to stand in your way
- and, if it works, I'd sure like to know! 

Put this into your existing script. When your program exits, unless
something nefarious is going on, your program should print out a list of
all of the modules it loaded, and where they came from. 

    END { print "Modules were:\n", map "  $INC{$_}\n", sort keys %INC }

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 18:49:31 -0600
From: INFORMATION <adinfo@DollarDirectory.Com>
To: Clay Irving <clay@panix.com>
Subject: Re: Looking for better Text::GenderFromName
Message-Id: <34C1519B.C006ECD2@DollarDirectory.Com>

The following awk script is very good.  Perhaps it can help.

# by Scott Pakin 8/91 in CLM 12/91
 
{ debug = 1 }
 
# assume male
/./ {
        sex = "m"
        if (debug > 0) print "assume male" }
 
# most names ending in a/e/i/y are female
/^.*[aeiy]$/ {
        sex = "f"
        if (debug > 0) print "most names ending in a/e/i/y are female" }
 
# Allison and variations
/^All?[iy]((ss?)|z)on$/ {
        sex = "f"
        if (debug > 0) print "Allison and variations" }
 
# Cathleen, Eileen, Maureen
/^.*een$/ {
        sex = "f"
        if (debug > 0) print "Cathleen, Eileen, Maureen" }
 
# Barry, Larry, Perry
/^[^S].*r[rv]e?y?$/ {
        sex = "m"
        if (debug > 0) print "Barry, Larry, Perry" }
 
# Clive, Dave, Steve
/^[^G].*v[ei]$/ {
        sex = "m"
        if (debug > 0) print "Clive, Dave, Steve" }
 
# Carolyn, Gwendolyn, Vivian
/^[^BD].*(b[iy]|y|via)nn?$/ {
        sex = "f"
        if (debug > 0) print "Carolyn, Gwendolyn, Vivian" }
 
# Dewey, Stanley, Wesley
/^[^AJKLMNP][^o][^eit]*([glrsw]ey|lie)$/ {
        sex = "m"
        if (debug > 0) print "Dewey, Stanley, Wesley" }
 
# Heather, Ruth, Velvet
/^[^GKSW].*(th|lv)(e[rt])?$/ {
        sex = "f"
        if (debug > 0) print "Heather, Ruth, Velvet" }
 
# Gregory, Jeremy, Zachary
/^[CGJWZ][^o][^dnt]*y$/ {
        sex = "m"
        if (debug > 0) print "Gregory, Jeremy, Zachary" }
 
# Leroy, Murray, Roy
/^.*[Rlr][abo]y$/ {
        sex = "m"
        if (debug > 0) print "Leroy, Murray, Roy" }
 
# Abigail, Jill, Lillian
/^[AEHJL].*il.*$/ {
        sex = "f"
        if (debug > 0) print "Abigail, Jill, Lillian" }
 
# Janet, Jennifer, Joan
/^.*[Jj](o|o?[ae]a?n.*)$/ {
        sex = "f"
        if (debug > 0) print "Janet, Jennifer, Joan" }
 
# Duane, Eugene, Rene
/^.*[GRguw][ae]y?ne$/ {
        sex = "m"
        if (debug > 0) print "Duane, Eugene, Rene" }
 
# Fleur, Lauren, Muriel
/^[FLM].*ur(.*[^eotuy])?$/ {
        sex = "f"
        if (debug > 0) print "Fleur, Lauren, Muriel" }
 
# Lance, Quincy, Vince
/^[CLMQTV].*[^dl][in]c.*[ey]$/ {
        sex = "m"
        if (debug > 0) print "Lance, Quincy, Vince" }
 
# Margaret, Marylou, Miriam
/^M[aei]r[^tv].*([^cklnos]|([^o]n))$/ {
        sex = "f"
        if (debug > 0) print "Margaret, Marylou, Miriam" }
 
# Clyde, Kyle, Pascale
/^.*[ay][dl]e$/ {
        sex = "m"
        if (debug > 0) print "Clyde, Kyle, Pascale" }
 
# Blake, Luke, Mike
/^[^o]*ke$/ {
        sex = "m"
        if (debug > 0) print "Blake, Luke, Mike" }
 
# Carol, Karen, Sharon
/^[CKS]h?(ar[^lst]|ry).+$/ {
        sex = "f"
        if (debug > 0) print "Carol, Karen, Sharon" }
 
# Pam, Pearl, Rachel
/^[PR]e?a([^dfju]|qu)*[lm]$/ {
        sex = "f"
        if (debug > 0) print "Pam, Pearl, Rachel" }
 
# Annacarol, Leann, Ruthann
/^.*[Aa]nn.*$/ {
        sex = "f"
        if (debug > 0) print "Annacarol, Leann, Ruthann" }
 
# Deborah, Leah, Sarah
/^.*[^cio]ag?h$/ {
        sex = "f"
        if (debug > 0) print "Deborah, Leah, Sarah" }
 
# Frances, Megan, Susan
/^[^EK].*[grsz]h?an(ces)?$/ {
        sex = "f"
        if (debug > 0) print "Frances, Megan, Susan" }
 
# Ethel, Helen, Gretchen
/^[^P]*([Hh]e|[Ee][lt])[^s]*[ey].*[^t]$/ {
        sex = "f"
        if (debug > 0) print "Ethel, Helen, Gretchen" }
 
# George, Joshua, Theodore
/^[^EL].*o(rg?|sh?)?(e|ua)$/ {
        sex = "m"
        if (debug > 0) print "George, Joshua, Theodore" }
 
# Delores, Doris, Precious
/^[DP][eo]?[lr].*s$/ {
        sex = "f"
        if (debug > 0) print "Delores, Doris, Precious" }
 
# Anthony, Henry, Rodney
/^[^JPSWZ].*[denor]n.*y$/ {
        sex = "m"
        if (debug > 0) print "Anthony, Henry, Rodney" }
 
# Karin, Kim, Kristin
/^K[^v]*i.*[mns]$/ {
        sex = "f"
        if (debug > 0) print "Karin, Kim, Kristin" }
 
# Bradley, Brady, Bruce
/^Br[aou][cd].*[ey]$/ {
        sex = "m"
        if (debug > 0) print "Bradley, Brady, Bruce" }
 
# Agnes, Alexis, Glynis
/^[ACGK].*[deinx][^aor]s$/ {
        sex = "f"
        if (debug > 0) print "Agnes, Alexis, Glynis" }
 
# Ignace, Lee, Wallace
/^[ILW][aeg][^ir]*e$/ {
        sex = "m"
        if (debug > 0) print "Ignace, Lee, Wallace" }
 
# Juliet, Mildred, Millicent
/^[^AGW][iu][gl].*[drt]$/ {
        sex = "f"
        if (debug > 0) print "Juliet, Mildred, Millicent" }
 
# Ari, Bela, Ira
/^[ABEIUY][euz]?[blr][aeiy]$/ {
        sex = "m"
        if (debug > 0) print "Ari, Bela, Ira" }
 
# Iris, Lois, Phyllis
/^[EGILP][^eu]*i[ds]$/ {
        sex = "f"
        if (debug > 0) print "Iris, Lois, Phyllis" }
 
# Randy, Timothy, Tony
/^[ART][^r]*[dhn]e?y$/ {
        sex = "m"
        if (debug > 0) print "Randy, Timothy, Tony" }
 
# Beatriz, Bridget, Harriet
/^[BHL].*i.*[rtxz]$/ {
        sex = "f"
        if (debug > 0) print "Beatriz, Bridget, Harriet" }
 
# Antoine, Jerome, Tyrone
/^.*oi?[mn]e$/ {
        sex = "m"
        if (debug > 0) print "Antoine, Jerome, Tyrone" }
 
# Danny, Demetri, Dondi
/^D.*[mnw].*[iy]$/ {
        sex = "m"
        if (debug > 0) print "Danny, Demetri, Dondi" }
 
# Pete, Serge, Shane
/^[^BG](e[rst]|ha)[^il]*e$/ {
        sex = "m"
        if (debug > 0) print "Pete, Serge, Shane" }
 
# Angel, Gail, Isabel
/^[ADFGIM][^r]*([bg]e[lr]|il|wn)$/ {
        sex = "f"
        if (debug = 0) print "Angel, Gail, Isabel" }
 
# print the guess
{ print $0, sex }


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

Date: Fri, 16 Jan 1998 04:36:23 GMT
From: weisberg@hpcc01.corp.hp.com (Len Weisberg)
Subject: new FAQ for Perl for Win32?
Message-Id: <243650011@hpcc01.corp.hp.com>

new FAQ for Perl for Win32?

At  http://www.perl.com/CPAN-local/doc/FAQs/nt/Perl_for_Win32_FAQ.html
we have:
    Perl for Win32 Frequently Asked Questions (FAQ)
    version 1.41 (20 Jan 1997)

Is a newer version available?

- Len Weisberg - IMCS -  Corporate Interactive Marketing & Commerce Services


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

Date: 18 Jan 1998 01:44:24 GMT
From: brinton@unixg.ubc.ca (Ralph Brands)
Subject: novice question: ranking array elements
Message-Id: <brinton-1701981841340001@p069.intchg1.net.ubc.ca>

   As a programming novice I've been stumped in trying to do this with perl.
I'm formatting output from a statistical program and read each line of a
file (each consisting of a series of numbers) into an array. I want to
produce another array which ranks the members of the first array:

@somelist = (24.2, 16, 58, 1, 245);

would produce

@rank_of_somelist = (3, 2, 4, 1, 5); ranking from lowest to highest

I've gotten a start with the advanced sorting discussion in Schwartz 1st
edition page 168 - 70. Any further help would be much appreciated.

Ralph Brands
Health Care and Epidemiology
University of British Columbia


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

Date: Sat, 17 Jan 1998 18:15:09 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jennifer and Matthew Walker <drswalker@home.com>
Subject: Re: perl4 vs. perl5 verification
Message-Id: <Pine.GSO.3.96.980117181230.1296M-100000@user2.teleport.com>

On Fri, 16 Jan 1998, Jennifer and Matthew Walker wrote:

> Does anyone know of a means to check perl4 scripts for code
> that will break under perl5?
> 
>         I suppose you could just run perl5 -cw on the perl4
> scripts, but I'd like something a bit more comprehensive.

The only real way that's any more comprehensive is to read every line of
code, thinking about what's in the perltrap manpage. Sorry, but there's no
significantly better way. 

Nevertheless, nearly every Perl4 program, if it generates no significant
warnings when tested with -cw and then run with -w, will be fine. Hope
this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 18:02:24 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brad Argue <brad_argue@dentistry.unc.edu>
Subject: Re: Problems running Perl 5 on NT 4.0/Netscape Enterprise 3.0
Message-Id: <Pine.GSO.3.96.980117180051.1296K-100000@user2.teleport.com>

On Fri, 16 Jan 1998, Brad Argue wrote:

> [16/Jan/1998:15:00:57] failure: for host 152.2.159.238 trying to GET
> /cgi-bin/test.pl, send-cgi reports: could not send new process (Error
> Number is unknown)
> [16/Jan/1998:15:00:57] failure: cgi_send:cgi_start_exec
> d:\enterprise\cgi-bin\test.pl failed

Those don't look like Perl's error messages. I'd guess that they are
either system or server errors. If you can't find them in the docs for
your system or server, you may need to ask in a newsgroup about your
server. Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sun, 18 Jan 1998 00:51:06 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Q: Regional Sort by ZIP code?
Message-Id: <Pine.HPP.3.95a.980118004554.28377B-100000@hpplus02.cern.ch>

On 16 Jan 1998, Fred Giorgi wrote:

> I need to sort database records by region (group of states) or state. 

State?  Do we have one of those?

> But
> the only guarenteed field I can use is ZIP code.

Perhaps that's why your countrymen have a a habit of sending UK
postcodes to Canada.  Difficult to understand that there might be
sentient beings beyond the NANA, isn't it? 




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

Date: Sun, 18 Jan 1998 00:48:09 +0000
From: Gary Nielson <gnielson@charlotte.infi.net>
Subject: Question about @INC and require
Message-Id: <34C15149.1EC7FDFF@charlotte.infi.net>

I am a rank amateur when it comes to perl and am trying to understand a
couple of things about @INC and require.

Is  it a true statement that the @INC path is compiled into perl when
you build it? If so,
how can I find out what that @INC path is on a remote virtual host? Does
this mean
that when you write a require in a script, say:

require 'cgi-lib.pl';

that it will look for that *.pl in the @INC path? What if you just want
to include your
cgi-lib.pl or whatever in the very same path as the script you are
running? How can
you add or modify an already coded-up @INC path in your script to
accommodate
a file that may be outside that path?

Any help much appreciated. Please email me as well if possible.

Gary
Charlotte, NC



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

Date: Sat, 17 Jan 1998 18:29:59 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Dyas <tdyas@eden.rutgers.edu>
Subject: Re: reexporting symbols in modules
Message-Id: <Pine.GSO.3.96.980117182855.1296O-100000@user2.teleport.com>

On 17 Jan 1998, Tom Dyas wrote:

> Suppose that I have an XS module called Foo that exports some
> constants using an AUTOLOAD routine that calls a constant() function
> that was generated by h2xs.
> 
> I would like make these constants that Foo exports appear as if
> another module Bar was exporting them. 

I think you simply want Bar to export them. When and if Bar's AUTOLOAD is
called, it should call Foo's. Does that sound right? 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 18:04:19 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Charles Beaudry <cbeaudry@diopitt.org>
Subject: Re: Search engines and hiding directories
Message-Id: <Pine.GSO.3.96.980117180334.1296L-100000@user2.teleport.com>

On Fri, 16 Jan 1998, Charles Beaudry wrote:

> @files = ('*htm','*html','*/*htm'); 
> 
> If I wanted to hide a directory called "/frames", what would I need to
> do? 

Use readdir instead of globbing, wherever those globs are expanded, and
simply skip whatever you wish to skip. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 17:57:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: john -r s <johnrs@dc.net>
Subject: Re: Sockets and Perl and Deadlock
Message-Id: <Pine.GSO.3.96.980117175541.1296I-100000@user2.teleport.com>

On Fri, 16 Jan 1998, john -r s wrote:

> Can anyone help me understand how to prevent deadlock in a simple
> client-server app using perl? 

It's the same way if your app isn't written in Perl: flush your output if
the other process may be waiting for it, and use (the four-arg form of) 
select to see whether waiting for input will block. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 17:50:08 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Stanley <stanley@skyking.OCE.ORST.EDU>
Subject: Re: source into binary code
Message-Id: <Pine.GSO.3.96.980117174340.1296G-100000@user2.teleport.com>

On 16 Jan 1998, John Stanley wrote:

> If writing perl code were the way I wanted to make a living, I guess I
> couldn't do very well at it by giving it away, now could I? 

You can make a good living by giving away the source while retaining or
selling the rights to use it. This is true not only for software but for
most other kinds of authoring as well. For example, Randal's magazine
columns are "given away" on the web for free, but the publisher retains
the copyrights on the articles. 

   http://www.stonehenge.com/merlyn/WebTechniques/

Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 17 Jan 1998 19:07:22 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Sukumar Patel <Sukumar.Patel@mail.tju.edu>
Subject: Re: Syntax errors with nested braces???
Message-Id: <34C147B9.6F72B97C@coos.dartmouth.edu>

[posted and mailed]

Sukumar Patel wrote:
> 
> Apologies for the typing error. I meant to say "s".   new results below:

Fair enough, I should have tested it with the double quotes myself.

>        perl -e '$a = ${P{${S{$k}{"s"}}}{"s"}};'
>        syntax error at -e line 1, near "}}"
>        Execution of -e aborted due to compilation errors.

A little experimenting with spaces reveals that the "}}"
mentioned in the error is the pair occuring at the end
of the expression.  For what that's worth.

A little more experimenting reveals that:

perl -e '$a = ${P{ ${S{k} } }{"s"} };'
produces the same syntax error.

perl -e '$a = ${P{ ${S} }{"s"} };'
does not produce a syntax error.

perl5 -e '${P{${S{k}}}}'
produces the same syntax error

I think I see the problem; it's the S.
In the last expression, S is inside ${}, which is equivalent
to $S.

In the first two expressions, S{$k} and S{$k{"s"}} are inside ${},
which are equivalent to...?  Well, that's why you're getting a syntax
error.  (${S{a}} compiles, but ${P{${S{a}}}} doesn't.)

I'm not sure what you're trying to do.  What are P and S?  Are they
hashes, or subroutines, or what?

Perhaps this is what you meant?

perl -e '$a = ${P{${$S{$k}{"s"}}}{"s"}};'
with a $ added before the S.

Hope that helps!

Chipmunk


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

Date: Sat, 17 Jan 1998 20:57:37 -0500
From: "Webmaster" <webmaster@fccj.cc.fl.us>
Subject: Re: system call from within a cgi script
Message-Id: <34c1627b.0@usenet.fccj.cc.fl.us>

No, you can make a system call from just about anywhere inside Perl, CGI or
not.

See my WebPass.cgi on how I do it.  It's at
http://webmaster.fccj.org/Webmaster/WebPass.html

HTH,
Bill


sherman amsel wrote in message <884963970.1086259211@dejanews.com>...
>hello,
>
>i've got a question about making a system call from with a perl cgi
>script.  i'm gathering a bunch of fields of data via an html form, and
>sending it to a cgi script for parsing.  this part works just fine.
>then, i'd like to make system calls to various utilities or other scripts
>using this data.  making the system call seems to cause "internal server
>errors", or else nothing at all happens.
>
>is there a trick i've missed?  or is it that you're not "supposed to"
>make a system call from within a cgi script?  (the same perl code does
>make the system call when not used as a cgi script.)  i'm new to both
>perl and cgi scripting, and hope i'm not sounding too foolish here ...
>
>please email sherman@cdg.stsv.seagate.com.  thanks in advance for your
>help!
>
>-sherman
>
>-------------------==== Posted via Deja News ====-----------------------
>      http://www.dejanews.com/     Search, Read, Post to Usenet




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

Date: Sat, 17 Jan 1998 21:28:16 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: system call from within a cgi script
Message-Id: <comdog-ya02408000R1701982128160001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34c1627b.0@usenet.fccj.cc.fl.us>, "Webmaster" <bill@astro.fccj.cc.fl.us> posted:

>No, you can make a system call from just about anywhere inside Perl, CGI or
>not.
>
>See my WebPass.cgi on how I do it.  It's at

please do not do it the same way that "Webmaster" (*snicker*) did.

check the relevant security resources in the CGI Meta FAQ along
with the perlsec manpage.  whenever you pass data to a shell, you
should think "this needs taint checking".  when you use the
system() function, use it in list context if possible, and so
on and so on.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 17 Jan 1998 18:33:43 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Walter Archie <warchie@att.net.hk>
Subject: Re: What is wrong with this script?
Message-Id: <Pine.GSO.3.96.980117183234.1296Q-100000@user2.teleport.com>

On Sat, 17 Jan 1998, Walter Archie wrote:

> Can someone tell me what is wrong with this script? 

You forgot to use a command like 'perl -wc myscript' to check it for
errors before you posted it. Of course, there may be other problems than
the ones that that test will reveal, but why should I try harder than
that, since you didn't? :-) 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

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

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