[7298] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 923 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 26 11:08:36 1997

Date: Tue, 26 Aug 97 08:00:26 -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           Tue, 26 Aug 1997     Volume: 8 Number: 923

Today's topics:
     Re: $#name ???? <seay@absyss.fr>
     Re: && and associativity (Bart Lateur)
     Re: cardinality of an array given a reference <tom@mitra.phys.uit.no>
     Re: cardinality of an array given a reference <ajiteshd@wiproge.med.ge.com>
     create a file in a user directory by the WEB ? <srichard@san-jose.ate.slb.com>
     Re: date & time calculations <adewolf@itr.ch>
     Detect child timeout (alarm) in perl cgi??? (Bob Mariotti)
     Re: Easy Question: Dont Care. (Bart Lateur)
     Re: Easy Question: Dont Care. <robert.friberg@eductus-vast.com>
     Email address verification <johnh@partnersweb.com>
     Re: Email address verification (Andreas Schmidt)
     Re: Email address verification <SPAMFREEgary@iafrica.com>
     Re: Getting started with ODBC.pm on MSsql6.5 <Michael_Drons@ins.com>
     Re: HELP! WinNT/perl cgi newbie <mturk@globalserve.net>
     Re: Help!! my dbm file crash everytime I try to build i (Seth Perlman)
     Re: Help: Give Perl to an uneducated slob & this is wha (Bart Lateur)
     Re: incredibly simple question <colmang@ms.com>
     Re: Info needed: implementation of hash tables? (Andreas Schmidt)
     Re: list contents of directory... (Daniel E. Macks)
     Re: list contents of directory... <seay@absyss.fr>
     Re: list contents of directory... <SPAMFREEgary@iafrica.com>
     Re: Online Help for beginners in Perl <jeff@webdesigns1.com>
     Perl (kind of) math question. <edwardj@hmsmch.cncoffice.com>
     Re: perl bug in pushing anonymous arrays?? <seay@absyss.fr>
     Re: perl bug in pushing anonymous arrays?? (Andrew M. Langmead)
     Perl Regular Expression has a bug? ()
     Re: Perl Regular Expression has a bug? (Brian Wheeler)
     perl shareware resource sharlin@cybernautics.com
     Premature End Of Script Headers? <webman@vsgcom.com>
     Safe Perl Programming Manual?? Book??? (Apropos of Nothing)
     Scanning Large File <buck@huron.net>
     Re: Scanning Large File (Andreas Schmidt)
     update facility for web site <klowe@iol.ie>
     Update facility for web site <klowe@iol.ie>
     Re: URL for Win32 Perl? <nospam.gibsonc@aztec.asu.edu>
     Using a DB_BTREE as a trie? (Michael Schuerig)
     Re: When to use "use strict" <merlyn@stonehenge.com>
     Re: When to use "use strict" (Andrew M. Langmead)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 26 Aug 1997 12:05:07 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: $#name ????
Message-Id: <3402AA53.2527E3BD@absyss.fr>

denis@mathi.uni-heidelberg.de wrote:
> 
> hi,
> 
> i just tried to read the "far more than everything you've ever wanted
> to know about sorting" www page.
> there i read something like $list[$#list]. i didn't find it in the
> camel book :-( what does $#list mean?
> thanks

Open the camel to p36 and read under "Variables".  $#days is an example
in the table at the top of p37.

- doug


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

Date: Tue, 26 Aug 1997 11:17:46 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: && and associativity
Message-Id: <34039a00.2777172@news.tornado.be>

denis@mathi.uni-heidelberg.de wrote:

>i read in a perlbook (camel or lama) that the expression:
>
>next && ($abc eq "")
>
>should work... but i think because of the left associativity of
>&& it will ignore ($abc eq "") (perl executes next first, and than
>there isnot anythink to compare)
>am i right or not?

You're wrong. There's also the precedence. Associativity only comes into
play when operators have the SAME precedence.

But you're right that it should work without the parentheses as well.
But that is because "eq" has a HIGHER precedence than "&&". See
"perlop.pod".

HTH,
Bart.


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

Date: 26 Aug 1997 12:41:37 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: cardinality of an array given a reference
Message-Id: <nqo4t8dxm3i.fsf@mitra.phys.uit.no>


On Sun, 24 Aug 1997, Tad McClellan wrote:
> >    print "cardinality is ",$#{@$arref},"\n"; 

To which Tom Phoenix <rootbeer@teleport.com> replied:
> Unless one of us has a different definition of cardinality from the other,
> I think you meant this.
> 
>     print "cardinality is ", scalar(@$arref), "\n";

Tom,

Try this:

perl -le '$a=[1..100];print $#{@$a}'

It prints 99, but I don't know why.

perl -le '$a=[1..100];print $#$a'   # prints 99
perl -le '$a=[1..100];print $#{$a}' # ditto

I can understand these, but the one above?

> But I don't think the mistake was (strictly speaking) yours. :-)

Is it a mistake?  If so, where is it?

> Tom Phoenix           http://www.teleport.com/~rootbeer/

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Mon, 25 Aug 1997 19:17:18 -0530
From: Ajitesh Das <ajiteshd@wiproge.med.ge.com>
To: Aaron Newman <newman@ttd.teradyne.com>
Subject: Re: cardinality of an array given a reference
Message-Id: <34022796.ABD@wiproge.med.ge.com>

@{$arref}


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

Date: Mon, 25 Aug 1997 10:14:23 -0700
From: Stephane Richard <srichard@san-jose.ate.slb.com>
Subject: create a file in a user directory by the WEB ?
Message-Id: <3401BD6E.477A5894@san-jose.ate.slb.com>

Please help,

I want to use the vacation program to give to the users the possibility
to enable their vacation files with Netscape. .
I need to create four files in their own directory.
I have try to give to a script the permission of the user, for another
the root permission  I did a setuid in C program,   but it doesn't work

Could somebody help me ?

Stef.



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

Date: Tue, 26 Aug 1997 14:31:03 +0200
From: Arnaud de Wolf <adewolf@itr.ch>
Subject: Re: date & time calculations
Message-Id: <3402CC87.7371DB82@itr.ch>

>         Is there any perl library which is useful for date and time
> calculation. For example, like given a date the perl routines should
> be able to give date, which is 'x' number of days from the given date..

I think you should try the DateCalc-Module, which you find at
ftp://sunsite.cnlab-switch.ch/mirror/CPAN/modules/by-module/Date/DateCalc-3.2.tar.gz

Arnaud


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

Date: Tue, 26 Aug 1997 11:23:47 GMT
From: bobm@cunix.com (Bob Mariotti)
Subject: Detect child timeout (alarm) in perl cgi???
Message-Id: <5tuece$akr@news-central.tiac.net>

Can anyone explain the best way to detect a timeout or alarm of a
called c program used with backticks???
It seems that although the alarm/timeout works in the child, it
appears to be undetectable in the calling process.
TIA

+------------------------------------------------------+
+ Bob Marioti           +  email: rmariotti@cunix.com  +
+ Financial DataCorp    +  voice: (860) 657-8983       +
+ 703 Hebron Avenue     +  fax..: (860) 657-8987       +
+ Glastonbury, CT 06033 +  www..: http://www.cunix.com +
+                                                      +
+ Opinions expressed represent my views and definitely +
+ do represent those of my employer!                   +
+------------------------------------------------------+
 



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

Date: Tue, 26 Aug 1997 11:17:43 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Easy Question: Dont Care.
Message-Id: <34029871.2378691@news.tornado.be>

greg@bic.mni.mcgill.ca (Greg Ward) wrote:

>1) you can give split a maximum number of items to split
>from the string, and
>2) assigning a 34-element array to a one-element
>array means the last 33 elements are simply discarded.  In this case,
>providing a "limit" argument to split will probably be more efficient.
>"man perlsub", or see p. 220 of *Programming Perl, 2nd ed.*

Read that again. It's "perlfunc", btw. It says:

	When assigning to a list, if LIMIT is omitted, Perl supplies a
	LIMITone larger than the number of variables in the list, to
	avoid unnecessary work.

YOU don't have to do it. Perl does it for you.

HTH,
Bart.


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

Date: 26 Aug 1997 10:54:50 GMT
From: "Robert Friberg" <robert.friberg@eductus-vast.com>
Subject: Re: Easy Question: Dont Care.
Message-Id: <01bcb20e$4a0bb9e0$c82da8c0@akilles.ittek.org>


the Thief of Always <omard@blue.seas.upenn.edu> skrev i inldgg
<5tqts1$ole$1@netnews.upenn.edu>...
> 
> whats the dont care variable as in.
> 
> ($wanted, ______I DONT GIVE A SHIT ___) = split (/&/,$_);
> 
> 		^^^^^^ This is what I'm looking for.


If you want the first value as a scalar try:
    $wanted = split(/&/,$_);

If you want some other try:

   ($wanted1,undef,undef,undef,undef,$wanted2) = split(/&/,$_);


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

Date: Tue, 26 Aug 1997 10:17:48 -0400
From: John Henson <johnh@partnersweb.com>
Subject: Email address verification
Message-Id: <3402E58C.41C6@partnersweb.com>

This may seem like a stupid question, but can someone 
tell me how to make sure an email address field in a www form
contains an "@"?.  

Thanks in advance,

j:wq


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

Date: 26 Aug 1997 14:30:24 GMT
From: schmidt@miserv2iai.kfk.de (Andreas Schmidt)
Subject: Re: Email address verification
Message-Id: <5tupa0$ncd$1@nz12.rz.uni-karlsruhe.de>

In article <3402E58C.41C6@partnersweb.com>, John Henson <johnh@partnersweb.com> writes:
|> This may seem like a stupid question, but can someone 
|> tell me how to make sure an email address field in a www form
|> contains an "@"?.  
|> 
|> Thanks in advance,
|> 
|> j:wq

no, this seems to be an lazy question. here an lazy answer:
see PERLRE manual pages and, perhaps a bit later, PERLFAQ(6)

smiff


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

Date: Tue, 26 Aug 1997 15:38:33 +0100
From: Gary Colman <SPAMFREEgary@iafrica.com>
To: John Henson <johnh@partnersweb.com>
Subject: Re: Email address verification
Message-Id: <3402EA69.4B74@iafrica.com>

Hi John

> This may seem like a stupid question, but can someone
> tell me how to make sure an email address field in a www form
> contains an "@"?.
"The only stupid question is that which is not asked"
 
#! /usr/local/bin/perl
print "Please enter your email address: ";
chop($address=<STDIN>);
if ($address =~ /^[^@]+@[^@]+$/) {
  print "$address looks good\n";
} else {
  print "$address requires one @ sign, with characters before it and
after it\n"
}
 
Cheers
  Gary


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

Date: Tue, 26 Aug 1997 07:13:59 -0400
From: Mike Drons <Michael_Drons@ins.com>
To: Danny Aldham <danny@lennon.postino.com>
Subject: Re: Getting started with ODBC.pm on MSsql6.5
Message-Id: <3402BA77.49D5@ins.com>

You can pass it MS Jet SQL statements.  Take a look at
http://w3.one.net/~jhoffman/sqltut.htm

But for a basic query...  
$sql="SELECT * FROM [Table] WHERE ID=2";
$Query->sql($sql);

Insert...
$sql="INSERT INTO [Table] (field1, field2) VALUES ('$String',$Number);
$Query->Sql($sql);

Also look at the ODBC files.

Let me know if you have any other questions.

Mike Drons
Michael_Drons@ins.com

Danny Aldham wrote:
> 
> I have installed activewares perl and the ODBC.pm module onto a NT4
> machine running SQL6.5 . I seem to be able to connect to the database
> using the test.pl program; it passes the tests and finds the tables.
> But that is a far as I get. I cannot figure out the syntac to do my
> own sql queries.  Simple things like create a table, alter a table, or
> insert data into the table. Then maybe do a Query on a column. If someone
> has some simple sample code, it would be very much appreciated.
> 
> --
> Danny Aldham           SCO Ace , MCSE , JAPH , DAD
> I don't need to hide my e-mail address, I broke my sendmail.


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

Date: Tue, 26 Aug 1997 07:22:50 -0400
From: Mike Turk <mturk@globalserve.net>
Subject: Re: HELP! WinNT/perl cgi newbie
Message-Id: <3402BC8A.4499@globalserve.net>

Marty Blase wrote:
> 
> I've been asked to work up a CGI form handler that processes submitted
> data, sorts it, appends it to a tab-delimited text file, and emails the
> results to a specific individual. Simple enough, except that I've always
> done this under UNIX before and I need to work it on a Microsoft IIS
> server running under WinNT.
> 
> From what I understand, perl should pretty much behave the same way as
> under UNIX. What I need to know is the significant differences:


> - what do I put at the top instead of #!/usr/local/bin/perl ?

You don't need that line at all. Perl under NT will look for the file
extension that you have associated with the perl.exe in the registry.

Mike Turk
mturk@globalserve.com


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

Date: 26 Aug 1997 08:42:30 -0400
From: seth@fellspt.charm.net (Seth Perlman)
Subject: Re: Help!! my dbm file crash everytime I try to build it.
Message-Id: <5tuivm$sgn@fellspt.charm.net>

In article <slrn5vro5n.k09.mdkail@dime.fv.com>,
Mike D. Kail <mdkail@fv.com> wrote:
>>I wrote a script to build a database management file for a search
>>routine.
>[...]
>>It works fine for a smally site, but it crashes when the dbm file get
>>big. The error message is as follow :
>>
>>- ndbm store returned -1, errno 28, key "school" at index.pl line 111,
>><file> chunk 52.
>>
>>Any body know what is going on, please help (aung@seattleu.edu).
>
>did you look at what errno 28 is?
>
>   #define ENOSPC  28      /* No space left on device              */
>
>my guess is you're running out of disk space
>
This error msg has nothing to do with actual disk space running out but
rather with the ndbm PAGSIZE and BLKSIZE which is set in the ndbm.h
file.   When enough keys hash to the same .dir file page, it simply fills
up and blows up with error 28. The algorithm doesn't "split" the
page or deal with it gracefully and (I think) appropriately. To be blunt, 
it is an awful bug which you don't have much of a chance of anticipating
except by doing test loads of sample data that has the same key length and
key alphanumerics in it and finding an approximate "blowup point". 

If you can use DB_File or GDBM you may find that these can do what you
need to do without this scalability limit.  
I think SUN should make the PAG and BLKSIZE into parameters to these
functions and to the NIS/yp commands. This list has seen your type of
complaint about dbm scalability time and again(ie, almost a dozen victims
in the last 2 months alone!). 
 ...Seth
-- 
Seth Perlman  Unix/Sybase Consultaant  
6000 Rusk Avenue 
Baltimore, Md. 21209
(410) 358-4355 seth@charm.net


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

Date: Tue, 26 Aug 1997 11:17:49 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Help: Give Perl to an uneducated slob & this is what ya get
Message-Id: <34049b21.3066407@news.tornado.be>

You might reconsider

	$\="\n", $, = ",";

	print  OUTFILE $date,$code,$issuer,$open,$close,$low,$high,$vol;

or even 

	print OUTFILE @fields;

This will NOT put your strings between quotes, however.

HTH,
Bart.


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

Date: Tue, 26 Aug 1997 12:25:49 +0100
From: Gary Colman <colmang@ms.com>
To: "Philip A. Viton" <pviton@magnus.acs.ohio-state.edu>
Subject: Re: incredibly simple question
Message-Id: <3402BD3D.2CB8@ms.com>

Hi Philip

> I'm embarassed to ask this, but I've been working with it for an hour, 
> can't see what's wrong.  The fragment below is designed to say one> 
> print STDERR "\nPlease answer Y or N: ";
> $resp=<STDIN>;
> if ($resp = ~ /^[yY]+/)
>   { print STDERR "Your response was Y\n" }
>   else
>   {print STDERR "Your response wasn't Y\n" }
> 
> Can ayone tell me what I'm doing wrong?  THANKS!

You have a space between the '=' and the '~'
Remove the space to form '=~' and voila!

Cheers
   Gary


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

Date: 26 Aug 1997 10:26:28 GMT
From: schmidt@miserv2iai.kfk.de (Andreas Schmidt)
To: etchen@bnr.ca (Edward Chen)
Subject: Re: Info needed: implementation of hash tables?
Message-Id: <5tub0k$i3m$1@nz12.rz.uni-karlsruhe.de>

In article <5tseou$djh@bcarh8ab.bnr.ca>, etchen@bnr.ca (Edward Chen) writes:
|> I am just curious about how hash tables are implemented in Perl.
|> 
|> --
|> --------------
|> Edward Chen
|> 
|> ESN 39+56439

hello edward,

take a look at the c-code, comming up with your distribution of perl.
the sources for hashes can be found in the files hv.c and hv.h.
it's also not a bad idea to take a look at sv.c and sv.h in which the general
implementation of the SV can be found.


smiff

========================================================================
andreas schmidt                                email: schmidt@iai.fzk.de 
institut fuer angewandte informatik (iai)        phone: +49 7247 82 5714
forschungszentrum karlsruhe gmbh
    - technik und umwelt -       
postfach 3640                                  76021 karlsruhe (germany)



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

Date: 26 Aug 1997 09:49:41 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: list contents of directory...
Message-Id: <5tu8rl$1bo$1@netnews.upenn.edu>

Grepping perlfunc for 'dir' and 'read' returns the readdir() function.
If you want more than just the name, there's a(t least one) way to do
it, but depends exactly what you want. Also, make sure that the
pathname is actually coming by STDIN (dunno how you're accessing your
script, but that wouldn't be a transparent replacement for the default
listing).

David J. Thomas (thomasdj@wam.umd.edu) said:
: Does anyone know a way to look into a specific directory (the path would
: be <STDIN> and print a html file that is nicer than the regular html
: output of a directory... ie say the path is ../info/  The script would
: take this argument
: 
: cd $argument
: 
: and then do a 
: 
: foreach $name(*) {
: print "$name\n";
: }

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Tue, 26 Aug 1997 12:11:22 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: list contents of directory...
Message-Id: <3402ABCA.20672728@absyss.fr>

David J. Thomas wrote:
> 
> Does anyone know a way to look into a specific directory (the path would
> be <STDIN> and print a html file that is nicer than the regular html
> output of a directory... ie say the path is ../info/  The script would
> take this argument
> 
> cd $argument
> 
> and then do a
> 
> foreach $name(*) {
> print "$name\n";
> }
> 
> this way I could print it out with a background and in tables... however
> I wish.  I just can't get past this part.. that's all
> 
> thanks for the help..

Look up opendir() in the docs.  Throw in a grep() if you like.

- doug

PS - You could also use file globbing, but I don't think that is such a
hot idea.  I don't trust csh anymore.  Too many problems with it.


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

Date: Tue, 26 Aug 1997 15:50:21 +0100
From: Gary Colman <SPAMFREEgary@iafrica.com>
To: thomasdj@wam.umd.edu
Subject: Re: list contents of directory...
Message-Id: <3402ED2D.3F95@iafrica.com>

Hi David

> Does anyone know a way to look into a specific directory (the path
> would be <STDIN> and print a html file that is nicer than the
> regular html output of a directory... ie say the path is ../info/ 

#! /usr/local/bin/perl
print "Please enter directory name: ";
chop($dirname=<STDIN>);
opendir(DIRHANDLE,"$dirname") || die "Having a problem with $dirname\n";
@files=readdir(DIRHANDLE);
foreach $filename (@files) {
  print "$filename\n";
}
closedir(DIRHANDLE);

Cheers
  Gary

--
   Please remove 'SPAMFREE' from my email addy before sending replies


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

Date: Tue, 26 Aug 1997 09:42:34 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: Online Help for beginners in Perl
Message-Id: <5tupqe$aj2@newsops.execpc.com>

 Hi,
I have a beginners guide to Perl and CGI programming at:
http://www.webdesigns1.com/perl/

--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com

Song wrote in article <3401B26A.1229F800@halcyon.com>...

>Hello,
>  I wonder if there is an in-depth web page for beginners in Perl to
>learn it and then be able to apply it to their web page. Please cc: your
>response to sleigh@halcyon.com.
>
>Song




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

Date: Tue, 26 Aug 1997 09:37:57 -0500
From: Ed Jamison <edwardj@hmsmch.cncoffice.com>
Subject: Perl (kind of) math question.
Message-Id: <3402EA44.1E7B1682@hmsmch.cncoffice.com>

I just started learning Perl.  I got a "Learn Perl in 21 days book.  I
got to the third day with no problems.  Then they introduced octal and
hexidecimal notation.  Unfortunately I slept through Calculus (as well
as a lot of the rest of my first 2 years of college, and I missed any
info on these types of notations.  The book I have supplies a quick
"tutorial", but I'd like to get some more in depth information.  I like
to have a thorough understanding of something before I have to work with
it.  My question is, where is a good source of information on this,
preferably on the web?

Thanks for your time and sorry of the (sort of) off topic question...

Ed Jamison



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

Date: Tue, 26 Aug 1997 11:38:05 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: perl bug in pushing anonymous arrays??
Message-Id: <3402A3FD.35B06B03@absyss.fr>

Curtis Hrischuk wrote:
> 
> Hi.  The following two code segments are not equivelant:
> 
> ================================================================
> Segment #1:
>       my(@item) = (ref($$redge), $rserver_entry);
>       push(@ar1, \@item);
> 
> This pushes a reference to an array onto @ar1, which is what I want.
> 
> ================================================================
> Segment #2:
>       push(@ar1, \(ref($$redge), $rserver_entry));
> 
> Segment #2 flattens the array @ar1, appending the items; it does not
> create the reference to the anonymous array. Is this a bug?


Nope, working as documented in the perlref man page.  Note this little
snippet that is the crux of your misunderstanding

           Note that taking a reference to an enumerated list is
           not the same as using square brackets--instead it's
           the same as creating a list of references!

               @list = (\$a, \@b, \%c);
               @list = \($a, @b, %c);      # same thing

To make something that acts like #1 that looks like #2

	push(@ar1, [ref($$redge), $rserver_entry]);

NOTE: you say "reference to the anonymous array" when you never create
one.  It is not possible to create an anonymous array by any means other
than [] (although you might be able to fake one with other tricks, lets
not go down that path).

I hope that this helps.

- doug


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

Date: Tue, 26 Aug 1997 14:01:16 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: perl bug in pushing anonymous arrays??
Message-Id: <EFIxM4.6I5@world.std.com>

Curtis Hrischuk <ceh@suntan.sce.carleton.ca> writes:
>================================================================
>Segment #2:
>      push(@ar1, \(ref($$redge), $rserver_entry));

>Segment #2 flattens the array @ar1, appending the items; it does not
>create the reference to the anonymous array. Is this a bug?

According to the perlref man page, and the Camel book, page 246, a
backslash preceding a parenthesized list creates references for each
element in the list.

@list = (\$a, \$b, \$c);
is the same as:
@list = \($a, $b, $c);

what I think you want is to create an anonymous reference to an array.

      push(@ar1, [ref($$redge), $rserver_entry]);

-- 
Andrew Langmead


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

Date: 26 Aug 1997 14:25:59 GMT
From: dennis@csie.nctu.edu.tw ()
Subject: Perl Regular Expression has a bug?
Message-Id: <5tup1n$cnd$1@news.ncu.edu.tw>

See my program:
#!/usr/bin/perl
$date = localtime();
print "$date\n";
if($date = ~/(..):(..):(..)/)
{
 print "Now \$date = $date\n";
 print "Time: $1:$2:$3\n";
} 

And the output is very strange, Why?
Tue Aug 26 22:32:25 1997
Now $date = 4294967295
Time: ::  


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

Date: 26 Aug 1997 14:39:27 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Perl Regular Expression has a bug?
Message-Id: <5tupqv$82t$1@dismay.ucs.indiana.edu>

In article <5tup1n$cnd$1@news.ncu.edu.tw>,
	dennis@csie.nctu.edu.tw () writes:
>See my program:
>#!/usr/bin/perl
>$date = localtime();
>print "$date\n";
>if($date = ~/(..):(..):(..)/)
	   ^^ should be =~ as a single symbol, not "= ~"

-- 
Brian Wheeler
bdwheele@indiana.edu


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

Date: Mon, 25 Aug 1997 14:06:47 -0700
From: sharlin@cybernautics.com
Subject: perl shareware resource
Message-Id: <3401F3E7.7F4F@cybernautics.com>

Maybe you've found this site already, but I found a list of perl apps at
the Dave Central Software Archive. They have Big Perl for Win 3.x,
cgi-lib.pl, cgi.pm, Form2mail, Gtml, Perl for Win32, and Unix2PC 32-bit.

The URL is http://www.davecentral.com. I refer to this site a lot--hope
it's of use to you too.

Best,
Susan
Cybernautics, Inc.


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

Date: Tue, 26 Aug 1997 08:10:30 -0700
From: Webmaster <webman@vsgcom.com>
Subject: Premature End Of Script Headers?
Message-Id: <3402F1E6.7F76@vsgcom.com>

Hello All,

   I've just recently begun working with perl as a CGI and though I've
got the majority of the language down pat, I've come across an
interesting delimma while trying to write a simple shopcart script that
I've been boggled by for weeks. Initially I started the script to be a
nice, small neat little package and was getting a "premature end of
script headers" error... that was three weeks ago... since then I have
taken my nice, neat little script and turned it into a repetitive
monster taking several approaches to it's method of execution (i.e. all
subroutines vs. if control blocks) and am still running into the same
problem. I've checked file permissions and all that... and have even
gone as far as hard coding the HTML into the script itself to avoid any
possible problems I was overlooking with external files... I've searched
the man pages and have tried to find the answer to this problem (which I
am sure is simple!)... I've gone over the control structure several
times and by all rights the program should work... it's based on an
origianlly working cookie script that I wrote a couple months ago... Any
ideas what I am overlooking would be greatly appreciated. I'd include a
copy of the script here, but it's way too long now <g> (17k!) - but I'm
open to some debug suggestions that anyone may have from thier own
experience with this error... Thanks in advance for your help.

Sincerely,
Denard Springle
http://www.vsgcom.com/
webman@vsgcom.com


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

Date: Tue, 26 Aug 1997 10:02:43 -0500
From: gabe@sover.net (Apropos of Nothing)
Subject: Safe Perl Programming Manual?? Book???
Message-Id: <gabe-2608971002430001@pm1a11.bratt.sover.net>

I'm looking for manuals and/or books that programming guidlines... It
would have info such as:

Calls that fork a shell, how to work around them
Calls that can overflow a buffer, alternative calls
Etc...

Does anyone know of such a book?

I'm also looking for info for perl and shell, and C.

Thanks in advance,

gabe


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

Date: Tue, 26 Aug 1997 08:43:16 -0400
From: Stephen Hill <buck@huron.net>
Subject: Scanning Large File
Message-Id: <3402CF63.1F9407D6@huron.net>

Is there a way to scan a large file without reading the entire file into
memory.

I have a file which is about 30meg, I want to be able to do a simple
search on the data. My system doesn't have enough memory to handle this.
Is there a way to read one line of the file into memory at a time?





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

Date: 26 Aug 1997 13:43:40 GMT
From: schmidt@miserv2iai.kfk.de (Andreas Schmidt)
To: Stephen Hill <buck@huron.net>
Subject: Re: Scanning Large File
Message-Id: <5tumic$m7j$1@nz12.rz.uni-karlsruhe.de>

In article <3402CF63.1F9407D6@huron.net>, Stephen Hill <buck@huron.net> writes:
|> Is there a way to scan a large file without reading the entire file into
|> memory.
|> 

[snip]

hola stephen,

take a look in the perlfaq(5) manual pages. there are a lot of useful tips about
files and formats.

smiff

========================================================================
andreas schmidt                                email: schmidt@iai.fzk.de 
institut fuer angewandte informatik (iai)        phone: +49 7247 82 5714
forschungszentrum karlsruhe gmbh
    - technik und umwelt -       
postfach 3640                                  76021 karlsruhe (germany)


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

Date: 26 Aug 1997 12:49:04 GMT
From: "Kevin Lowe" <klowe@iol.ie>
Subject: update facility for web site
Message-Id: <01bcb21e$5c53f3a0$1c297dc2@solomonsol>

Hello,

Does anyone know how I would go about creating a perl program to enable
someone (the owner) to update a web site by just visiting the site and
filling out a form. I am thinking along the lines of the contents of the
form being stored in a data file and then writing each record of the file
to a HTML document on the fly. I am new to Perl, so I would be very
grateful for any ideas. Has anyone written a similar program as freeware or
shareware before? 

Also, can anyne recoment a good perl book?

The server I'm using is unix/apache/perl 5. 

Thanks,

Kevin lowe.



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

Date: 26 Aug 1997 12:46:15 GMT
From: "Kevin Lowe" <klowe@iol.ie>
Subject: Update facility for web site
Message-Id: <01bcb21c$77de0a40$LocalHost@solomonsol>

Hello,

Does anyone know how I would go about creating a perl program to enable
someone (the owner) to update a web site by just visiting the site and
filling out a form. I am thinking along the lines of the contents of the
form being stored in a data file and then writing each record of the file
to a HTML document on the fly. I am new to Perl, so I would be very
grateful for any ideas. Has anyone written a similar program as freeware or
shareware before? 

Also, can anyne recoment a good perl book?

The server I'm using is unix/apache/perl 5. 

Thanks,

Kevin lowe.


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

Date: Tue, 26 Aug 1997 07:11:01 -0700
From: Gip <nospam.gibsonc@aztec.asu.edu>
To: bill@chirons.demon.co.uk
Subject: Re: URL for Win32 Perl?
Message-Id: <3402E3F5.4D37@aztec.asu.edu>

Bill Hey wrote:

I only use a nt 4.0 machine, and I got perl 5.004 build 306 from
www.activeware.com.  Should work for you and win95?


Did your search include the news groups?(aka usenet)  Most search
engines default to web only, but have a option for doing both.  Much
specific info can be found searching usenets, I usually just enter the
'error message', then get hits on faqs...

CG

> 
> Hi Folks,
> 
> I've not managed to find a site  which has the Win32 Perl
> (precomplied/built) for Win95 to download.
> 
> The search engines have led me a merry dance.
> 
> Please help folks,
> 
> Regards,
> 
> MWH
> --
> PGP Key fingerprint =
> 39 78 A9 62 76 1F 76 10  31 8C 4C B9 E3 18 B3 A5
> Key available on request.


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

Date: Tue, 26 Aug 1997 13:31:39 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Using a DB_BTREE as a trie?
Message-Id: <19970826133139378590@rhrz-isdn3-p13.rhrz.uni-bonn.de>


I'm casually working on an indexing search engine (you guessed it). I'd
like to allow searching for prefixes. Currently I keep an inverted word
index in a hash, but a b-tree is more suitable for simulating a trie.
With a custom compare function it's easy to find *an* entry that matches
the prefix, but (from my understanding of DB_File) I need to get the
*first* matching entry so that I can access further ones sequentially. 

Any help is appreciated.


Michael

P.S.: Yes, this thing will be freely available when it's done; but, no,
not yet.

--
Michael Schuerig                     I am the sum total of the
mailto:uzs90z@uni-bonn.de            parts I control directly.
http://www.uni-bonn.de/~uzs90z/             -Daniel C. Dennett


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

Date: 26 Aug 1997 07:13:33 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: joshp@silmaril.com (Josh Purinton), <david_ransier@intercept.com>
Subject: Re: When to use "use strict"
Message-Id: <8cbu2lvxpu.fsf@gadget.cscaper.com>

>>>>> "Josh" == Josh Purinton <joshp@silmaril.com> writes:

>> Should I use Package identifiers and fully qualify variable names?

Josh> Either that or use the 'vars' module described above.

Actually, I'd recommend neither of those.  Use lexical variables when
possible.  They're faster to access, and trivial to declare (my $foo =
"initial value";).  Use package variables (fully qualified or
use-var'ed) only when others outside the current file need to access
the variable.

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

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.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: Tue, 26 Aug 1997 14:08:11 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: When to use "use strict"
Message-Id: <EFIxxo.ECI@world.std.com>

uzs90z@uni-bonn.de (Michael Schuerig) writes:
>Josh Purinton <joshp@silmaril.com> wrote:

>> Declare variables global to a package with 'use vars', e.g.
>> 
>>   package MyPackage;
>>   use vars qw/$foo @bar %baz/;

>Is there a difference or advantage to writing it as

>    pacackge MyPackage;
>    my $foo;
>    my @bar;
>    my %baz;

Yes, in the first example, the variables are associated with a
particular package. Anywhere else in the program, you can say
$MyPackage::foo and change it. 

In the second example, the variables are lexically scoped, (with the
scope being the current file.) You can change packages within the
file, and $foo will still refer to the same $foo. You can enter the
package MyPackage in another file, and you still won't get access to
$foo.
-- 
Andrew Langmead


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 923
*************************************

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