[17346] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4768 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 30 21:05:31 2000

Date: Mon, 30 Oct 2000 18:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972957910-v9-i4768@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 30 Oct 2000     Volume: 9 Number: 4768

Today's topics:
        Array of Associative Arrays? <fromhold@ics.uci.edu>
        CGI Perl vs. Java Servlets... <ryanb@one.net>
    Re: CGI Perl vs. Java Servlets... <joe+usenet@sunstarsys.com>
    Re: CGI Scripting Errors 'Help' <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: CGI Scripting Errors 'Help' fallenang3l@my-deja.com
    Re: CGI Scripting Errors 'Help' <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: CGI.pm + exec = error andre_sanchez@my-deja.com
    Re: code counter v1 released :-) (Tarael200)
    Re: Comparing two files (Martien Verbruggen)
    Re: Comparing two files <uri@sysarch.com>
    Re: Drawing a blank <lr@hpl.hp.com>
    Re: Encrypting cookies? <steve@dvd.net.au>
    Re: global variables and use strict (Tad McClellan)
    Re: hairy regex - embedded parentheses fantomette@my-deja.com
        Help Read File <mhchen@stanford.edu>
        I am learning Perl. Help, please. zhong9999@my-deja.com
    Re: I am learning Perl. Help, please. faatdilac@my-deja.com
    Re: I am learning Perl. Help, please. (Tad McClellan)
    Re: I am learning Perl. Help, please. <lr@hpl.hp.com>
        solaris vs linux perl and hash/dbm files <hft@super.org>
    Re: Unterminated <> operator? what the heck? <uri@sysarch.com>
    Re: Unterminated <> operator? what the heck? <ren.maddox@tivoli.com>
    Re: Unterminated <> operator? what the heck? (Eric Bohlman)
    Re: using ExtUtils::Command ... <jeff@yoak.com>
        What should I do? <idleisidle@usa.net>
    Re: Which is the best PERL learning book? <lr@hpl.hp.com>
    Re: Which is the best PERL learning book? (brian d foy)
    Re: Which is the best PERL learning book? <lr@hpl.hp.com>
        Win32::IpHelp rereidy@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 30 Oct 2000 17:44:15 -0800
From: RFT <fromhold@ics.uci.edu>
Subject: Array of Associative Arrays?
Message-Id: <39FE23EF.E8F32D8@ics.uci.edu>

Is it possible to read individual elements from an array of associative
arrays?

I create my array of arrays as follows:

$DataMatrix[$reccount] = [%TokenArray];

where %TokenArray contains different values in each key for different
records.

I'm trying to access a single element of @DataMatrix via

$DataMatrix[$reccount]{"$token"}

where $token contains the key for %TokenArray. Unfortunately, this is
not working. Does anyone have any idea on how to access the value for an
individual key directly from @DataMatrix?




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

Date: Mon, 30 Oct 2000 20:49:43 -0500
From: "Ryan Bedford" <ryanb@one.net>
Subject: CGI Perl vs. Java Servlets...
Message-Id: <39fe25f5$1_2@news2.one.net>

All things being equal which is faster?  CGI Perl or Java Servlets?

Ryan Bedford




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

Date: 30 Oct 2000 20:54:24 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: CGI Perl vs. Java Servlets...
Message-Id: <m3g0ld7p2n.fsf@mumonkan.sunstarsys.com>

"Ryan Bedford" <ryanb@one.net> writes:

> All things being equal which is faster?  CGI Perl or Java Servlets?

That depends on which of the two languages you already know :)

-- 
Joe Schaefer


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

Date: Mon, 30 Oct 2000 15:45:46 -0800
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: CGI Scripting Errors 'Help'
Message-Id: <39FE082A.E66B94AB@jpl.nasa.gov>

spicenews@my-deja.com wrote:
> Hi! I am only 14 and need some help trying to fix this thing. Please go
> to: http://thecgipath.hypermart.net/products/s_hsf.html - Read what the
> script is about, then download it. I use a server at
> http://www.chilliseeds.com and it doesn't work for me. See if it works
> for you. Please tell me what you did to get it to work! All I have done
> is uploaded it, I have made NO changes. If that's the problem (I am
> sure it is) What are the changes I have to make? It might help if you
> upload the script to your own server to correct things and test it. Any
> answers/replies would be GREATLY appreciated! Thankyou

I looked at the script and I'm not impressed.  If you are interested in
learning perl, you might want to rewrite that script so that it runs
clean under -wT and use strict.  Then I would modify it to use CGI.

If you are intent on using that script (and I would advise against it),
you need to make some changes (documented in hsf.pl).  You can test it
if you install a web server that supports SSI.  

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Tue, 31 Oct 2000 00:40:47 GMT
From: fallenang3l@my-deja.com
Subject: Re: CGI Scripting Errors 'Help'
Message-Id: <8tl4ef$ib6$1@nnrp1.deja.com>

What does -wT switch do?

In article <39FE082A.E66B94AB@jpl.nasa.gov>,
  Jonathan.L.Ericson@jpl.nasa.gov wrote:
> spicenews@my-deja.com wrote:
> > Hi! I am only 14 and need some help trying to fix this thing.
Please go
> > to: http://thecgipath.hypermart.net/products/s_hsf.html - Read what
the
> > script is about, then download it. I use a server at
> > http://www.chilliseeds.com and it doesn't work for me. See if it
works
> > for you. Please tell me what you did to get it to work! All I have
done
> > is uploaded it, I have made NO changes. If that's the problem (I am
> > sure it is) What are the changes I have to make? It might help if
you
> > upload the script to your own server to correct things and test it.
Any
> > answers/replies would be GREATLY appreciated! Thankyou
>
> I looked at the script and I'm not impressed.  If you are interested
in
> learning perl, you might want to rewrite that script so that it runs
> clean under -wT and use strict.  Then I would modify it to use CGI.
>
> If you are intent on using that script (and I would advise against
it),
> you need to make some changes (documented in hsf.pl).  You can test it
> if you install a web server that supports SSI.
>
> Jon
> --
> Knowledge is that which remains when what is
> learned is forgotten. - Mr. King
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 17:48:10 -0800
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: CGI Scripting Errors 'Help'
Message-Id: <39FE24DA.49FC10EC@jpl.nasa.gov>

fallenang3l@my-deja.com wrote:
> 
> What does -wT switch do?

<snip quote of my entire post>

In no particular order:
a) Please don't quote an entire post.  Pick out the interesting bits and
throw away the boring bits.  (See how I quoted you?)

2) Please read perlrun (using either man or perldoc).

iii) Search the archive of this news group (at www.deja.com) before
posting.  I don't want to seem mean, but these switches are discussed
pretty often here.

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Tue, 31 Oct 2000 01:22:49 GMT
From: andre_sanchez@my-deja.com
Subject: Re: CGI.pm + exec = error
Message-Id: <8tl6t2$ka3$1@nnrp1.deja.com>


> If my ideas are greatly appreciated why have you not tried
> implementing them?

Quite the contrary; I am more than grateful for your help and have
carefully studied your advice. But, I am also stubborn and ignorant of
many things relating to Perl.

> Look at he description of the new() method in the manuals for
> CGI.pm.  This will explain how you can create a CGI object in ways
> other than using the CGI interface.

I found this instructive since changing this:

         my $query = new CGI;

to this:

         my $query = new CGI('');

got me what I wanted. Thank you.

Andre Sanchez



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 31 Oct 2000 01:16:58 GMT
From: tarael200@aol.com (Tarael200)
Subject: Re: code counter v1 released :-)
Message-Id: <20001030201658.02295.00000639@ng-fk1.aol.com>

>
>Parsing perl is not trivial. So I don't even think that patching your
>code in a simple manner in order to get all this right, can even be
>done.
>

Never claimed it was :-) ... 

-Ryan



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

Date: Mon, 30 Oct 2000 23:54:19 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Comparing two files
Message-Id: <slrn8vs2ha.ksa.mgjv@verbruggen.comdyn.com.au>

On 30 Oct 2000 08:39:53 -0700,
	Tom Christiansen <tchrist@perl.com> wrote:
> In article <slrn8vqfca.ac5.mgjv@martien.heliotrope.home>,
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> >Oh, come on, Tom. perldoc is perfectly useable for most beginning users
> >and many cursory uses of the documentation. 

> And in fact, although it induced many painful weeks of projectile
> vomiting, I did stick my retching face into the code long enough
> to remedy most of the glaring security holes that rendered any

I know you did that. And it's made perldoc better. It's far from
perfect, but it's useable. Maybe I shouldn't have used the term
'perfectly useable', since that's overstating the issue. I did try to
soften that statement a bit, but obviously didn't succeed as well as I
should have.

> But those sins, great though they appear, are still the lesser
> manifestation of that program's evil.  More important is the fact
> that it is fundamentally misdesigned, an issue which cannot be
> ameliorated through any number of cosmetic band-aids.  Instead, a
> completely new program, one first designed and only then written,
> must be created to replace it.

And I understand that you are working hard on replacing it. Which is a
very Good Thing(TM).

> And yes, before you splutter about squeaky wheels and complaints
> without cures, I *have* put my money where my mouth is, so to speak.
> I did the work.  That's part of the demo I included in the supercited
> posting.

I wasn't going to splutter :). I know perfectly well that you've had
an aversion to perldoc for a long time, and that you have made
attempts to make it work in a more sane way.

> >At least it gives everyone
> >who has Perl installed a common way to get to the manual. 
> 
> This reassuring platitude, doubtless intended to assuage the shame
> many should feel in advocating this collective embarrassment, is 
> nevertheless *FALSE*.  Ask a MacOS person, for example.  
> 
> Repeat after me:
> 
>     MICROSOFT IS NOT THE WHOLE FRICKING WORLD.

You are right, of course, and as so often is done by so many people,
me included, I overlooked the Mac, and possibly other systems. perldoc
is not available everywhere. However, it is still the most
cross-platform documentation viewing tool available. Until that is
fixed, I don't see that there will be much hope in getting rid of
people refering to it on this newsgroup. Until we do have a better
tool, or tools, to look at the pods, which are available for everyone,
perldoc is just the easiest thing to refer to.

Mind you, I wasn't saying, and am not saying now, that perldoc is
fine. Or that perldoc is the answer to the question on how to view
pod. It is merely a reasonably acceptable tool.

> >However, I do not feel like having to explain to each person who isn't
> >used to having man, grep, sed and awk around what 
> >
> ># man perl
> >
> >means. I also don't feel like saying it and leaving it unexplained. 
> 
> It's part of our culture and lingo.  You merely them to consult the
> perlsec manpage, or perlsec(1), or the chroot manpage, or chroot(2).
> And you give them things like this.  The Camel glossary reads:

I think that this is more the point of your current posts, correct?  I
seem to read that you object to the word perldoc being used as a
synonym for 'have a look at this documentation'. 

If that's the case, I agree. I'd rather see people, including me,
say things like 'see the entry on open() in the perlfunc
documentation'. However, it's much easier to type

# perldoc -f open

It's laziness, probably, that drives this more than anything else.

> >Everyone who has Perl
> >has perldoc. That is its strength. 
> 
> Even were that true -- AND IT IS NOT TRUE -- it does not overcome
> the terrible bugs and intractable design flaws.  

Yes. But the bugs in perldoc do not stop the concept of being a valid,
and plausible one. Perl can ship with tools to access the
documentation, and I believe it should. Some of these tools will not
work on all platforms (Macintosh being an example, with its lack of a
command line), and there is just very little one can do about this.
But hopefully they can be made to work on _most_ platforms.

Your efforts in writing new tools (perltoc, perlfaq, perlman) show
that you don't necessarily disagree with this idea, but that you
object to perldoc, its design, and its implementation. That's fine,
and I have no problem with that. I do want to avoid making the unix
way of looking at things the norm, however (and I work almost
exclusively on various falvours of unix). It just doesn't fit with the
way Perl is used, and the places it runs anymore. I'm happy to advise
people to get some tools installed that are standard with every unix,
and that have proven their worth over the last decades. But, I would
hate to see everyone answering questions by saying things like:

# man perlfunc
# grep 'keyword expression' /opt/perl/lib/5.6.0/pod/*.pod
# grep keyword /opt/perl/lib/5.6.0/pod/perlfaq*.pod

That is just too specific. Windows is not the whole world (and that
really makes me happy), but neither is Unix.

> Martien, you are clearly a competent programmer.  I challenge you
> to look at the source code to the old perldoc program with an eye
> toward, oh, let's say maintainability.  Think of software design
> principles.  Note: I do not suggest doing so on an empty stomach.

I did, at some point. I believe this was when 5.005 had just been
released, and perldoc broke. Parts of the functionality had just gone.
I looked at it, and decided it wasn't worth it for me, since I just
use man anyway. You are right, it is a monster. but that's not what I
was trying to dispute.

> Then we can talk for a good twenty pages or more about the brain-dead,
> non-extensible, special-purpose, counterintuitive botch of its
> user-interface.  Except let's not bother.  Just use the new stuff
> instead and relegate the old fossil to the Lower Coprolithic Period
> where it belongs.  And even if you don't have the old stuff, use
> the abbreviated descriptions so as not to promote unhealthy habits
> amongst the untooled neophytes.

I'd love to. but the new stuff isn't yet part of the standard
distribution. What I can do, is agree with you that maybe the time has
come to start referring to the documentation in more generic terms,
that don't mention the perldoc tool anymore. maybe I'll just write a
little piece of text that I can include at the bottom of such messages
that explains what the current ways of reading documentation are.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | This matter is best disposed of from
Commercial Dynamics Pty. Ltd.   | a great height, over water.
NSW, Australia                  | 


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

Date: Mon, 30 Oct 2000 23:49:54 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Comparing two files
Message-Id: <x7u29tj3dp.fsf@home.sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:

  TC> I mistrust lines of "reasoning" that dispute there being a correct
  TC> solution due to "style"--they tend to want to hide from technical
  TC> issues.  There *are* right and wrong, good and bad, when it comes
  TC> to programming.

again, even right and wrong can be subjective in software. note i said
'can'. i look at it like a distribution curse. we all agree on many BAD
ways to do stuff and mostly agree and the good ways. there is still a
vast middle belt where you can start to see both sides to a
technique. you can argue logically either way and then if you still
don't have a winner, it become subjective or to your taste. i like to
use named variables over $_. it is not wrong and no one could say that
but others prefer to use $_ whenever and whereever possible. i disagree
with that coding style but it is not wrong. i can decipher just fine
without any major headaches.


  >> can be much faster than the perl code version. weigh that against the
  >> fork overhead (negligible in most cases. only heavy uses of this would
  >> matter) 

  TC> fork overhead is virtually always completely inconsequential.
  TC> It's the exec that gets you.

true, especially with vfork or its kernel equivilent. consider my use of
fork as a generic fork/exec operation as almost all forks are followed
by exec.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Mon, 30 Oct 2000 16:59:06 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Drawing a blank
Message-Id: <MPG.1467b9386fa872f298ae81@nntp.hpl.hp.com>

In article <u9snpenr1o.fsf@wcl-l.bham.ac.uk> on 30 Oct 2000 18:05:07 
+0000, nobull@mail.com <nobull@mail.com> says...

 ...

> perl -p processes a file a line at a time.  There's no such thing as a
> line containing multple newlines.  One alternative is to process the
> file as a single string:
> 
> perl -pi -e 'BEGIN { undef $/ }; s/~p~\n+/\n/sg' <file>

  perl -0777pi -e 's/~p~\n+/\n/g' <file>
 

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


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

Date: Tue, 31 Oct 2000 11:08:49 +1100
From: Steve <steve@dvd.net.au>
Subject: Re: Encrypting cookies?
Message-Id: <39FE0D91.13D83335@dvd.net.au>

Malte Ubl wrote:
> 
> Steve schrieb:
> >
> > Hey folks,
> >         on some web pages I see them sending back cookies as follows:
> >
> > ASPSESSIONIDQQQQQQPD=ABGKBJFYJCLBAGMJHGACGAGH
> >
> > What do you need to use to achive such encryption. I know it is simple
> > but that's all I need rather than making it too obvious.
> 
> That one doesnt look like its encrypted. Look at the key it includes:
> asp sessionid. So the value is a session id which should be unique.

Yes, I know that but I'm looking at the part that comes after the '='.
Would that be encrypted or just a bunch of random characters as a unique
Identifier or the identifier encrypted in some simple way?

Cheers,
Steve.
-- 
  Editor, DVD Net
  http://www.dvd.net.au


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

Date: Mon, 30 Oct 2000 18:28:04 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: global variables and use strict
Message-Id: <slrn8vs104.5j9.tadmc@magna.metronet.com>

On 30 Oct 2000 15:31:44 -0700, Tom Christiansen <tchrist@perl.com> wrote:
>In article <slrn8vrnqi.55h.tadmc@magna.metronet.com>,
>Tad McClellan <tadmc@metronet.com> wrote:
>>So, when you want to break up your program into separate files
>>(yet still all in package "main") 

>>Or, are you just supposed to repeat the our() declaration in
>>each component program file?  (ie. in each lexical scope
>>where you want to use them unqualified).
>
>Sure, why not?


Oh.

Well never mind then :-)

I will gladly do more typing to get easier maintenance.


>>I think I have a beef somewhere with the 5.6 docs:
>>
>>perldoc vars
>
>If you're going to use that kind of language around me,
>it cannot help but color my response. :-(


Sorry.

I'm not very good at couching my thoughts in politically correct terms.


>>But there _is_ something that I can get with "use vars" that
>>I cannot get with our():


I now see that that is not true.

I just need to type a little more. No problem.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 30 Oct 2000 23:52:48 GMT
From: fantomette@my-deja.com
Subject: Re: hairy regex - embedded parentheses
Message-Id: <8tl1kd$fvn$1@nnrp1.deja.com>

In article <39FDD4AE.40640441@cc.gatech.edu>,
  Stephen Kloder <stephenk@cc.gatech.edu> wrote:
> fantomette@my-deja.com wrote:
>
> > hello,
> >
> > could someone help me decipher the following regex:
> >
> > s/(<[^>]*?\bhref\s*=)(?:\s*(["'])([^\2]*?)\2|\s*([^\s]*?(?=[\s>])))
> >  /($2?($1 . $2 . &some_function($3) . $2):($1 . &some_function($4)))
> >  /ie;
> >
> > precisely, i'm not sure what's in $2, $3 and $4 because i get
confused
> > with the embedded parentheses.
> >
> > thanks for your help,
> > isabelle
> >
>
> This looks like a regex to modify URL's in <a href> tags.  The <a
href=
> portion is captured into $1, and then the regex looks for quotes.  If
it
> finds " or ' , it stores the quote character into $2, and all the
> characters inside the quotes are stored into $3.  If there are no
quotes,
> the next set of nonspace characters inside the tag are stored into $4.
> The output of some_func then replaces the URL.
>
> HTH
> perldoc perlre
>
> --
> Stephen Kloder               |   "I say what it occurs to me to say.
> stephenk@cc.gatech.edu       |      More I cannot say."
> Phone 404-874-6584           |   -- The Man in the Shack
> ICQ #65153895                |            be :- think.
>
>

stephen,

thank you so much for your very clear and quick response.
you've been most helpful.

-i


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 16:22:08 -0400
From: "Howard Chen" <mhchen@stanford.edu>
Subject: Help Read File
Message-Id: <8tl3bg$fph$1@nntp.Stanford.EDU>

Okay, sorry i forgot to post my source code.

  if ( !open ( FP_IN_HTML, '<'.$FILENAME)  {
    $html_param{send_type} = 0;
    $html_param{message} = '<h1>ERROR</h1>';
    &SendFile();
    exit(-1);
  }

and the thing is I had it working in Apache using Active Perl, but it gives
me error when I port the same code onto IIS, where the same version of
Active Perl is used.

Can somebody help me with that?




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

Date: Mon, 30 Oct 2000 22:58:36 GMT
From: zhong9999@my-deja.com
Subject: I am learning Perl. Help, please.
Message-Id: <8tkueo$d32$1@nnrp1.deja.com>

Thank you in advance for your help.

I have two questions:
1). If I want to hide my perl scripts, for example, make my scripts
look like compiled c++ programs, so nobody can look at my scripts.
Can I do this and how? Are there any free software?
2). My text file has 5 fields(delimited by comma ,) in each line.
How can I exact the 2nd and 4th fields from the whole file(I do want
to have a loop to do this)? I was told the awk can do this.
How about Perl?

Thanks again.

Yang


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 31 Oct 2000 00:06:43 GMT
From: faatdilac@my-deja.com
Subject: Re: I am learning Perl. Help, please.
Message-Id: <8tl2ef$ght$1@nnrp1.deja.com>

In article <8tkueo$d32$1@nnrp1.deja.com>,
  zhong9999@my-deja.com wrote:
> Thank you in advance for your help.
>
> I have two questions:
> 1). If I want to hide my perl scripts, for example, make my scripts
> look like compiled c++ programs, so nobody can look at my scripts.
> Can I do this and how? Are there any free software?
> 2). My text file has 5 fields(delimited by comma ,) in each line.
> How can I exact the 2nd and 4th fields from the whole file(I do want
> to have a loop to do this)? I was told the awk can do this.
> How about Perl?

($ignore, $second_field, $ignore, $fourth_field) = split(',', $line);

>
> Thanks again.
>
> Yang
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 18:30:07 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: I am learning Perl. Help, please.
Message-Id: <slrn8vs13v.5j9.tadmc@magna.metronet.com>

On Mon, 30 Oct 2000 22:58:36 GMT, zhong9999@my-deja.com 
   <zhong9999@my-deja.com> wrote:

>I was told the awk can do this.
>How about Perl?


awk can be translated into Perl via the 'a2p' program that
comes with the perl distribution.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 30 Oct 2000 17:41:48 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: I am learning Perl. Help, please.
Message-Id: <MPG.1467c338ee44b9f698ae82@nntp.hpl.hp.com>

In article <8tkueo$d32$1@nnrp1.deja.com> on Mon, 30 Oct 2000 22:58:36 
GMT, zhong9999@my-deja.com <zhong9999@my-deja.com> says...
> Thank you in advance for your help.
> 
> I have two questions:

Then you would have a better chance of getting responses if you used two 
posts, one for each question.

> 1). If I want to hide my perl scripts, for example, make my scripts
> look like compiled c++ programs, so nobody can look at my scripts.
> Can I do this and how? Are there any free software?

This is a Frequently Asked Question, and not surprisingly the answer is 
to be found in the Perl FAQ.  Specifically, in perlfaq3: "How can I hide 
the source for my Perl program?"  You could have discovered this by 
typing, at a command line:

    perldoc -q hide

A search over this newsgroup for the past few days will turn up some 
more comments and criticisms relevant to that FAQ.

> 2). My text file has 5 fields(delimited by comma ,) in each line.
> How can I exact the 2nd and 4th fields from the whole file(I do want
> to have a loop to do this)? I was told the awk can do this.
> How about Perl?

You have to decide what data structure you want to create -- an array 
each for the 2nd and 4th fields, or (probably better) an array of 
subarrays, each of which contains the 2nd and 4th fields of a line.

You certainly need a loop to do this.  Either explicit (this uses two 
arrays):

    my (@second, @fourth);
    while (<FILE>) {
        my ($second, $fourth) = (split /,/)[1, 3];
        push @second, $second;
        push @fourth, $fourth;
    }

Or implicit, which is OK if the file isn't 'too' large (this uses a two-
dimensional array):

    my @fields = map [ (split /,/)[1, 3] ] => <FILE>;
    
perldoc -f split
perldoc -f push
perldoc -f map
perldoc perllol
perldoc perldsc

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


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

Date: Mon, 30 Oct 2000 18:26:18 -0500
From: Henry F Turner <hft@super.org>
Subject: solaris vs linux perl and hash/dbm files
Message-Id: <39FE039A.4B691A8F@super.org>



I have perl, version 5.005_03, on both solaris and linux systems.
I would like to be able to run a perl application on the linux systems
which accesses existing dbm files, but have been unable to get the
perl on the linux systems to do so. In particular, the following code:
-----------------------------------------------------
#!/usr/bin/perl -w

use NDBM_File;
use Fcntl;

#dbmopen(%TST_DBM, 'DBM_TST', 0644);
tie(%TST_DBM, 'NDBM_File', 'DBM_TST', O_RDWR|O_CREAT, 0644);
$TST_DBM{"foo"}="bar";
#dbmclose(%TST_DBM);
untie(%TST_DBM);
-----------------------------------------------------
does not work the same. On solaris it produces two files (.dir & .pag),
and on linux, only one, DBM_TST.db.  The linux perl seems to be
ignoring the NDBM_File part, with dbmopen or with tie. If anybody can
tell me what I am missing I would be much obliged.
Thanks,

 hft@super.org




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

Date: Mon, 30 Oct 2000 23:55:57 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Unterminated <> operator? what the heck?
Message-Id: <x7pukhj33m.fsf@home.sysarch.com>

>>>>> "o" == oarend  <oarend@my-deja.com> writes:


  >> syntax error at searchaw.pl line 118, near "if"
  >> Unterminated <> operator at searchaw.pl line 118.

  o> Or can you find the mistake in

  o> if (($obj{'frei'} == 1) and ($obj{'zm'} == $param{'zm'}) and ($obj
  o> {'gr'} > $mingr[$param{'gr'}]) and ($obj{'gr'} <= $maxgr[$param{'gr'}])
  o> and ($obj{'pr'} > $minpr[$param{'pr'}]) and ($obj{'pr'} <= $maxpr[$param
  o> {'pr'}]) and (($obj{'ort'} eq $param{'ort1'}) or ($obj{'ort'} eq $param
  o> {'ort2'}) or ($obj{'ort'} eq $param{'ort3'}) or ($obj{'ort'} eq $param
  o> {'ort4'}) or ($obj{'ort'} eq $param{'ort5'})) and (($obj{'jahr'} <
  o> $param{'jahr'}) or (($obj{'jahr'} < $param{'jahr'}) and ($obj{'monat'}
  o> <= $param{'monat'})))

format and indent that mess and you will quickly find it yourself.
i won't sully my retina with it one more femtosecond.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 30 Oct 2000 15:44:24 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Unterminated <> operator? what the heck?
Message-Id: <m3y9z6f1hj.fsf@dhcp11-177.support.tivoli.com>

oarend@my-deja.com writes:

> my script gives me the following error report:
> 
> > syntax error at searchaw.pl line 118, near "if"
> > Unterminated <> operator at searchaw.pl line 118.
> 
> Is there a limit to how long a line in Perl can be? (I'm running
> ActivePerl 5.something on a Win98 system with OmniHTTPd as server)

Don't think so.

> Or can you find the mistake in
> 
> if (($obj{'frei'} == 1) and ($obj{'zm'} == $param{'zm'}) and ($obj
> {'gr'} > $mingr[$param{'gr'}]) and ($obj{'gr'} <= $maxgr[$param{'gr'}])
> and ($obj{'pr'} > $minpr[$param{'pr'}]) and ($obj{'pr'} <= $maxpr[$param
> {'pr'}]) and (($obj{'ort'} eq $param{'ort1'}) or ($obj{'ort'} eq $param
> {'ort2'}) or ($obj{'ort'} eq $param{'ort3'}) or ($obj{'ort'} eq $param
> {'ort4'}) or ($obj{'ort'} eq $param{'ort5'})) and (($obj{'jahr'} <
> $param{'jahr'}) or (($obj{'jahr'} < $param{'jahr'}) and ($obj{'monat'}
> <= $param{'monat'})))

Well, there's one two few close parens at the end.... 

> (don't worry about the names of the variables or what the heck this is
> doing ;-)

Heaven forbid!  I'm having to bite my tongue over sooooo many
comments... ;)

> The mistake should be somewhere within the last 3 comparisons, since
> that's what I just added and now the script doesn't run anymore...

I can only assume that the missing paren is interacting with some of
the following code to produce that error.  When I remove the "if" and
parse this (without adding the final closing paren) I get:

syntax error at - line 8, at EOF

Adding the close paren fixes that problem.

-- 
Ren Maddox
ren@tivoli.com


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

Date: 31 Oct 2000 00:26:47 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Unterminated <> operator? what the heck?
Message-Id: <8tl3k7$1c04$1@news.enteract.com>

oarend@my-deja.com wrote:
> my script gives me the following error report:

>> syntax error at searchaw.pl line 118, near "if"
>> Unterminated <> operator at searchaw.pl line 118.

> Is there a limit to how long a line in Perl can be? (I'm running
> ActivePerl 5.something on a Win98 system with OmniHTTPd as server)

No (other than your system's available virtual memory), but there *is* a
limit on the number of items of information that the human brain can hold
in working memory at one time.  Your conditional expression vastly exceeds
that limit.  Remember that more than two-thirds of a programmer's time is
spent maintaining code, not creating new code from scratch, and that
maintenance is the largest component of the total life-cycle cost of a
program.

> Or can you find the mistake in

> if (($obj{'frei'} == 1) and ($obj{'zm'} == $param{'zm'}) and ($obj
> {'gr'} > $mingr[$param{'gr'}]) and ($obj{'gr'} <= $maxgr[$param{'gr'}])
> and ($obj{'pr'} > $minpr[$param{'pr'}]) and ($obj{'pr'} <= $maxpr[$param
> {'pr'}]) and (($obj{'ort'} eq $param{'ort1'}) or ($obj{'ort'} eq $param
> {'ort2'}) or ($obj{'ort'} eq $param{'ort3'}) or ($obj{'ort'} eq $param
> {'ort4'}) or ($obj{'ort'} eq $param{'ort5'})) and (($obj{'jahr'} <
> $param{'jahr'}) or (($obj{'jahr'} < $param{'jahr'}) and ($obj{'monat'}
> <= $param{'monat'})))

Try reorganizing that into something readable, even if only to indent it
properly.  The problem might become obvious then.  That incredible chain
of comparisons of $obj{ort} (remember that Perl automagically stringifies
bareword hash indices if they're identifiers, as 'ort' is, so you don't
need the single quotes; normally this would be a nitpick, but in this case
dropping the quotes would make the expression much shorter) is probably
better done with a hash lookup.  Your expression is the Perl equivalent of
a paragraph-length runon sentence in English.



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

Date: Mon, 30 Oct 2000 16:30:24 +0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: using ExtUtils::Command ...
Message-Id: <8tl3sb0n77@news1.newsguy.com>

[posted and emailed]

In article <39fd7c88.0@briol.cet.pt>, "salazar"
<apsalazar@mail.telepac.pt> wrote:

> I want use some shell commands like copy, move, ..., but, I want use
> them in a portable way, I mean, I want that my script works in Windows
> and in a Unix environment too. So, I don't want use system("copy", ...)
> or a system("cp",
> ...) because is dependent of environment. So, I'm trying to use the
> ExtUtils:::Command, because if I make cp("arg1","arg2"), in some how, it
> will translate the cp command for "cp" in a Unix or "copy" in a Windows
> environment.

Are you doing anything with makefiles?  I think that's what's intended
for that module.  Perhaps File::Copy will provide a platform independant
way to do what you want?

Cheers,
Jeff


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

Date: Mon, 30 Oct 2000 19:48:54 -0600
From: "Ben Ben" <idleisidle@usa.net>
Subject: What should I do?
Message-Id: <1ypL5.575$6b7.10942@vixen.cso.uiuc.edu>

I installed perl5 and Apache web server on Unix.
And I create a test.pl like this,

#!/usr/local/bin/perl -w
print "Content-type:text/html\n\n";
print "<html>\n";
print "<head><title></title></head>\n";
print "<body>\n";
print "0123456789<br>";
print "</body></html>";

The result of "perl test.pl" on the command line of Unix seems OK, and
in my internet browser I also can see a .html file on the Apache server.
Somehow, I can't get the right result about the test.pl in my internet
browser. I mean it isn't executed.

What should I do? Thanks in advance.





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

Date: Mon, 30 Oct 2000 16:46:16 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Which is the best PERL learning book?
Message-Id: <MPG.1467b62f336681fc98ae80@nntp.hpl.hp.com>

In article <slrn8vqq2q.3mv.tadmc@magna.metronet.com> on Mon, 30 Oct 2000 
07:23:54 -0500, Tad McClellan <tadmc@metronet.com> says...
> On Mon, 30 Oct 2000 00:59:01 -0800, Peter <al@bnospamb.cc> wrote:

 ...

> >or the llama book or Beginning PERL?
> 
> I assume you mean "Beginning Perl" instead.

In fact, he surely meant "Learning Perl" instead.

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


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

Date: Mon, 30 Oct 2000 20:28:45 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Which is the best PERL learning book?
Message-Id: <brian-ya02408000R3010002028450001@news.panix.com>

In article <MPG.1467b62f336681fc98ae80@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> posted:

> In article <slrn8vqq2q.3mv.tadmc@magna.metronet.com> on Mon, 30 Oct 2000 
> 07:23:54 -0500, Tad McClellan <tadmc@metronet.com> says...
> > On Mon, 30 Oct 2000 00:59:01 -0800, Peter <al@bnospamb.cc> wrote:

> > >or the llama book or Beginning PERL?

> > I assume you mean "Beginning Perl" instead.

> In fact, he surely meant "Learning Perl" instead.

do you think he meant "Learning Perl" because you think "Beginning
Perl" is not a worthy book? they are both currently published titles.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Mon, 30 Oct 2000 17:53:18 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Which is the best PERL learning book?
Message-Id: <MPG.1467c5e685fc312298ae83@nntp.hpl.hp.com>

In article <brian-ya02408000R3010002028450001@news.panix.com> on Mon, 30 
Oct 2000 20:28:45 -0400, brian d foy <brian@smithrenaud.com> says...
> In article <MPG.1467b62f336681fc98ae80@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> posted:
> 
> > In article <slrn8vqq2q.3mv.tadmc@magna.metronet.com> on Mon, 30 Oct 2000 
> > 07:23:54 -0500, Tad McClellan <tadmc@metronet.com> says...
> > > On Mon, 30 Oct 2000 00:59:01 -0800, Peter <al@bnospamb.cc> wrote:
> 
> > > >or the llama book or Beginning PERL?
> 
> > > I assume you mean "Beginning Perl" instead.
> 
> > In fact, he surely meant "Learning Perl" instead.
> 
> do you think he meant "Learning Perl" because you think "Beginning
> Perl" is not a worthy book? they are both currently published titles.

I hadn't heard of "Beginning Perl" before, but now I have.  :-)

I can't judge its worthiness on the basis of the handful of reviews at 
Amazon from people I don't know.  It isn't mentioned on Uri Guttman's 
website.

  Beginning Perl
  by Simon Cozens, Peter Wainwright
  List Price: $39.99

 ...

  Mass Market Paperback - (May 25, 2000) 700 pages 

The blurb says it uses Perl 5.6 throughout, which is a Good Thing.   
"Learning Perl" is certainly getting 'long in the tooth'.  Other than 
that, who knows whether to recommend it?

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


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

Date: Tue, 31 Oct 2000 00:16:52 GMT
From: rereidy@my-deja.com
Subject: Win32::IpHelp
Message-Id: <8tl31e$h23$1@nnrp1.deja.com>

Hi everyone,

I am looking for this module (referenced in 'Perl for System
Administrators), but I cannot find it on
http://www.generation.net/~aminer/Perl.  I also cannot find it on CPAN
or ActiveState.

Does anyone have any idea where I can find this module?

Thanks for your time.

Ron Reidy
Oracle DBA


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4768
**************************************


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