[10622] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4214 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 13 15:07:18 1998

Date: Fri, 13 Nov 98 12:00:30 -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           Fri, 13 Nov 1998     Volume: 8 Number: 4214

Today's topics:
    Re: 64-bit Perl? <jdporter@min.net>
    Re: a RE for email addresses? <merlyn@stonehenge.com>
    Re: a RE for email addresses? <merlyn@stonehenge.com>
    Re: a RE for email addresses? (Matthew Bafford)
    Re: a RE for email addresses? (John Moreno)
        Bad Postscript version of PERL Tutorial jkelly@shannon.tellabs.com
    Re: Breathtakingly concise Perl code <mgregory@asc.sps.mot.com>
    Re: Can I return a hash from Perl to C? <Arved_37@chebucto.ns.ca>
    Re: Can't use "chomp" droby@copyright.com
        Can't use Win32::Process hgelman@ntia.doc.gov
    Re: Clear screen? (Andrew M. Langmead)
    Re: Clear screen? <rra@stanford.edu>
    Re: Definition of "odd characters" in -T/-B documentati <uri@fastengines.com>
    Re: Definition of "odd characters" in -T/-B documentati <jhi@alpha.hut.fi>
        Double pipe question <mpaulson@tiac.net>
    Re: Double pipe question (brian d foy)
    Re: Help to change a soft <frankie@etsetb.upc.es>
    Re: HELP <r28629@email.sps.mot.com>
    Re: Heterogeneous Data Structures: possible?  If so, ho <aqumsieh@matrox.com>
    Re: Holy Abounding Books, Batman! (Tore Aursand)
    Re: Holy Abounding Books, Batman! <d-edwards@nospam.uchicago.edu>
        in need of simple perl search script for flat comma del <ericw@recom.com>
    Re: in need of simple perl search script for flat comma <perlguy@technologist.com>
        Is this a regex bug? miles33@ix.netcom.com
    Re: Is this a regex bug? <merlyn@stonehenge.com>
        libdb.so and FreeBSD 2.2.7 patrick@cre8tivegroup.com
    Re: magic increment problem <aqumsieh@matrox.com>
    Re: More efficient coding? <uri@fastengines.com>
    Re: More help on $^0... <aqumsieh@matrox.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 13 Nov 1998 14:23:17 -0500
From: John Porter <jdporter@min.net>
Subject: Re: 64-bit Perl?
Message-Id: <364C8725.1A28A466@min.net>

Ilya Zakharevich wrote:
> 
> Well, it improved a tiny bit since then, but only a really *tiny* bit.

What do you mean, "a *tiny* bit" ???

Aren't all bits the same size?

:-)

John Porter


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

Date: Fri, 13 Nov 1998 14:02:37 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: a RE for email addresses?
Message-Id: <8c90hfu1vx.fsf@gadget.cscaper.com>

>>>>> "Martien" == Martien Verbruggen <mgjv@comdyn.com.au> writes:

>> PS: Thanks for the help with my assignment question.. :)

Martien> Assignment as in homework? I wonder why they would give you an
Martien> assigment that has no correct answer, and to which all the
Martien> approximations to correct answers have already been done, and are
Martien> freely available.

Maybe the assignment is a test to see how well you can research, or
perhaps to teach you how to annoy the regular readers of a newsgroup!

print "Just another Perl hacker,"

-- 
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: Fri, 13 Nov 1998 19:01:37 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: a RE for email addresses?
Message-Id: <8c90hfs9h4.fsf@gadget.cscaper.com>

>>>>> "Clay" == Clay Irving <clay@panix.com> writes:

Clay> I tried your examples with the Email::Valid module:

    $ perl -MCPAN -eshell
    cpan shell -- CPAN exploration and modules installation (v1.40)
    ReadLine support enabled

    cpan> install Email::Valid
    Warning: Cannot install Email::Valid, don't know what it is.
    Try the command

	i /Email::Valid/

    to find objects with similar identifiers.
    cpan>

Really?  Where is this mythical potentially-quite-useful module?

print "Just another Perl module user,"

-- 
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: Fri, 13 Nov 1998 14:19:29 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: a RE for email addresses?
Message-Id: <MPG.10b6504b6762d2c98970d@news.scescape.net>

In article <8c90hfs9h4.fsf@gadget.cscaper.com>, Randal Schwartz 
<merlyn@stonehenge.com> pounded in the following:
=> >>>>> "Clay" == Clay Irving <clay@panix.com> writes:
=> 
=> Clay> I tried your examples with the Email::Valid module:
=> 
=> [snip]
=> 
=> Really?  Where is this mythical potentially-quite-useful module?

http://www2.classmates.com/~maurice/

>From the module:

# This module is based on:
# 
# addrcheck - mail address checker
# by tchrist@perl.com
# Copyright 1997 Tom Christiansen
#
# Modularization by Maurice Aubrey <maurice@hevanet.com>

:-)

--Matthew


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

Date: Fri, 13 Nov 1998 14:45:45 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: a RE for email addresses?
Message-Id: <1difruk.1yddc6mluh3y2N@roxboro0-058.dyn.interpath.net>

Randal Schwartz <merlyn@stonehenge.com> wrote:

> >>>>> "Martien" == Martien Verbruggen <mgjv@comdyn.com.au> writes:
> 
> >> PS: Thanks for the help with my assignment question.. :)
> 
> Martien> Assignment as in homework? I wonder why they would give you an
> Martien> assigment that has no correct answer, and to which all the
> Martien> approximations to correct answers have already been done, and are
> Martien> freely available.
> 
> Maybe the assignment is a test to see how well you can research, or
> perhaps to teach you how to annoy the regular readers of a newsgroup!

Well, not to not annoy the newsgroup, but to come up with the correct
answer (it can't be done with a regular expression), yeah.

-- 
John Moreno


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

Date: Fri, 13 Nov 1998 16:04:38 GMT
From: jkelly@shannon.tellabs.com
Subject: Bad Postscript version of PERL Tutorial
Message-Id: <72hlam$adc$1@nnrp1.dejanews.com>

Hello,

The postscript PERL tutorial at

http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.ps

has a postscript error which prevents me from printing it from my
postscript viewer. Does anyone have, or know where I could get, a
"good" copy of this file ?

Thanks,
John Kelly <jkelly@shannon.tellabs.com>

P.S. Apologies if I've posted this twice - I tried to post this message
when I signed up for Dejanews but it didn't post - I think !!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Nov 1998 13:32:31 +1030
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Breathtakingly concise Perl code
Message-Id: <r8af1wi9bs.fsf@asc.sps.mot.com>


mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:

> I've recently gotten into an X Windows game called "Spellcast" (see
> http://www.edoc.com/zarf/spellcast.html).  The game pits two or more
> players against each other as wizards, who cast spells by making hand
> gestures with each hand.  Each spell consists of a set sequence of
> gestures; when any spell's sequence is completed by either hand, the spell
> goes off.

Spellcast is the X implementation of "Waving Hands", originally a
pen-and-paper game.

There is a play-by-email version available:

  http://www.gamerz.net/~fm

ObPerl:  It's implemented in Perl....

:-)

(It is not breathtakingly concise, though - it's 11,000 lines!)

Martin

(Firetop Mountain Janitor)



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

Date: Fri, 13 Nov 1998 12:44:18 -0400
From: Arved Sandstrom <Arved_37@chebucto.ns.ca>
Subject: Re: Can I return a hash from Perl to C?
Message-Id: <Pine.GSO.3.95.iB1.0.981113123339.7862A-100000@halifax.chebucto.ns.ca>

[ Note: the orignal poster got a long answer, complete with code dealing
with hash refs. This is just to answer the basic question in the NG ]

Basically, an array or a hash, when going back and forth, to and from a
subroutine or function, C <=> Perl or Perl <=> Perl, is just a list of
scalars in between. So the below comments are just what you would expect.
If you want to retain all the info use references.

As an aside, when G_SCALAR is used as the flag, and you return a list,
only the last element will be returned. See perlcall.

> Can anyone tell me whether I can return an hv from a Perl subroutine which
> is invoked in a C function?  If it can be done, which call flag should I use
> G_SCALAR or G_ARRAY?  When I used G_SCALAR, the SV* returned is not a HV*.
> When I used G_ARRAY, I get back a list of keys and values but not a hash.
> Any help is appreciated.



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

Date: Fri, 13 Nov 1998 17:05:06 GMT
From: droby@copyright.com
Subject: Re: Can't use "chomp"
Message-Id: <72hos3$dtv$1@nnrp1.dejanews.com>

In article <364a3374.2131905@nntp.ix.netcom.com>,
  aali@ix.netcom.com (Abdul Ali) wrote:
> On Wed, 11 Nov 1998 16:00:17 -0500, xcom2@popserver.panix.com (Oliver
> Moffat) wrote:
>
>
> I had the same problem when I was using a pre version 5 of Perl. When
> I went to Perl5 chomp worked. If you don't have Perl5 look up the
> function chop. I blieve it lops off the last character regardless of
> whether it is a newline or not.
>

Better answer:  If you don't have Perl5, get Perl5.

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 13 Nov 1998 17:59:09 GMT
From: hgelman@ntia.doc.gov
Subject: Can't use Win32::Process
Message-Id: <72hs1d$gv5$1@nnrp1.dejanews.com>



Greetings...

I have ActivePerl 5.005 installed on 2 Windows 95 machines.  On both, if I
write a script that only has:

use Win32::Process;

I get the following error: Can't load
'C:\PERL\site\5.00502\lib/MSWin32-x86-object/auto/Win32/Process/Proce ss.dll'
for module Win32::Process: load_file:A device attached to the system is not
functioning at C:\PERL\5.00502\lib/MSWin32-x86-object/DynaLoader.pm line 168
 .

 at blah.pl line 1
BEGIN failed--compilation aborted at blah.pl line 1.

Does anyone know what that's all about?  Process.dll is in the right spot, and
I haven't used Perl under Windows enough to know what else to look for.

Thanks
Herschel

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 13 Nov 1998 16:54:58 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Clear screen?
Message-Id: <F2DDnM.FG6@world.std.com>

Russ Allbery <rra@stanford.edu> writes:

>To be fair, \e[H (to return the cursor to the home position) and \e[2J (to
>actually clear the screen) are the ANSI-standard escape codes for this and
>therefore are pretty widely supported

But why go for "widely supported" when you can the sequences
documented for the terminal type? (documented plus whatever hacking
and experimentation went into getting the termcap or terminfo entry to
work.)

The case I can almost believe is if you aren't sure whether the TERM
variable is set up correctly. (Which could be the case for a menu
program.) But in that case, why not start with assuming that TERM is
set up and change it if it does not have the minimum fascilities
needed.

>If you're going to be clearing the screen a lot in your application, one
>thing to do is:

>        $clear = `clear`;

>and then just:

>        print $clear;

>wherever you need to clear the screen.

Which leads into another question in my post. (Well, might not have
phrased it as a qustion, but it is something that I have wondered)

What sort of progam could become noticeably more efficient by
optimizing the way it clears the screen?
-- 
Andrew Langmead


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

Date: 13 Nov 1998 09:47:51 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Clear screen?
Message-Id: <ylg1bn7ad4.fsf@windlord.stanford.edu>

Andrew M Langmead <aml@world.std.com> writes:

> Which leads into another question in my post. (Well, might not have
> phrased it as a qustion, but it is something that I have wondered) What
> sort of progam could become noticeably more efficient by optimizing the
> way it clears the screen?

Anything that displays information on a periodic basis (perhaps polling
some service) and does a full screen refresh each time it displays data.

Anything that clears the screen in response to interactive data entry,
since immediate responsiveness to human keystrokes is a pretty major
factor in how "fast" the program will be considered to be.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 13 Nov 1998 13:20:50 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <sar3e7nh2t9.fsf@camel.fastserv.com>

>>>>> "AML" == Andrew M Langmead <aml@world.std.com> writes:

  AML> Lloyd Zusman <ljz@asfast.com> writes:
  >> Does this mean that the "non-funny" control characters are these? ...

  >> \r  \t  \n  <form-feed>

  AML> All Uri gave was a reinterpretation of the man page and camel text,
  AML> explaining what "funny control characters" meant to him. As you
  AML> suspected in your first post, the only real documentation is the
  AML> source code.

i was implying the other white spacy chars but unless i looked at the
source, i wouldn't want to state which ones.

  AML>         else if (*s & 128)
  AML>             odd++;
  AML>         else if (*s < 32 &&
  AML>           *s != '\n' && *s != '\r' && *s != '\b' &&
  AML>           *s != '\t' && *s != '\f' && *s != 27)
  AML>             odd++;

another important point which is partially illustrated in the code above
is that funny chars are counted. then some percentage of the block is
used to determine the -T/-B values. so one funny char might not cause a
file to be declared binary unless that is a certain percentage of the
file (like a 1 char file with ^@ :-).

so it is a heuristic test which means YMMV depending on the file being
tested.

there are files which are mostly text but with null byte separators. if
the lines are short then the file might be declared binary while long
lines in the file may cause it to be declared text. same format but data
dependent if it is binary/text according to -T/-B.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 13 Nov 1998 21:50:42 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <oeeg1bn5q3x.fsf@alpha.hut.fi>


Lloyd Zusman <ljz@asfast.com> writes:
> Does this mean that the "non-funny" control characters are these? ...
> Or perhaps this is the criterion? ...
> Or what?
> And how large is "the first block or so" (quoted from the man page) of ...
> Once again ... does anyone know where this might be documented?

I do not follow.  Why not look at the source code if the -T/-B "logic"
is so important?  I have always found the logic rather useless because
it's definition of 'text' is so ASCII-centric (now in the latest
versions it grok EBCDIC but that doesn't get me excited :-) The 'text'
vs 'binary' dichotomy is about as useful and clear as a test for
whether the file is 'small' or 'big'...  but hey, TIMTOWTDI, I'm sure
somebody has found a good use for -T and -B.  Enough blathering, I
quote from Perl 5.005_53 pp_sys.c pp_fttext():

    I32 odd = 0;
    STDCHAR tbuf[512];
[snip]
        len = PerlLIO_read(i, tbuf, 512);
[snip]
        s = tbuf;
[snip]

    /* now scan s to look for textiness */
    /*   XXX ASCII dependent code */

    for (i = 0; i < len; i++, s++) {
        if (!*s) {                      /* null never allowed in text */
            odd += len;
            break;
        }
#ifdef EBCDIC
        else if (!(isPRINT(*s) || isSPACE(*s))) 
            odd++;
#else
        else if (*s & 128)
            odd++;
        else if (*s < 32 &&
          *s != '\n' && *s != '\r' && *s != '\b' &&
          *s != '\t' && *s != '\f' && *s != 27)
            odd++;
#endif
    }

    if ((odd * 3 > len) == (PL_op->op_type == OP_FTTEXT)) /* allow 1/3 odd */
        RETPUSHNO;
    else
        RETPUSHYES;

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Fri, 13 Nov 1998 13:11:12 -0500
From: Matthew Paulson <mpaulson@tiac.net>
Subject: Double pipe question
Message-Id: <364C7640.13CF0409@tiac.net>

Does anybody know if there's a way to create a read and write pipe to a
filter program so that I could write to its stdin and process its
stdout?

For example in sh, I would say:

    echo "test data" | filterprogram | \
      while read Output
      do
         ...process Output
      done

How would I do this in perl using the open command to create two file
descriptors to the filter program?  Using pipe or dup?

The books I have only show the method for creating an input pipe or an
output pipe, but not both.


Thanks

Matt Paulson

mpaulson@tiac.net



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

Date: Fri, 13 Nov 1998 13:42:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Double pipe question
Message-Id: <comdog-ya02408000R1311981342020001@news.panix.com>

In article <364C7640.13CF0409@tiac.net>, mpaulson@tiac.net posted:

> Does anybody know if there's a way to create a read and write pipe to a
> filter program so that I could write to its stdin and process its
> stdout?

see the perlipc man page or the IPC::Open2 module.

good luck :)

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


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

Date: Fri, 13 Nov 1998 20:16:05 +0100
From: Francesc Guasch <frankie@etsetb.upc.es>
To: corai@compuserve.com
Subject: Re: Help to change a soft
Message-Id: <364C8575.3FB593F7@etsetb.upc.es>

Plate Forme Jeunes Diplomes wrote:
> 
>     Hello,
> 
>      I Have wrote this software but I would like to change anything and I don't
> know how can I do :
> 
>     I would like to answer at the end of the soft "do you work with other file? If
> yes, restart the soft, if not, stop the soft"
> 
>     Thanks for your help,
> 
I would put your program inside a for statment and at the
end ask the question to the user.
for (;;) {


	my $input=<STDIN>;
	last if input =~/^n/;
}

you can find more information typing 
perldoc perlop 

-- 
 ^-^.-----.             mailto:frankie@citel.upc.es
 o o       )            http://citel.upc.es/~frankie
  Y (_, (__(OOoo
Advices on optimizing code : 	Don't do it
				Don't do it yet (only for experts)


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

Date: Fri, 13 Nov 1998 10:57:09 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: mwang@shopfast.com
Subject: Re: HELP
Message-Id: <364C64E5.F7F1B2DB@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

Min Wang wrote:
> 
> Hi:
> 
> I have a MAC file to import into database.  But there are a lot of
> garbage character in it.  How to write a expression to keep all of
> meaningful characters like a - z, 0 - 0, and &, , or ),  and get rid of
> these garbage like ^D^@^C and others.


If your question is 'how to do this in Perl', the lookup help (MacPerl)
in 'perlop' info on:

s///g, or, tr///d

Also, remember to write something more than just 'HELP' in you subject
line next time.

-tk


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

Date: 13 Nov 1998 11:59:12 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Heterogeneous Data Structures: possible?  If so, how?
Message-Id: <x3yn25vedgf.fsf@tigre.matrox.com>


Charles Roten <croten@bigger.aa.net> writes:

> 
> I want to do something more than a little odd ... I want to build a 
> structure $DataStructure such that sometimes 
> 
>     $DataStructure->[$index]->{$key}
> 
> refers to a scalar/string, and sometimes to a named hash or array.  

[snip examples]

Have you tried to do that? It is indeed very possible. Did you have
any troubles doing that?
By the way, I don't see anything odd there. I use those kinds of data
structures in nearly every program > 100 lines long that I write.

> 
> Srinivasan's "Advanced Perl Programming" lies open on my desk as I 
> write this.  I have seen no mention of such a complex structure in 
> this work, nor in the "Perl Cookbook".  

Hmmm..  first of all, you should read perldsc (which should be
installed on your machine). It will let you know what is possible and
what is not. It also has a lot of examples. Read it at least twice.

> Is such a thing practical ?  Can some kind soul point me to any 
> examples of this sort of thing, or any other documentation besides 
> Srinivasan ?  Are there any "gotchas" I should be aware of ?  

Perldsc contains everything you need. If, after you read it, you still
have troubles then come and ask again.

> 
> Thanks in advance, Charles.  

Hope this helps.

Ala


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

Date: Fri, 13 Nov 1998 16:30:35 GMT
From: tore@forumnett.no (Tore Aursand)
Subject: Re: Holy Abounding Books, Batman!
Message-Id: <364c5e62.82866535@news.online.no>

On Fri, 13 Nov 1998 09:44:35 -0600, "David Bolton"
<dbolton@IdeaPlace.org> wrote:
> 1) Discover Perl 5 (Barkokati) for a brief intro tutorial.
> 2) Learning Perl (Schwartz) for the follow-up in-depth learning.
> 3) Programming Perl (Wall) for reference

Without having read the first book you mention, I can't think that
book is a better portal to Perl programming.

I started with Learning Perl (2nd Edition), and that was it!  I was
completely hooked on Perl, and any further reading was done using
Programming Perl (2nd Edition) and WWW/newsgroups.


-- 
Tore Aursand
ForumNett Online AS
<URL:http://www.forumnett.no/>


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

Date: Fri, 13 Nov 1998 19:04:17 GMT
From: Darrin Edwards <d-edwards@nospam.uchicago.edu>
Subject: Re: Holy Abounding Books, Batman!
Message-Id: <tgbtmbs9ce.fsf@noise.bsd.uchicago.edu>

"David Bolton" <dbolton@IdeaPlace.org> writes:

> 
> I'd like to learn a little cgi/perl, but after reading Amazon.com book
> reviews for a couple of evenings, I have to say that the number of how-to
> books on the subject is staggering.
> 
> For a beginner (with a modest background in Java programming),  which books
> do the better job teaching cgi/perl to the novice?
> 
> My tentative plan is:
> 
> 1) Discover Perl 5 (Barkokati) for a brief intro tutorial.
> 2) Learning Perl (Schwartz) for the follow-up in-depth learning.
> 3) Programming Perl (Wall) for reference

I've never read 2, but it is (I believe) considered the standard
entry point for folks approaching perl with no prior experience.

I can heartily recommend 3; it contains essentially _all_ of the
information contained in perl's man pages _plus_ more in-depth
explanations and copious examples.  Combined with a fine index,
makes this book great for both learning a given topic (e.g.
regular expressions) in greater detail, as well as a reference to
keep handy.

I would also invite you to consider Christiansen & Torkington's
_Perl Cookbook_.  In many ways it assumes familiartiy with
_Programming Perl_, and is thus much briefer in its _explanations_
of given topics (e.g. "why does the regular expression work this
way?", "what is the general syntax of this function?").  However,
the real purpose of the book is to provide examples of how to
solve specific problems in perl, and in over 700 pages of text
they get in quite a few such examples, let me tell you.  Last 2
chapters (out of 20) are "CGI Programming" and "Web Automation."

Also, since "interacting with CGI" is only a small fraction of
the functionality of perl, you might want to have a CGI-specific
reference handy.  Since I don't really do that I can't recommend
any, but there are plenty out there.  People on the newsgroup
comp.infosystems.www.authoring.cgi might be able to help you with
this (and other non-perl cgi-specific questions).

Best wishes,
Darrin


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

Date: Fri, 13 Nov 1998 11:29:43 -0500
From: "Eric Williams" <ericw@recom.com>
Subject: in need of simple perl search script for flat comma delim. txt file
Message-Id: <loZ22.691$Gf4.6940@newsfeed.slurp.net>


I am trying to create a simple perl script to search a comma delimited text
file and out put the entire line of info. that a particular field matches in
html.

Any help or sample scripts w/ html input source file would be greatly
appreciated!!

eric.
ericw@recom.com

>




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

Date: Fri, 13 Nov 1998 17:39:13 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: in need of simple perl search script for flat comma delim. txt file
Message-Id: <364C6EC1.816B8BFF@technologist.com>

Eric Williams wrote:
> 
> I am trying to create a simple perl script to search a comma delimited text
> file and out put the entire line of info. that a particular field matches in
> html.
> 
> Any help or sample scripts w/ html input source file would be greatly
> appreciated!!
> 
> eric.
> ericw@recom.com

Try http://webreview.com (Click on the "Perl" area)  also try:
http://www.cgi-resources.com

Good luck!
Brent
-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Fri, 13 Nov 1998 19:14:31 GMT
From: miles33@ix.netcom.com
Subject: Is this a regex bug?
Message-Id: <72i0en$l4v$1@nnrp1.dejanews.com>

Hi

The code included below generates:

*tag1
*tag2
**tag3
**tag4

I expected:

*tag1
*tag2
**tag1
**tag2
**tag3
**tag4

Changing the hashref to a scalar gives me the results I expect.

Am I misunderstanding something about the relation between hashrefs and the
/g match option or is this a bug?


-- Start of code --
#!/usr/bin/perl -w
use strict;

my $hashref = {};

$hashref->{TEXT} = '<tag1><tag2><tag3><tag4>';

process_1($hashref);
process_2($hashref);

sub process_1 {
my $text1 = $hashref;

    while ($text1->{TEXT} =~ /<([^>]+)>/g) {
	print "*", $1, "\n";
	last if $1 =~ /2/;
    }
}

sub process_2 {
my $text2 = $hashref;

    while ($text2->{TEXT} =~ /<([^>]+)>/g) {
	print "**", $1, "\n";
    }
}
-- End of code --

korma% perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos demo 5.5.1 generic sun4m sparc sunw,sparcstation-10 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib /opt/SUNWspro/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-Kpic', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Built under solaris
  Compiled at Jun 10 1998 11:46:34
  @INC:
    /usr/local/lib/perl5/sun4-solaris/5.00404
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/sun4-solaris
    /usr/local/lib/perl5/site_perl
    .


TIA for enlightenment

Chris H.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 13 Nov 1998 19:47:41 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Is this a regex bug?
Message-Id: <8cg1bnqsrx.fsf@gadget.cscaper.com>

>>>>> "miles33" == miles33  <miles33@ix.netcom.com> writes:

miles33> Hi
miles33> The code included below generates:

miles33> *tag1
miles33> *tag2
miles33> **tag3
miles33> **tag4

As I expected.

miles33> I expected:

miles33> *tag1
miles33> *tag2
miles33> **tag1
miles33> **tag2
miles33> **tag3
miles33> **tag4

No. :)

miles33> Changing the hashref to a scalar gives me the results I expect.

Hmm.  I doubt this, unless you are making a copy at the same time.

miles33> Am I misunderstanding something about the relation between
miles33> hashrefs and the /g match option or is this a bug?

It's no bug.


miles33> -- Start of code --
miles33> #!/usr/bin/perl -w
miles33> use strict;

miles33> my $hashref = {};

miles33> $hashref->{TEXT} = '<tag1><tag2><tag3><tag4>';

miles33> process_1($hashref);
miles33> process_2($hashref);

miles33> sub process_1 {
miles33> my $text1 = $hashref;

miles33>     while ($text1->{TEXT} =~ /<([^>]+)>/g) {
miles33> 	print "*", $1, "\n";
miles33> 	last if $1 =~ /2/;
miles33>     }
miles33> }

miles33> sub process_2 {
miles33> my $text2 = $hashref;

miles33>     while ($text2->{TEXT} =~ /<([^>]+)>/g) {
miles33> 	print "**", $1, "\n";
miles33>     }
miles33> }
miles33> -- End of code --

There's only one "scalar" involved.  pos($hashref->{TEXT}) will be
shared amongst all the /g iterators.

If you copy the data to a new scalar var, then you'll get a new pos().
If that's what you want, you need to do it yourself.

print "Just another Perl hacker,"

-- 
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: Fri, 13 Nov 1998 16:28:12 GMT
From: patrick@cre8tivegroup.com
Subject: libdb.so and FreeBSD 2.2.7
Message-Id: <72hmms$bjb$1@nnrp1.dejanews.com>

I've got an odd problem...

When I came in to work this morning, and tried to run a perl script, I got an
error.  So I tried just perl5 -v to see what happened:

gateway# perl5 -v
perl5: can't load library 'libdb.so.1'

Same error.  I've checked all my other systems, and none of them have
libdb.so.1 installed. What is it and why does perl *now* need it?

I'm running 5.005_02 on FreeBSD 2.2.7-STABLE (Oct 30).

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Nov 1998 12:36:02 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: magic increment problem
Message-Id: <x3yhfw3ebr1.fsf@tigre.matrox.com>


Stephen Riehm <sr@pc-plus.de> writes:

> 
> Hi JAPH's,
> 
> I was astounded to find the following "magic" in perl's magical
> autoincrementation. Here are a few simple strings to be incremented:
> 
> 	$a = "123";
> 	$b = "file1";
> 	$c = "1file";
> 	$d = "my1stfile";
> 
> now we try:
> 
> 	$a++; $b++; $c++; $d++;
> 
> and we get:
> 
> 	$a:	"124"
> 	$b:	"file2"
> 	$c:	"2"		<--- whoa there >:-|
> 	$d:	"1"		<--- whoa there >:-|
> 
> what's the deal with $c and $d - shouldn't they be "1filf" and
> "my1stfilf" respectively? Essentially if there are any embedded digits,
> with the exception of the end of the string, the whole string is treated
> as a number, and when the first character isn't a digit it's
> treated as '0'.

Actually, this behaviour is vaguely documented in perlop:

     The auto-increment operator has a little extra builtin magic
     to it.  If you increment a variable that is numeric, or that
     has ever been used in a numeric context, you get a normal
     increment.  If, however, the variable has been used in only
     string contexts since it was set, and has a value that is
     not null and matches the pattern /^[a-zA-Z]*[0-9]*$/, the
     increment is done as a string, preserving each character
     within its range, with carry:

Obviously "1file" and "my1stfile" do NOT match the pattern

/^[a-zA-Z]*[0-9]*$/

So, the autoincrement will NOT work as expected. I am curious to know
though what ++ exactly does in the above cases and WHY?

Any insight from someone else?

Ala


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

Date: 13 Nov 1998 13:06:01 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: More efficient coding?
Message-Id: <sar67cjh3hy.fsf@camel.fastserv.com>

>>>>> "DG" == Daniel Grisinger <dgris@moiraine.dimensional.com> writes:

  DG> Uri Guttman <uri@sysarch.com> writes:
  >> >>>>> "SH" == Sam Holden <sholden@pgrad.cs.usyd.edu.au> writes:

  SH> if (length($fi)==2 && $fi=~/d[aeiou]/) {
  >>
  SH> I suggest you read up on regular expressions...
  >>  and you too! :-)

  DG> His works fine, the test for the length of the string avoids false
  DG> positives on d[aeiou]\n.

i wasn't trying to say he was wrong, i was just showing a more compact,
elegant (and probably efficient) way to to the test. note the :-) in my
comment. i should have been clearer that i was improving and not
correcting him.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 13 Nov 1998 12:52:42 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: More help on $^0...
Message-Id: <x3yemr7eaz9.fsf@tigre.matrox.com>


"Rusty Williamson" <rwilliamson@uno.gers.com> writes:

> 
> 
> In addition, I can't seem to test $^0:

Hmmm.. I have the feeling you have a zero instead of a capital O up
there. The OS name is in $^O (dollar-caret-capital o) not $^0
(dollar-caret-zero).

> 
> if ( $^0 eq "MSWin32" ) {
> ...
> }
> 
> or assign it:
> 
> oS=$^0;
> 
> What I'm I doing wrong?
> 
> Thanks,
> Rusty

I don't know .. I can certainly access both of them:

aqumsieh@tigre [aqumsieh] perl -w
print "$^0 and $^O.\n";
__END__
STDOUT_TOP0 and solaris.


Ala


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

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

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