[11763] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5363 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 12 16:07:35 1999

Date: Mon, 12 Apr 99 13:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 12 Apr 1999     Volume: 8 Number: 5363

Today's topics:
    Re: A regexp solution without look-ahead/look-behind? (Dmitry Epstein)
    Re: Active State 5.09 Perl processes hanging under NT 4 (Daniel Beckham)
    Re: Can you use defined() on a typeglob? (Daniel Beckham)
    Re: CGI embedded in html <jason.holland@dial.pipex.com>
    Re: Date/time variable <gellyfish@gellyfish.com>
    Re: Executing perl code from separate files (Sys Adm 89806 Manager of programing development and Intranet Resources)
    Re: Executing perl code from separate files <cassell@mail.cor.epa.gov>
    Re: Executing perl code from separate files <kubla_khan@rocketmail.com>
    Re: Getting long filename from 8.3 filename? <Allan@due.net>
        glob not working win32? <grichard@uci.edu>
    Re: Help with submiting a form from a script (Steve Linberg)
    Re: Help with submiting a form from a script <alejandro.eluchans@umb.edu>
    Re: HELP-shopping cart help <gellyfish@gellyfish.com>
    Re: How do I delete text in a file? <cassell@mail.cor.epa.gov>
    Re: How do I delete text in a file? <emschwar@rmi.net>
    Re: How to Restrict CGI access? <gellyfish@gellyfish.com>
    Re: installing libnet on win32 <tgray@smlny.com>
    Re: is there any ceiling function in perl? (Larry Rosler)
    Re: is there any ceiling function in perl? <uri@ibnets.com>
    Re: newbie question - blank form fields and selections (Steve Linberg)
        ODBC DSN written in perl? eric_lenio@my-dejanews.com
        Perl and text parsing <bigbird@pol.com>
    Re: Perl and text parsing (Steve Linberg)
    Re: Perl as a first programming language - suitability, (Randal L. Schwartz)
    Re: Perl regexps compared to Python regexps <cassell@mail.cor.epa.gov>
    Re: Perl regexps compared to Python regexps (Ilya Zakharevich)
    Re: Perl, ran in single-thread mode? (Darren Greer)
        Printing commas gtdgm@hotmail.com
    Re: Printing commas (Greg Bacon)
    Re: Printing commas (Larry Rosler)
        Q: Hash tables!!! <Jim.Kangosjarvi@Abc.se>
        Search Script <mike@2f3.com>
    Re: Search Script (Steve Linberg)
    Re: Statistics for comp.lang.perl.misc <cassell@mail.cor.epa.gov>
        su another user in my perl program (yang shen)
    Re: Text Search Program <gellyfish@gellyfish.com>
    Re: Where I Can Learn About Pearl And CGI Scripting? <jeff@webdesigns1.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 12 Apr 1999 17:51:55 GMT
From: mitiaNOSPAM@nwu.edu.invalid (Dmitry Epstein)
Subject: Re: A regexp solution without look-ahead/look-behind?
Message-Id: <37123192.5901725@news.acns.nwu.edu>

On 12 Apr 1999 01:37:15 GMT, sholden@pgrad.cs.usyd.edu.au (Sam Holden)
wrote:
>Dmitry Epstein <mitiaNOSPAM@nwu.edu.invalid> wrote:
>>
>>The problem is that when I use this idiom:
>>
>>	/\b$pattern\b/g
>>
>>it fails if the pattern has a non-alphanumeric character at the
>>beginning or at the end, e.g. the keyword '@home' would fail in a word
>>context because the boundary between '@' and the previous character is
>>not a word boundary.
>
>You could check the first and last characters of $pattern and use the
>appropriate case of 'b'.

This is probably the best solution.  Thanks!
--
Remove NOSPAM and .invalid from mitiaNOSPAM@nwu.edu.invalid


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

Date: Mon, 12 Apr 1999 14:58:00 -0500
From: danbeck@qual.net (Daniel Beckham)
Subject: Re: Active State 5.09 Perl processes hanging under NT 4.0
Message-Id: <MPG.117c0c478e2f7d94989681@news.idt.net>

HA!  You are right.  Just trying to be open about it.  Heck, any version 
of unix would be better than an NT box...

In article <370CDA7E.DEE452C1@mail.cor.epa.gov>, cassell@mail.cor.epa.gov 
says...
> Daniel Beckham wrote:
> > 
> > Better yet, ditch Netscape and pickup a copy of Apache for Win32.  I run it at
> > work and it works beautifully.
> > 
> > Even better still, ditch NT and get a unix box with apache perl and php.
> > 
> > =)
> 
> I think you misspelled 'linux' there.  :-)
> 


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

Date: Mon, 12 Apr 1999 14:56:50 -0500
From: danbeck@qual.net (Daniel Beckham)
Subject: Re: Can you use defined() on a typeglob?
Message-Id: <MPG.117c0bfe2a4a8be1989680@news.idt.net>

Thank you.  That's what I'm looking for.  Although, I wonder if that's 
possible to do anyway?  Even if it's not the solution to my problem, 
would it be possible to know if symbol exists in the symbol table?

I need to research that some more... interesting.

Daniel

In article <7em44r$ofo$1@pegasus.csx.cam.ac.uk>, mjtg@cus.cam.ac.uk 
says...
> Daniel Beckham <danbeck@qual.net> wrote:
> >I need to check to see if a filehandle is defined.  Can I use a defined() o a 
> >typeglob?
> 
> There isn't a concept of "defined" for a filehandle in Perl.
> 
> Perhaps you mean "Is this filehandle currently open?".   In which case
> see   perldoc -f fileno.
> 
> 
> Mike Guy
> 


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

Date: Mon, 12 Apr 1999 20:54:30 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
Subject: Re: CGI embedded in html
Message-Id: <37125D86.F3A2C70A@dial.pipex.com>

What's the "gif trick"? Never heard of it...

Thanks!


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

Date: 11 Apr 1999 12:57:35 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Date/time variable
Message-Id: <7eq67v$3ek$1@gellyfish.btinternet.com>

On Sun, 11 Apr 1999 02:25:23 -0500 Art Gratchev wrote:
> Is there any way to get a system date and time in perl CGI?  Like a
> environment variable or something..
> Anybody..anybody?
> Thanks in advance,

You mean other than that returned by the functions time,gmtime,localtime ?

from perlfunc manpage for example:

=item gmtime EXPR

Converts a time as returned by the time function to a 9-element array
with the time localized for the standard Greenwich time zone.
Typically used as follows:

    #  0    1    2     3     4    5     6     7     8
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                            gmtime(time);

All array elements are numeric, and come straight out of a struct tm.
In particular this means that C<$mon> has the range C<0..11> and C<$wday>
has the range C<0..6> with sunday as day C<0>.  Also, C<$year> is the
number of years since 1900, that is, C<$year> is C<123> in year 2023,
I<not> simply the la st two digits of the year.

If EXPR is omitted, does C<gmtime(time())>.

In scalar context, returns the ctime(3) value:

    $now_string = gmtime;  # e.g., "Thu Oct 13 04:54:34 1994"

 ... 

You will find in general that it is better to have looked at the most
excellent documentation that comes with the Perl distribution.  If you
dont you will find that you will draw some severe criticism from others
in this group which may vary from faint irony to some full on flaming.

It might seem unreasonable to you for us to expect some previous research
from you before you make your post - however a moments thought would
indicate that if everyone did what you have done and if people replied
then the group would become totally unuseable with thousands of near
identical posts every day.

You may retort that you do not have access to the documentation - of
course this is no real excuse as the documentation is available with every
Perl distribution - and also online via <http://www.perl.com>.  If you
do not have Perl installed on your system (I note that you mentioned
CGI in your post and that you are possibly writing for a server that
you do not have telnet access) then you really should try to do get it -
Perl is available for nearly all popular (and some unpopular) platforms.

Now go repent and read the documentation and come back reformed ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 12 Apr 1999 18:14:36 GMT
From: ruben@llinderman.dental.nyu.edu (Sys Adm 89806 Manager of programing development and Intranet Resources)
Subject: Re: Executing perl code from separate files
Message-Id: <7etd6c$d3n$1@news.nyu.edu>

That depends on what you want to do.  One can call any perlcode in through
a typeglob using while<FILEHANDLE>{}

and then eval and capture output into a scalar.

But - if one wants to bring in seperate perl code to  use over and over
again in larger program designs, then one should use
use perlmod

Ruben


In article <3711DF7A.4236A63A@rocketmail.com>,
	Kubla Khan <kubla_khan@rocketmail.com> writes:
> I want to read and execute separate files containing perl code from one
> 'main' perl program and retrieve the output.
> Is reading the files in and using eval the best way to accomplish this?
> 
> 


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

Date: Mon, 12 Apr 1999 11:44:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Executing perl code from separate files
Message-Id: <37123F26.C62F10C5@mail.cor.epa.gov>

Kubla Khan wrote:
> 
> I want to read and execute separate files containing perl code from one
> 'main' perl program and retrieve the output.
> Is reading the files in and using eval the best way to accomplish this?

It isn't really clear what you have in mind here.  But I suggest you
read up on the functions do, use, and require to find which is the most
appropriate for your needs.  And if you're reading in 'untrustworthy'
code, please check it first.

HTH,
David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Mon, 12 Apr 1999 15:28:14 +0100
From: Kubla Khan <kubla_khan@rocketmail.com>
Subject: Re: Executing perl code from separate files
Message-Id: <371202FE.C32B3E6B@rocketmail.com>

Does that mean there is a way I can eval a file without opening a file handle
and reading it in?  If so, how?

Thanks!

Steve Linberg wrote:

> In article <3711DF7A.4236A63A@rocketmail.com>, Kubla Khan
> <kubla_khan@rocketmail.com> wrote:
>
> > I want to read and execute separate files containing perl code from one
> > 'main' perl program and retrieve the output.
> > Is reading the files in and using eval the best way to accomplish this?
>
> You can eval files directly, if you want, but be sure you trust their
> contents and aren't going to complain if one of them contains '`rm -rf
> /`;' or something equally evil.
>
> --
> Steve Linberg, Systems Programmer &c.
> National Center on Adult Literacy, University of Pennsylvania
> email: <linberg@literacy.upenn.edu>
> WWW: <http://www.literacyonline.org>



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

Date: Mon, 12 Apr 1999 14:47:46 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Getting long filename from 8.3 filename?
Message-Id: <7etf4v$leh$1@camel29.mindspring.com>

hgelman@ntia.doc.gov wrote in message <7et9kl$q3$1@nnrp1.dejanews.com>...
:
:I have a short perl script that will run under Windows, and I've made it
into
:an executable through perl2exe.  Ideally, I'd like to drag a file onto the
:executable, and then process that file in the perl script.  Unfortunately,
:the Windows Explorer is stupidly passing the 8.3 filename (e.g.,
:"this is a long file.txt" becomes "thisis~1.txt").  That's useless to me,
:since I actually need to extract info from the filename.  I did a Dejanews
:search and found other people who had this problem, but the solutions
offered
:were always Visual Basic or Visual C.  Does anyone know of a way I can get
:the full, long filename from ActiveState Perl?
:
:I don't mind if it's somewhat ugly -- a small executable written in any
:language which would let me drag a file onto it and then it would run my
:program with the correct filename would be acceptable.

Here is a snippet I posted a while back you can use as an example.  If you
make the following a bat file using pl2bat then you can drag a long file
name onto it and it writes the short and the long file names into a file
named temp.dat in the original directory.  The idea should work for you.
For your actual application, @files should only have one file name in it so
once you check to make sure that is the case you can manipulate it as you
like.


#!/usr/local/bin/perl -w
use strict;
use Win32;
use File::Basename;

my $fullname = shift @ARGV;
my ($name,$path) = fileparse($fullname);

opendir (DIR,"$path") or warn "$!\n";
my @files = grep {Win32::GetShortPathName("$path$_") eq $fullname}
readdir(DIR);
close (DIR);


open (FH,">${path}temp.dat") or warn "$!\n";
print FH "The shortened name of the file is [$name] which was part of
[$fullname] with path $path\n";
print FH "The matched long file names [there really should only be one] are:
@files\n";
close (FH);

HTH

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
The product of an arithmetical computation is the answer to an equation; it
is not the solution to a problem.
 - Ashley-Perry Statistical Axioms[4]

[posted and mailed]




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

Date: Mon, 12 Apr 1999 12:53:28 -0700
From: "Gabriel Richards" <grichard@uci.edu>
Subject: glob not working win32?
Message-Id: <7etiom$fvs@news.service.uci.edu>

I've got a script that works fine on our Unix/Apache server. I'm trying to
get it to work in PWS for Win32. I've set up PWS correctly, no problem
there. I don't think that the "glob" function is working properly though.
Here's the snippet that isn't doing what I expect:

 $forum = $input{'forum'};
 $messagedir = "/inetpub/wwwroot/forums/$forum";
 @messagelist = glob("$messagedir/*.dat");
 print "$messagelist[0] $forum $messagedir Hello world!";

$messagelist[0] doesn't print anything. Everything else does. Again, the
very same code (with different paths) works on Unix/Apache. I've installed
the latest ActiveState build (515). $messagedir[0] should hold the value
"1.dat". Are there any issues with glob and Win32? Can someone give me some
help or point me to a FAQ? Thanks.

Take it easy...
Gabe





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

Date: Mon, 12 Apr 1999 14:19:16 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Help with submiting a form from a script
Message-Id: <linberg-1204991419170001@ltl1.literacy.upenn.edu>

In article <37123778.E3EB0D42@umb.edu>, Alejandro Eluchans
<alejandro.eluchans@umb.edu> wrote:

> Does any body know how to submit a form (name/value form entries) that
> is located in a PERL script (like a browser), so I may use the return
> (from the cgi) with the PERL script.

The way you've phrased your question suggests to me that this is new
territory to you.  Forms aren't "in Perl scripts".  They're HTML
elements.  You can use a Perl script to parse the parameters from a form
via the CGI protocol and generate an HTML page to return.  There are many,
many other ways to do this too.

In any event, look into CGI.pm for a start.  It will do all the dirty work
of collecting the form parameters for you, like the following (untested,
top-of-head) simple example.  perldoc CGI.pm will run it all down for you
in much greater detail.

foo.cgi:
----------------------------
#!/usr/bin/perl -w

use strict;
use CGI;

my $q = new CGI;

my $field1 = $q->param("field1");

print $q->header;
print $q->start_html("results");
print $q->p("You typed $field1 in the box.");
print $q->end_html;

-----------------------------
(...etc.)

Good luck.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Mon, 12 Apr 1999 14:41:34 -0500
From: Alejandro Eluchans <alejandro.eluchans@umb.edu>
To: Steve Linberg <linberg@literacy.upenn.edu>
Subject: Re: Help with submiting a form from a script
Message-Id: <37124C6D.2A587FE7@umb.edu>

Thanks for responding

Sorry if I didn't make myself clear

What I'm trying to do is create a crawler that submits to a cgi (this cgi
handles a web form).
So I may store the results from the cgi  into my crawler.
(trying to download a database)

Alejandro

Steve Linberg wrote:

> In article <37123778.E3EB0D42@umb.edu>, Alejandro Eluchans
> <alejandro.eluchans@umb.edu> wrote:
>
> > Does any body know how to submit a form (name/value form entries) that
> > is located in a PERL script (like a browser), so I may use the return
> > (from the cgi) with the PERL script.
>
> The way you've phrased your question suggests to me that this is new
> territory to you.  Forms aren't "in Perl scripts".  They're HTML
> elements.  You can use a Perl script to parse the parameters from a form





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

Date: 11 Apr 1999 12:29:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: HELP-shopping cart help
Message-Id: <7eq4ik$3dk$1@gellyfish.btinternet.com>

On 10 Apr 1999 20:03:27 GMT EME888 wrote:
> 
> I would really like to see a perlshop newsgroup because alot of people use it.

Judging by the number of posts we have had here in recent times about it
I think I would too - You can start one yourself of course.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 12 Apr 1999 11:39:06 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do I delete text in a file?
Message-Id: <37123DCA.1570C0D0@mail.cor.epa.gov>

Steve Linberg wrote:
> 
> In article <7et5vr$95n@news.service.uci.edu>, "Gabriel Richards"
> <grichard@uci.edu> wrote:
> 
> > Is there a function which will allow me to delete text from a file?
> 
> No, but you can read a file into memory, delete text from it, and write it
> back out.
> 
> > I want
> > to delete all the tags in an HTML file just leaving the content.
> 
> Look into HTML::Parse (or HTML::Parser, I can never remember which one is
> current and which is old) on CPAN.

HTML::Parser is the current one.  I remember only because I was
chastised
on this just a few days ago.

HTH,
David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: 12 Apr 1999 12:41:16 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: How do I delete text in a file?
Message-Id: <xkfk8vhlm0j.fsf@valdemar.col.hp.com>

ruben@llinderman.dental.nyu.edu (Sys Adm 89806 Manager of programing development and Intranet Resources) writes:
> You cound write the function.

Generally a bad idea, especially when someone's already done it for you.
HTML is moderately complicated, and a simple regex will *not* do it for
you; you must write a parser.  Which is silly, given that HTML::Parser
exists already.

> Here is a start
> 
> sub htmlbegone{
>     s/<.*>//g #correct this - it is greedy

And wrong.  perldoc perlfaq9, "How do I remove HTML from a string?":

 Many folks attempt a simple-minded regular expression approach, like
 s/<.*?>//g, but that fails in many cases because the tags may continue
 over line breaks, they may contain quoted angle-brackets, or HTML
 comment may be present.  Plus folks forget to convert entities, like
 &lt; for example.

Read the FAQ for better solutions.

-=Eric



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

Date: 11 Apr 1999 11:52:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to Restrict CGI access?
Message-Id: <7eq2eb$3d1$1@gellyfish.btinternet.com>

On Sat, 10 Apr 1999 23:28:29 GMT multilinks@my-dejanews.com wrote:

>                   The problem here is that PERL must still be called to
> enforce this restriction.  I want to block remote hosts before they get to
> PERL and costs me server resources.
> 

So then this cannot possibly be appropriate for this group .

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 12 Apr 1999 15:08:40 -0400
From: "Tim Gray" <tgray@smlny.com>
Subject: Re: installing libnet on win32
Message-Id: <IprQ2.2471$YU1.4377@newsr2.twcny.rr.com>

>You are almost certanly better off using the Perl Package Manager
>(PPM) that comes with the Activestate distribution.
>
>Anyhow I thought that libnet came with that distribution. ?
>
>/J\

SMTP.pm doesn't get installed anywhere I can find it.  The only things in
perl\lib\Net are hostentpm, protoent.pm, Ping.pm, servent.pm, and netent.pm
and perl\site\lib\Net doesn't even exist.

So I downloaded the zip of the package for libnet.  When I try to install,
PPM deletes all the files and then complains that it can't find them.  It
even tries to remove the current directory.
Here is what happens:


 Directory of C:\TEMP\libnet

04/12/99  03:05p        <DIR>          .
04/12/99  03:05p        <DIR>          ..
07/22/98  10:18p                   567 libnet.ppd
02/19/99  04:11p                   127 README
04/12/99  03:05p        <DIR>          x86
               5 File(s)            694 bytes
                          1,709,407,232 bytes free

C:\TEMP\libnet>ppm install libnet.ppd
Can't remove directory C:\TEMP/libnet: Permission denied at
C:\Perl\lib/PPM.pm l
ine 301
Error installing package 'libnet.ppd': Read of ./x86/libnet.tar.gz failed





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

Date: Mon, 12 Apr 1999 11:39:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: is there any ceiling function in perl?
Message-Id: <MPG.117bddab8e8d751b989899@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7eta23$124$1@nnrp1.dejanews.com> on Mon, 12 Apr 1999 
17:21:16 GMT, Don Roby <droby@copyright.com> says...
> > In article <7edc1u$4hv$1@nnrp1.dejanews.com> on Tue, 06 Apr 1999
> > 16:17:08 GMT, Don Roby <droby@copyright.com> says...
> > ...
> > > ...  Multiplication by booleans is not efficient.
 ... 
> I don't think efficiency can be measured simply by counting operations in any
> language.  Some operations are more expensive than others.
> 
> I agree that using these numeric values of Booleans is useful and may
> sometimes be more efficient, as long as you stick to addition and
> subtraction.
> 
> I think multiplication is a more complex process than addition or any of the
> simple Boolean operations, so I would expect it to contribute a greater
> inefficiency.

That is a surprising statement.  In effect, after flailing around for a 
while interpreting the operation, perl executes a floating-point 
multiplication of two variables, via C.  In modern hardware, the time 
for that operation (and for division too, for that matter) is not 
significantly greater than the time for an addition, in any event much 
less than the overhead surrounding it.

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


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

Date: 12 Apr 1999 14:45:07 -0400
From: Uri Guttman <uri@ibnets.com>
Subject: Re: is there any ceiling function in perl?
Message-Id: <394smladak.fsf@ibnets.com>

>>>>> "DR" == Don Roby <droby@copyright.com> writes:

  DR> I don't think efficiency can be measured simply by counting
  DR> operations in any language.  Some operations are more expensive
  DR> than others.

in perl it does make a difference. perl operation dispatch is a well
known bottleneck. that is why various benchmarks show that fewer perl op 
usually results in faster code regardless of what the ops do. it is
counterintuitive to some but if you understand the interpretive loop
nature of perl and the overhead in dispatching, you will see why
lowering op counts is usually faster.

  DR> I think multiplication is a more complex process than addition or
  DR> any of the simple Boolean operations, so I would expect it to
  DR> contribute a greater inefficiency.

in most hardware today multiply is as fast (or close to) any other
operation. and in perl, the actual op is a neglible factor in the speed
(for most simple ops).

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Mon, 12 Apr 1999 14:11:03 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: newbie question - blank form fields and selections
Message-Id: <linberg-1204991411030001@ltl1.literacy.upenn.edu>

In article <371234CE.A588CC42@1185design.com>, mikej
<mikej@1185design.com> wrote:

> Are uninitialized fields just set as "" or is there some special way I
> need to refer to them? Thanks!

First, use CGI.pm.  No excuses for not doing so.

Then, you can test for parameters like this:

use CGI;
my $q = new CGI;

if ($q->param("field1")) {
  #do something
} else {
  #do something else
}

 ...and so on.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Mon, 12 Apr 1999 18:15:21 GMT
From: eric_lenio@my-dejanews.com
Subject: ODBC DSN written in perl?
Message-Id: <7etd7h$3v4$1@nnrp1.dejanews.com>

Hi -

Is it possible to write an ODBC driver in perl, so that it shows up in the
Control Panel as an ODBC DSN?  The driver doesn't actually have to be written
in perl, but it needs to at least be a link (via perl's API) to a perl
process. That way, I can feed all sorts of perl data into my Windoze
applications.

In particular, I have an Ingres database running on a unix server which I
want to access from Windows.  I don't want to use the Ingres ODBC driver
because that requires purchasing Ingres for Windows.  Instead, I'd rather do
something like below:

Windows <--> perl ODBC DSN <--> DBI perl on unix <--> Ingres on unix

Note that installing DBD::Ingres directly on Windows can't do this since it
needs to link to the Ingres libraries, which in my case live in unix (no PC
Ingres).
Thanks,
Eric.
elenio@mct.rochester.edu

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


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

Date: Mon, 12 Apr 1999 14:02:29 -0400
From: "Greg Waugh" <bigbird@pol.com>
Subject: Perl and text parsing
Message-Id: <37123523.0@news.one.net>

Hi there!  I'm looking for a some documentation or a module or something on
Perl-based text parsing.  We will be receving "press release" style
documents which will need to be parsed for relevant information (numbers,
dates, names, etc).  I was wondering if someone knew of a module with
functions that could assist or if not, could recommend a book that covers
this kind of parsing in good detail.  Any help would be greatly appreciated!
Thanks!!

Greg Waugh (bigbird@pol.com)




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

Date: Mon, 12 Apr 1999 14:08:52 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl and text parsing
Message-Id: <linberg-1204991408520001@ltl1.literacy.upenn.edu>

In article <37123523.0@news.one.net>, "Greg Waugh" <bigbird@pol.com> wrote:

> Hi there!  I'm looking for a some documentation or a module or something on
> Perl-based text parsing.  We will be receving "press release" style
> documents which will need to be parsed for relevant information (numbers,
> dates, names, etc).  I was wondering if someone knew of a module with
> functions that could assist or if not, could recommend a book that covers
> this kind of parsing in good detail.  Any help would be greatly appreciated!
> Thanks!!

Since text parsing is a huge, huge application for Perl and one of the
primary tasks it was designed for, virtually any Perl information source
you can find will discuss text parsing in depth.  You might want to start
with "Learning Perl," published by O'Reilley.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: 12 Apr 1999 10:45:19 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl as a first programming language - suitability, good books ?
Message-Id: <m1pv59ag28.fsf@halfdome.holdit.com>

>>>>> "Tony" == Tony Kenny <tony@cyberscape.net> writes:

Tony> A friend has asked me to teach them Perl as their first
Tony> programming language.  I got her to buy Randal's Learning Perl
Tony> for Win32.  I will simply help them at each stage and write
Tony> examples as required.

The problem with using the llama or gecko to teach as a first language
is that I didn't spend any time explaining basic programming-language
concepts like "what is a variable" or "what is a subroutine".  I
merely say "this is how you do a subroutine in Perl".

I've not seen a good "Perl for non-programmers" book yet.  I've seen
some that claim to be. :)

I've also been asked for training materials to give Perl instruction
to non-programmers, and I face the same problem there. Some people can
get what a variable is, almost by intuition.  Others sit and stare and
ask "why would I ever use a variable?".  I wonder why these people are
trying to learn to be programmers, but that's another story. :)

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: Mon, 12 Apr 1999 11:11:38 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl regexps compared to Python regexps
Message-Id: <3712375A.DAB5E023@mail.cor.epa.gov>

matthew.freake@smlawpub.co.uk wrote:
> 
> Without wishing to start a Perl vs Python discussion, I was wondering does
> anyone out there know if there are any major differences between the the two
> languages implementations of regular expressions. Lots of net resources seem
> to imply that Python's implementation is less powerful but with my limited
> use of Python and having looked at the documentation, I cannot really find
> any evidence for this. Have I picked up the wrong end of the stick or am I
> missing something ?
> 
> Many thanks
> 
> Matt Freake

Matt, if you really want a *complete* discussion on this subject, get a
copy of Jeffrey Friedl's book 'Mastering Regular Expressions'.  You'll
learn FMTYEWTK about the differences.  Perl has some regex features that
nobody else has, and Friedl's tests suggest that well-written Perl
regexes
should be much faster [although badly-written Perl regexes can be pain-
fully slow - a potential problem in any NFA regex engine].

But.. both Python and Perl are constantly being improved.  So YMMV.

Of course, since you asked this in a Perl ng, you should expect that
we'll all insist violently that Perl is the best.  :-)

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: 12 Apr 1999 18:54:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl regexps compared to Python regexps
Message-Id: <7etfhu$891$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to David Cassell 
<cassell@mail.cor.epa.gov>],
who wrote in article <3712375A.DAB5E023@mail.cor.epa.gov>:
> > Without wishing to start a Perl vs Python discussion, I was wondering does
> > anyone out there know if there are any major differences between the the two
> > languages implementations of regular expressions. Lots of net resources seem
> > to imply that Python's implementation is less powerful but with my limited
> > use of Python and having looked at the documentation, I cannot really find
> > any evidence for this. Have I picked up the wrong end of the stick or am I
> > missing something ?
> 
> Matt, if you really want a *complete* discussion on this subject, get a
> copy of Jeffrey Friedl's book 'Mastering Regular Expressions'.  You'll
> learn FMTYEWTK about the differences.

No he will not.  Hip Owl is several years old, which makes it
completely useless for this particular question.

Hope this helps,
Ilya


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

Date: Mon, 12 Apr 1999 19:07:57 GMT
From: drgreer@qtiworld.com (Darren Greer)
Subject: Re: Perl, ran in single-thread mode?
Message-Id: <371243a1.581300005@news.qgraph.com>

I am trying to get DBI/DBD working on an HP-UX maching running Perl
5.004, and HP-UX 10.20.  Here is the problem.  When I run the connect
sequence with DBI, it locks up...eating upwards of 100% of the CPU.

If I run the same script on our development box, running HP-UX 10.20,
and Perl 5.004, it connects fine.  The only difference between the two
boxes, is that the main box, has threading enabled, with the perl
install.  And the second, development, box does not have threading
enabled.  Any suggestion?

Darren


On 11 Apr 1999 05:58:52 GMT, Dan Sugalski <sugalskd@netserve.ous.edu>
wrote:

-->Darren Greer <drgreer@qtiworld.com> wrote:
-->: Howdy all.
-->
-->: I believe a problem I am having with the DBD and DBI modules, is due
-->: to perl and threading.  If I compile perl with threading enabled, will
-->: it try to run a program thread autmatically?
-->
-->Nope. Threaded perl does behave a little differently than non-threaded
-->perl (@_ and $_ are lexical), but not by much.
-->
-->What sorts of problems are you having? 
-->
-->					Dan



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

Date: Mon, 12 Apr 1999 18:40:07 GMT
From: gtdgm@hotmail.com
Subject: Printing commas
Message-Id: <7etem5$56e$1@nnrp1.dejanews.com>

I have an array of strings.

I want output to look like this:
str1,str2,str3,str4

Thus, between any two consecutive strings
in the array a comma is printed.

What is the easiest way to do this
without using any loop?  Or is there such
a way?


Thanks ahead of time.

-Godfrey Degamo

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


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

Date: 12 Apr 1999 18:55:45 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Printing commas
Message-Id: <7etfjh$3g7$1@info2.uah.edu>

In article <7etem5$56e$1@nnrp1.dejanews.com>,
	gtdgm@hotmail.com writes:
: I want output to look like this:
: str1,str2,str3,str4
[snip]
: What is the easiest way to do this
: without using any loop?  Or is there such
: a way?

Please read the perlfunc documentation on the join() operator.

Greg
-- 
The most incomprehensible thing about the universe is that it is
comprehensible. 
    -- Albert Einstein


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

Date: Mon, 12 Apr 1999 12:21:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Printing commas
Message-Id: <MPG.117be7915a21a40198989a@nntp.hpl.hp.com>

In article <7etfjh$3g7$1@info2.uah.edu> on 12 Apr 1999 18:55:45 GMT, 
Greg Bacon <gbacon@itsc.uah.edu> says...
> In article <7etem5$56e$1@nnrp1.dejanews.com>,
> 	gtdgm@hotmail.com writes:
> : I want output to look like this:
> : str1,str2,str3,str4
> [snip]
> : What is the easiest way to do this
> : without using any loop?  Or is there such
> : a way?
> 
> Please read the perlfunc documentation on the join() operator.

That is a good way, which produces a single string that you can print.  
Alternatively, to print directly you can do this:

{ local $, = ','; print $str1, $str2, $str3, $str4 } 

Please read the perlvar documentation on the $, 
($OUTPUT_FIELD_SEPARATOR) variable.

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


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

Date: Mon, 12 Apr 1999 20:00:56 +0200
From: "Jim Kangosjdrvi" <Jim.Kangosjarvi@Abc.se>
Subject: Q: Hash tables!!!
Message-Id: <7etccj$k3f$1@oden.abc.se>

Hi

When i create a hash table and then add 1000's of variables to it then it
grows few MB (ex. 5 MB).
And when i Delete all the Variables, the size of the hash table is still
several 5 MB.

Why doesnt it decrease?

Please, show a small Source example how i should write if i want to decrease
the database when i delete data from the hash table.

Please mail to Jim.Kangosjarvi@Abc.se

Thanks, Jim




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

Date: Mon, 12 Apr 1999 18:43:41 GMT
From: Mike Poole <mike@2f3.com>
Subject: Search Script
Message-Id: <7etesr$59c$1@nnrp1.dejanews.com>

I have created a HTML form with 4 fields on it. I would like the fields to
search a text file flat comma separated database for the combination of fields
that have been entered (eg. Forename, Surname, Date of Birth, Nationality).

I have looked in www.cgi-resources.com and the Perl Cookbook, but have not
been able to find a satistfactory solution.

Please could you point me in the right direction.

Regards,

Mike Poole

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


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

Date: Mon, 12 Apr 1999 15:01:05 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Search Script
Message-Id: <linberg-1204991501050001@ltl1.literacy.upenn.edu>

In article <7etesr$59c$1@nnrp1.dejanews.com>, Mike Poole <mike@2f3.com> wrote:

> I have created a HTML form with 4 fields on it. I would like the fields to
> search a text file flat comma separated database for the combination of fields
> that have been entered (eg. Forename, Surname, Date of Birth, Nationality).
> 
> I have looked in www.cgi-resources.com and the Perl Cookbook, but have not
> been able to find a satistfactory solution.
> 
> Please could you point me in the right direction.

How about you post some sample lines of your data file?  It shouldn't be
hard to do a simple pattern-matching search; high-performance searching of
large amounts of data might necessitate more sophisticated structures,
however.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Mon, 12 Apr 1999 11:27:37 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <37123B19.7F0C9B6D@mail.cor.epa.gov>

Greg Bacon wrote:
> [snip]
> Top 10 Posters by Number of Posts
> =================================
> 
>          (kb)   (kb)  (kb)  (kb)
> Posts  Volume (  hdr/ body/ orig)  Address
> -----  --------------------------  -------
> 
>   103   223.9 ( 85.1/122.5/ 46.9)  David Cassell <cassell@mail.cor.epa.gov>
>    90   149.9 ( 59.3/ 81.1/ 50.7)  lr@hpl.hp.com (Larry Rosler)

> [more snip]
> Top 10 Threads by Number of Posts
> =================================
> 
> Posts  Subject
> -----  -------
> 
>    19  random number ( -w )
>    19  here docs vs qq quote operator. Just personal preference?
>    18  Perl as a first programming language - suitability, good books ?
>    18  SORT BY DATE
>    17  Privacy for slaves forced to use a proxy/firewall to access the net?
>    16  leap year?
>    16  Premature end of script headers
>    14  HELP with Subsitution
>    14  constructing a list of hashes
>    13  flocking question - worried

So where's the thread where Larry and I just posted each other's posts
back and forth 40 times?

Signed,
Loquacious
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: 12 Apr 1999 19:53:13 GMT
From: ys74@cornell.edu (yang shen)
Subject: su another user in my perl program
Message-Id: <7etiv9$9ab@newsstand.cit.cornell.edu>

Hi Everybody:
	I am writing a perl program to retrieve user's files form our ADSM.
Inside my perl program I need to su user(file owner)first, then retrieve the 
file. How could I get this done? 

Thanks a lot!
Yang



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

Date: 11 Apr 1999 12:17:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Text Search Program
Message-Id: <7eq3t2$3da$1@gellyfish.btinternet.com>

<followups set appropriately and groups trimmed>

In comp.lang.perl.misc Michael O'Connor <mfo@home.com> wrote:
> Hello,
> 
> I'm working on a project that is to have a user input a text string and then
> search for that text string in a bunch of text files.  Then I am to display
> those text files that have that text string in it.  I would like to use
> windows or an internet browser to ask for the input and to display the
> output.  

Then you are talking about using the CGI - I have set the followups to an
appropriate group. You will also need to implement an HTTP server but that
too is beyond the scope of any of the groups you cross-posted.

>          I am using Windows 98 on a stand alone machine.  

You can still run an HTTP server on a stand alone machine.  Apache is by
far the most popular and is musch easier to configure than any other
for MS-Windows <http://www.apache.org>.

>                                                           I have been
> investigating Perl for doing the text searching.  I have had difficulty
> using Perl to drive my internet browser.  Perl is designed for a Unix
> environment not for a windows environment.  Perl wants to only open up a
> text window.  Does anyone know drivers for windows or internet browsers
> using Perl? Should I be using a different programming language? Any
> suggestions?
> 

Perl is of course the ideal language for doing text searching.
It does not natively support a GUI but there are modules for Tk,Gtk
and Win32::GUI available.  If you talking about controlling another
application from Perl then you are looking at using Win32::OLE most
probably.  An alternative is to use Perl scriptlets from , say, a VB
application - this is described in an article by Ken Bandes in issue 12
of the Perl Journal <http://www.tpj.com>.  You can find out about scriptlets
in general from <http://msdn.microsoft.com/scripting>.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Mon, 12 Apr 1999 13:55:56 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: Where I Can Learn About Pearl And CGI Scripting?
Message-Id: <7etfcj$7bi$1@oak.prod.itd.earthlink.net>

If you are an absolute beginner my site may be of help:
http://www.webdesigns1.com/perl/
--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com/

BarneyXter wrote in message
<19990412123424.21220.00003207@ngol01.aol.com>...
>The Title Says It All.  I Want To Learn How To Make A Chat Room And Have
Pages
>That I Can Input Text From...
>
>
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>For E-Mail Reply:  <A HREF="mailto:BarneyXter@aol.com?Subject=Helping
People
>In Newsgroups">Click Here... Barney Exterminator@Aol.Sux</a>
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>For E-Mail Reply:  <A HREF="mailto:BarneyXter@AOL.COM?Subject=Helping
People In
>Newsgroups">Click Here... Barney Exterminator@Aol.Sux</A>
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=





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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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