[7595] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1221 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 23 17:07:13 1997

Date: Thu, 23 Oct 97 14:00:28 -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           Thu, 23 Oct 1997     Volume: 8 Number: 1221

Today's topics:
     Re: Creating perl doc. in HTML format <ajohnson@gpu.srv.ualberta.ca>
     Re: Deleting first line (John Moreno)
     Difference between 2 times & dates <jseals@oir.state.sc.us>
     Re: Difference between 2 times & dates (Faust Gertz)
     GIFs and oraPerl clevine@flycast.com
     Help with deleting files <girardj@primenet.com>
     Re: Help with deleting files (Jeremy D. Zawodny)
     Re: help- Using Mat scripts (Jeremy D. Zawodny)
     Re: help: perl and SMTP <usenet-tag@qz.little-neck.ny.us>
     How do you use Safe.pm? <pr1@club-internet.fr>
     London, England - Manager; Database/Infrastructure <hcondon@ix.netcom.com>
     London, UK - Database Developer <hcondon@ix.netcom.com>
     London-UK-Database Administrator <hcondon@ix.netcom.com>
     Re: Most efficient way to parse large text files <jewell@halcyon.com>
     Re: Most efficient way to parse large text files <usenet-tag@qz.little-neck.ny.us>
     Re: Newbie Question : remove files named $files (Faust Gertz)
     NY, NY - Database Developer; Sybase <hcondon@ix.netcom.com>
     Re: OR v. Randal: Employees have no 1st Amendment Right (Jeremy Nelson)
     Re: Perl5.003 source ??? <khera@kciLink.com>
     Re: Precompiling PERL Scripts..... <khera@kciLink.com>
     Primes via regexen (Was: Re: non-greedy regexps) (John L. Allen)
     Re: Problem with Getopt::std <jstern@world.northgrum.com>
     Re: Problem with Getopt::std <jstern@world.northgrum.com>
     Problems with $ARGV (Mark Schunder)
     Re: Problems with $ARGV (Mike Stok)
     Re: Q: Webserver for Win95? (Jeremy D. Zawodny)
     Re: s/ / /g or tr/ / / what is the difference? (Rob Davis)
     Re: s/ / /g or tr/ / / what is the difference? (Rob Davis)
     Re: s/ / /g or tr/ / / what is the difference? (Faust Gertz)
     Safe.pm and making eval safe <pr1@club-internet.fr>
     snprintf problems under Solaris 2.5.1 <aholtz@network1.net>
     sockets <joes@wpi.edu>
     Tokyo, Japan - Application Programmer; C, C++ <hcondon@ix.netcom.com>
     Tokyo, Japan - Application Programmer; Perl/Sybase <hcondon@ix.netcom.com>
     Tokyo, Japan - Application Programmer; Sybase <hcondon@ix.netcom.com>
     Using // Gerben_Wierda@RnA.nl
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 23 Oct 1997 13:35:30 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Creating perl doc. in HTML format
Message-Id: <344FA702.166601F5@gpu.srv.ualberta.ca>

indhiraa@hotmail.com wrote:
> 
> Hi All:
> 
> Is there any utility to create documentation of PERL source
> code in HTML format from Perl pod format.
> 

man pod2html  or   perldoc pod2html

should tell what you want to know if Perl has
been installed properly on your system.

regards
andrew


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

Date: Thu, 23 Oct 1997 15:22:54 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: Deleting first line
Message-Id: <1997102314573955548960N@roxboro-167.interpath.net>

Gary Yasuda <yasuda@pacbell.net> wrote:

] Through PERL, I am putting tables on the web, and the tables are 
] contained in ASCII text files.  I am translating the tables through
] Adobe Acrobat into PDF, so that they can be viewed on the web using
] Adobe Acrobat Reader.  The database for some reason puts a page break
] (^L) on the very first line of each text file I translate, so the
] first page is always blank.  I always get calls that the translation
] did not work when the first thing people see is a blank page, but
] every page after that is fine.
] 
] Is there some way in PERL 5.004 of just stripping off the first 
] entire line of each text file or just stripping the first ^L read in
] prior to running them through Adobe Acrobat?  I experimented with
] some of the pattern matching features of PERL to get rid of the first
] ^L character, but I ended up replacing all the ^L characters
] throughout the entire text file.


Are the files very large?  If not this should work

$filename="putyournamehere";
open(A,"$filename") || die "cannot open file: $!\n";
undef $/;
$_=<A>;
s/\^L//;

$tempfile="temp";
open(T,">$tempfile") || die "cannot create temp file: $!\n";
print T $_;

close A;
close T;

or maybe something like:

open(A,"$filename") || die "cannot open file: $!\n";
s/\^L//;
print T $_;
while <A> {
 print T$_;
}

unless the g is used, as in s/\^L//g substitution only works on the
first occurance.

-- 
John Moreno


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

Date: 23 Oct 1997 18:40:54 GMT
From: "Jim Seals" <jseals@oir.state.sc.us>
Subject: Difference between 2 times & dates
Message-Id: <01bcdfe2$eb1eabb0$f50107a7@canberra>

Does anyone have a perl script or know where I can find one that calculates
the diffence  between to times. I am trying to calculate how long ago an
event occurred from the present time in days, hours, and minutes.

Thanks for any help
Jim
jseals@oir.state.sc.us


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

Date: Thu, 23 Oct 1997 19:38:32 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Difference between 2 times & dates
Message-Id: <3451a638.4734754@news.wwa.com>

On 23 Oct 1997 18:40:54 GMT, "Jim Seals" <jseals@oir.state.sc.us>
wrote:

>Does anyone have a perl script or know where I can find one that calculates
>the diffence  between to times. I am trying to calculate how long ago an
>event occurred from the present time in days, hours, and minutes.

>From the perl FAQ (http://language.perl.com/faq/):

:How can I compare two date strings? 
:
:Use the Date::Manip or Date::DateCalc modules from CPAN. 

and before you ask:

:What modules and extensions are available for Perl? What is CPAN? What
:does CPAN/src/... mean? 

:CPAN stands for Comprehensive Perl Archive Network, a huge archive replicated on dozens of machines all over the world.
:CPAN contains source code, non-native ports, documentation, scripts, and many third-party modules and extensions, designed for
:everything from commercial database interfaces to keyboard/screen control to web walking and CGI scripts. The master machine
:for CPAN is ftp://ftp.funet.fi/pub/languages/perl/CPAN/, but you canuse the address http://www.perl.com/CPAN/CPAN.html to
:fetch a copy from a ``site near you''. See http://www.perl.com/CPAN (without a slash at the end) for how this process works. 
:
:CPAN/path/... is a naming convention for files available on CPAN sites. CPAN indicates the base directory of a CPAN mirror,
:and the rest of the path is the path from that directory to the file. For instance, if you're using
:ftp://ftp.funet.fi/pub/languages/perl/CPAN as your CPAN site, the file CPAN/misc/japh file is downloadable as
:ftp://ftp.funet.fi/pub/languages/perl/CPAN/misc/japh . 
:
:Considering that there are hundreds of existing modules in the archive, one probably exists to do nearly anything you can think of.
:Current categories under CPAN/modules/by-category/ include perl core modules; development support; operating system
:interfaces; networking, devices, and interprocess communication; data type utilities; database interfaces; user interfaces; interfaces
:to other languages; filenames, file systems, and file locking; internationalization and locale; world wide web support; server and
:daemon utilities; archiving and compression; image manipulation; mail and news; control flow utilities; filehandle and I/O; Microsoft
:Windows modules; and miscellaneous modules. 


HTH

Faust Gertz
Philosopher at Large


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

Date: Thu, 23 Oct 1997 15:04:57 -0600
From: clevine@flycast.com
Subject: GIFs and oraPerl
Message-Id: <877630016.5205@dejanews.com>

Greetings.

I've run into a bit of a snafu and have exhausted most means of trying to
make this work.

I'm uploading images via a form.  The uploading bit is working fine as i
can can store and retireve the image on the target machine.

The problem occurs when trying to grab the image and insert it into oracle
via oraperl.

I've tried reading the image data into a buffer and printing that back out
into a scalar to insert in the ora_open insert statement.


Anyone done something like this, or could help me out with a snippet of
code to accomplish this?

thanks much.

-- chris

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 23 Oct 1997 12:21:01 -0700
From: "Jeff Girard" <girardj@primenet.com>
Subject: Help with deleting files
Message-Id: <01bcdfe8$fbcc2cc0$78da1b8a@girardj.army.mil>

I need a routine that will go through a directory and delete all of the
files in that directory and then delete the directory itself.

I know how to delete the empty directory using rmdir ()

I have looked through the WIN32 documentation that came with the ActiveWare
download and also on the CPAN pages.  I have not yet found a command to
delete files.

Can someone tell me the command and the syntax to delete a file, or better
yet, does someone already have a routine to do this that I can have?

Jeff


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

Date: Thu, 23 Oct 1997 20:36:15 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Help with deleting files
Message-Id: <3450b511.17938003@igate.hst.moc.com>

[cc'd automagically to original author]

On 23 Oct 1997 12:21:01 -0700, "Jeff Girard" <girardj@primenet.com>
wrote:

>I need a routine that will go through a directory and delete all of the
>files in that directory and then delete the directory itself.
>
>I know how to delete the empty directory using rmdir ()
>
>I have looked through the WIN32 documentation that came with the ActiveWare
>download and also on the CPAN pages.  I have not yet found a command to
>delete files.

You need to look at the non-Win32-specific docs. Look at the Perlfunc
manual page. Especially the part about unlink().

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 23 Oct 1997 20:32:25 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: help- Using Mat scripts
Message-Id: <344fb3ff.17664149@igate.hst.moc.com>

[cc'd automagically to original author]

On 23 Oct 1997 18:27:17 GMT, "Nathan & Angela Carnahan"
<nathanc@bright.net> wrote:

>Hello I am using Matt Scripts free for all links and I want to change the
>URL to accept and open up an email box. What kind of code do I need to
>write to open up an email box in Perl??????

I'm afraid you're gonna need to be A LOT more specific than that. What
is it (in plain English) that you are trying to do? What does the
relevant code look like (and don't post 500 lines of code)?

What have you tried already (if anything)?

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: 23 Oct 1997 20:14:34 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: help: perl and SMTP
Message-Id: <eli$9710231550@qz.little-neck.ny.us>

In article <344EB6B4.D512E779@scbbs.com>, Ron Parker  <sysop@scbbs.com> wrote:
> Yep, thats simple:  But can you include an attachment at the command line, or
> using perl?  If so, can you point me to a document where I can figure out how
> to do this?  Thanks.

*Attachments are trivial.* Read RFC 1341 for the cannonical source,
but basically it works like this. Encode your file (see the MIME::
module) then make just include it with a few special headers and
some delimiting strings.

>From a post I made about two weeks ago (this time indented so some
broken newsreaders do not find attachments in this), the MIME::Base64
encoded file is assumed to be in $File:

  open(MAIL,"|sendmail -t") || die "Nobody shot me. -- Frank Gusenburg\n";

  print MAIL <<EndOfMail
  To: $useraddress
  Subject: your file sir/ma'am
  MIME-Version: 1.0
  Content-Type: multipart/mixed; boundary="my-unique-string"

  This is a MIME multipart message. MIME aware tools will hide this
  text from you normally.

  --my-unique-string
  Content-Type: text/plain
  Content-Transfer-Encoding: 7bit

  Dear Sir or Ma'am:
  Here's your file.
  Enjoy.

  --my-unique-string
  Content-Type: application/unknown
  Content-Transfer-Encoding: base64

  $File

  --my-unique-string--
  EndOfMail

	  && close MAIL;

This has a preamble that is hidden in MIME aware tools, a text message,
and an arbitrary attachment. You may wish to use a Content-Disposition:
header on the base64 part to specify "inline" or "attachement" and an
optional suggested filename if the latter. You should probably lookup
the correct Content-Type for your attachment as well; that will help
people decode it correctly.

Open some email with attachments in a good text editor some time and
look at how it is assembled.

Elijah
------
mostly deals with text attachments in his stuff


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

Date: Wed, 22 Oct 1997 09:25:44 +0100
From: Philippe de Rochambeau <pr1@club-internet.fr>
Subject: How do you use Safe.pm?
Message-Id: <344DB886.C558C14C@club-internet.fr>

Could someone please explain to me how to use Safe.pm (I find the
Safe.pm documentation incomprehensible) and provide a simple example of
how to make variables and the eval function safe in a CGI script using
Safe.pm?

Many thanks.

Philippe de Rochambeau



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

Date: 23 Oct 1997 20:29:26 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: London, England - Manager; Database/Infrastructure
Message-Id: <01bcdff1$15917d60$LocalHost@default>

Manager; Database/Infrastructure
London, England

Scope:
Global financial firm is currently seeking an experienced manager for its
database administration and database development groups in its London
office.  Candidate should be able to manage small groups of people, provide
training, and play a lead technical role in many different groups.

Qualifications:
Requires prior management experience as well as hands on experience as both
a developer and administrator with Sybase or Oracle.  Ideally, candidate
will have experience in a financial firm.  Candidate should also have
knowledge of replication servers.

Other:
Positions are permanent.  University degree is required.
JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529




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

Date: 23 Oct 1997 20:29:15 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: London, UK - Database Developer
Message-Id: <01bcdff0$25981440$LocalHost@default>

Database Developer; Sybase
London, England

Scope:
Major financial firm is currently seeking individual contributors for its
database development group in London.  The group is responsible for
developing both front and back office applications.

Qualifications:
Candidates must have at least two years experience working in a financial
firm and extensive experience with either Sybase or Oracle.  Knowledge of
Corba is helpful.  Individuals must have prior development experience with
very large databases of at least 100 gigs.  Experience with replication
servers is a plus.  Experience with both Sun and PC's preferred.

Other:
Positions are permanent.  University degree is required.

JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529



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

Date: 23 Oct 1997 20:29:14 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: London-UK-Database Administrator
Message-Id: <01bcdfef$eb06cb00$LocalHost@default>

Data Base Administrator
London, England

Scope:
Global financial firm has immediate openings for experienced database
administrators in its London office.  Candidate will be responsible for
managing small groups of people, training, and playing the lead technical
role in many different projects.

Qualifications:
Requires prior Sybase or Oracle database administration experience. 
Ideally the candidate will be hands on and have experience working in a
financial firm.  Requires experience with Sun and PC's in addition to one
or more of the following: SQL, Perl, C, Powerbuilder, and HTML.

Other:
Position is permanent.  University degree is required.

JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529



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

Date: Thu, 23 Oct 1997 11:58:29 -0700
From: "Cal..." <jewell@halcyon.com>
To: Mark Tripod <mark@exodus.net>
Subject: Re: Most efficient way to parse large text files
Message-Id: <344F9E54.EE5592F2@halcyon.com>

[mailed and posted]

Mark Tripod asked:
> 
> (\d+) implies that bytes count is always at two digits, correct?

No.

My reading of the perlre man page says the the "+" quantifier will
take one or more matches. So \d+ says one or more digits.

-- 
Cal...                    2*3*3*37 : The Prime Factorization of The Beast

jewell@halcyon.com


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

Date: 23 Oct 1997 20:43:16 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Most efficient way to parse large text files
Message-Id: <eli$9710231628@qz.little-neck.ny.us>

Mark Tripod  <mark@exodus.net> wrote:
> (\d+) implies that bytes count is always at two digits, correct?

No. It means there always will be at least one digit.

Elijah
------
s/[+]/{2,}/; # for two or more


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

Date: Thu, 23 Oct 1997 19:06:03 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Newbie Question : remove files named $files
Message-Id: <344f9d40.2440757@news.wwa.com>

On 23 Oct 1997 11:01:45 +0200, haroldkl@stack.nl (Harold Kloosterhof)
wrote:

>I want to use a
>variable named $files to delete some files.
>I knew that 'unlink </www/dir1/*.blah.*>' would do the trick,
>but that is not what I want, because the program figures out
>the 'blah' thing, not me the programmer.
>
>$dir="/www/dir1/";
>$id="blah";
>$namepart=".".$id."."; 
>$files=$dir."*".$namepart."*";
>unlink (<$files>)
>
>does not work

Ok, replace the last line with

:unlink glob $files;

and let me know if it works.  Even if 'unlink (<$files>)' did work, it
would fail under strict 'refs' anyway.  


Sorry about misinterpreting your question.

Faust Gertz
Philosopher at Large


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

Date: 23 Oct 1997 20:29:21 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: NY, NY - Database Developer; Sybase
Message-Id: <01bcdff0$5a3ca440$LocalHost@default>

Database Developer; Sybase
New York, NY

Scope:
Major financial firm is currently seeking individual contributors for its
database development group in New York.  The group is responsible for
developing both front and back office applications.

Qualifications:
Candidates must have at least two years experience working in a financial
firm and extensive experience with either Sybase or Oracle.  Knowledge of
Corba is helpful.  Individuals must have prior development experience with
very large databases of at least 100 gigs.  Experience with replication
servers is a plus.  Experience with both Sun and PC's preferred.

Other:
Position is permanent.

JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529



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

Date: 23 Oct 1997 20:17:27 GMT
From: nelson@cs.uwp.edu (Jeremy Nelson)
Subject: Re: OR v. Randal: Employees have no 1st Amendment Rights
Message-Id: <62obcn$r63$1@news.inc.net>

Nathanael T. Brooks-English <nenglish@geo.Arizona.EDU> wrote:
>To whom it may concern,
>	I was very interested to read the post concerning Mr. Randall.
>Please elaborate on the facts of the case as you know them.  Was he trying
>to crack a security network, or did he just write a report listing the
>weaknesses of the Intel Security.  

http://www.lightlink.com/fors/

-j


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

Date: 23 Oct 1997 15:00:19 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: Perl5.003 source ???
Message-Id: <x767qomhj0.fsf@kci.kciLink.com>

>>>>> "DM" == David Mayerlen <tbag@interlog.com> writes:

DM> : Why not use 5.004 anyway? Is there something wrong with it?

DM>  There is probably nothing wrong with perl5.004, but a major web-ecommerce
DM> application was put through weeks of testing on perl5.003 and from
DM> Management's point of view, changing to perl5.004 will require re-testing
DM> of the application. At this point, we just want to recompile perl5.003
DM> with a better compiler and ensure optimal compile time options to squeeze
DM> as much performance as we can out of it. The application is running a
DM> little slower than was promised to the customer!

And doing this wouldn't require retesting the whole thing?  You seem
to trust changing your C compiler more than you trust changing your
Perl.  I wonder from where the logic of this comes.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-258-8292
PGP/MIME spoken here              http://www.kciLink.com/home/khera/


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

Date: 23 Oct 1997 15:06:07 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: Precompiling PERL Scripts.....
Message-Id: <x74t68mh9c.fsf@kci.kciLink.com>

>>>>> "RS" == Richard Secor <rich@imedianet.com> writes:

RS> I know there's a way to do this so I'm asking,
RS> how do you compile PERL scripts into executables so they run faster

RS> (Yes, I do a lot of search engine and HTML re-writing scripts.)

I'm guessing here, but it seems that you are writing CGI programs.  If
so, investigate mod_perl extension to the Apache web server at

  http://apache.perl.org/

If not, then the other answers are the best you're gonna get.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-258-8292
PGP/MIME spoken here              http://www.kciLink.com/home/khera/


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

Date: 23 Oct 1997 13:53:10 -0400
From: allen@gateway.grumman.com (John L. Allen)
Subject: Primes via regexen (Was: Re: non-greedy regexps)
Message-Id: <62o2u6$24a@gateway.grumman.com>

In article <slrn64sgsv.qp.abigail@betelgeuse.wayne.fnx.com>,
Abigail <abigail@fnx.com> wrote:

>perl -wle 'print "Prime" if (1 x shift) =~ /^(?!(11+)\1+$)/'

	Cooool.

exec >/dev/null

N=$1

time perl -le '$N = shift; while ($_.=1, $n++<$N) {
  print $n if /^(?!(11+)\1+$)/ }' $N

time perl -le '$N = shift; while ($_.=1, $n++<$N) {
  print $n if !/^(11+?)\1+$/ }' $N

time perl -le '$N = shift; while ($_.=1, $n++<$N) {
  print $n if !/^(11{1,${\int sqrt length}}?)\1+$/ }' $N

For N=3000, I got real times of

	1m36.93s
	0m43.57s
	0m30.32s

John.
-- 
_/JohnL\_allen@gateway.grumman.com <Sun>: 9.5 billion pounds per sec to energy
~\Allen/~Fax: 516-575-7428    <Universe>: 1e22 stars = 22 solar masses per sec


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

Date: Thu, 23 Oct 1997 18:54:22 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Problem with Getopt::std
Message-Id: <344F9D5E.4B97@world.northgrum.com>

Dave Barnett wrote:
> 
> I believe I am using Getopt::std correctly, but am getting what I
> believe are incorrect results.
> 
> I am unable to get a single character option to work properly.
> 
> For example:
> 
> #!/usr/local/bin/perl -w
> #
> use strict;
> use diagnostics;
> use Getopt::std;

That's getopt::Std.

> getopt('h');

`getopt' or `getopts'?  They differ.  See the Getopt::Std documentation.
I think this is the problem.

> if (defined($::opt_h) {

Missing right parenthesis.

>         $::opt_h = "";
>         USAGE();
> }

> sub USAGE {
>         print STDOUT ("usage: $0: [-h] [other options]\n");
>         print STDOUT ("         -h     Print this help message.");
>         exit 1;
> }
> 
> __END__

I advise you to cut-and-paste from a working program. Typos in
code dissuade many people from helping you.

Good luck!

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: Thu, 23 Oct 1997 19:23:07 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Problem with Getopt::std
Message-Id: <344FA41B.7CC5@world.northgrum.com>

Jim Stern wrote:
 
> Dave Barnett wrote:
[elided]

Sigh, ...  I typed

> 
> That's getopt::Std.

to correct the original poster's capitalization.  He was wrong.
So was I -- Getopt.

Sorry about the slip of the fingers.  And in a post where I decried
typos yet!

-- 
Jim Stern -- Views here are my own, not Northrop Grumman's.   (El
Segundo, CA)


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

Date: Thu, 23 Oct 1997 22:54:52 GMT
From: mschunder@cybernet.com (Mark Schunder)
Subject: Problems with $ARGV
Message-Id: <62oacc$9r1@gateway.cybernet.com>


One of the program arguments that I have in my script is a filename.
The problem that I am having is that I would like the user to input
the filename anyway they want.  This includes with/without file
extentions and wildcards.  When the user types in for instance pres4*
as a program argument, the perl script returns "perl: No Match".  I
know in this instance the problem is the asterisk.  Is there any way
around this problem?  Is this an inherent problem in the $ARGV
variable?

Thanks for the help!

Mark Schunder



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

Date: 23 Oct 1997 20:23:28 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Problems with $ARGV
Message-Id: <62obo0$f0e@news-central.tiac.net>

In article <62oacc$9r1@gateway.cybernet.com>,
Mark Schunder <mschunder@cybernet.com> wrote:
>
>One of the program arguments that I have in my script is a filename.
>The problem that I am having is that I would like the user to input
>the filename anyway they want.  This includes with/without file
>extentions and wildcards.  When the user types in for instance pres4*
>as a program argument, the perl script returns "perl: No Match".  I
>know in this instance the problem is the asterisk.  Is there any way
>around this problem?  Is this an inherent problem in the $ARGV
>variable?

The problem may be a command shell attempting to expand wild cards before
passing the results to the perl program as @ARGV, for example on a solaris
system I can say

% echo baz*
echo: No match

but if I wanted to get foo* passed to echo then I need to use single
quotes to "hide" the * from the shell:

% echo 'baz*'
baz*

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Thu, 23 Oct 1997 20:38:45 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Q: Webserver for Win95?
Message-Id: <3451b596.18070473@igate.hst.moc.com>

[cc'd automagically to original author]

On Thu, 23 Oct 1997 11:41:22 -0500, CaSey Ryan <cj-ryan@ai.uiuc.edu>
wrote:

>I'm looking for a way to test my CGI scripts on a win95 machine.  Its
>doesn't have a constant network conection, only dialup, so there isn't a
>static IP.  I compiled and installed Apache. While the service is
>running, when I try to access the webserver with a browser it can't find
>the computer because it's doing a DNS lookup on it.  I went all throught
>the files looking for something that might tell it to look locally, but
>couldn't find anything.

How do you imagine that Perl will help the situation?

Try one of the Windows web server groups for support. We support Perl.
They support Windows web servers.

It's a simple but effective division of labor. :-)

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Thu, 23 Oct 1997 15:22:42 GMT
From: Rob.Davis@unn.ac.uk (Rob Davis)
Subject: Re: s/ / /g or tr/ / / what is the difference?
Message-Id: <344f6b37.24929937@news.unn.ac.uk>

Could you perhaps explain why both tr and s only translate a certain
number of occuranes?  That is to say I have a very large string, with
embedded newlines, and I wanted to remove a certain character,
basically I found that not all occurances were removed.  Any ideas
why?

Rob

--------------------------------
email: Rob.Davis@unn.ac.uk
Web:   http://www.unn.ac.uk/~isu8


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

Date: Thu, 23 Oct 1997 15:32:32 GMT
From: Rob.Davis@unn.ac.uk (Rob Davis)
Subject: Re: s/ / /g or tr/ / / what is the difference?
Message-Id: <34506e04.25646307@news.unn.ac.uk>

Could you perhaps explain why both tr and s only translate a certain
number of occuranes?  That is to say I have a very large string, with
embedded newlines, and I wanted to remove a certain character,
basically I found that not all occurances were removed.  Any ideas
why?

Rob

--------------------------------
email: Rob.Davis@unn.ac.uk
Web:   http://www.unn.ac.uk/~isu8


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

Date: Thu, 23 Oct 1997 19:30:59 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: s/ / /g or tr/ / / what is the difference?
Message-Id: <3450a585.4555479@news.wwa.com>

On Thu, 23 Oct 1997 15:22:42 GMT, Rob.Davis@unn.ac.uk (Rob Davis)
wrote:

>Could you perhaps explain why both tr and s only translate a certain
>number of occuranes?  That is to say I have a very large string, with
>embedded newlines, and I wanted to remove a certain character,
>basically I found that not all occurances were removed.  Any ideas
>why?

I have lots of ideas, but not many of them are likely to be the reason
not all occurrences were removed in your case.  Please post the code
in question and then we might be able to be of more assistance.


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Wed, 22 Oct 1997 09:23:21 +0100
From: Philippe de Rochambeau <pr1@club-internet.fr>
Subject: Safe.pm and making eval safe
Message-Id: <344DB7F6.BE4C5251@club-internet.fr>

I have written a MacPerl script (which will later be ported to Unix)
that parses the contents of a form, sequentially reads the records of a
text file containing lamp data (lamp type, lamp style, and lamp height),

and stores all the file's records that match the criteria defined in an
HTML form.

The form looks more or less like this :

<FORM>

Lamp type:<SELECT
NAME="type"><OPTION>halogen<OPTION>street-lamp<OPTION>lamp</SELECT>

Style :<SELECT
NAME="style"><OPTION>Louis-XVI<OPTION>Louis-XVII<OPTION>Louis-XVIII</SELECT>

Height   <SELECT NAME="opHeight">
                <OPTION> >
                <OPTION> <
                <OPTION> =
</SELECT>
<INPUT TYPE=TEXT NAME="height" VALUE="0">

</FORM>

The text file looks like this :
Halogen\tLouis-XVI\t30\n
 ...

The Perl code that I have written stores the contents of the form in
scalars, reads in each record in the file, puts the values into scalars
($mytype, $mystyle, $myheight) and does the following eval:

$evalString = (($mytype eq $type) && ($mystyle eq $style) && ($myheight
$opHeight $height));

# For example, the user is looking for Louis XIV halogen lamps whose
height is > 10 inches. We must therefore find
# records where (("halogen" eq "halogen") && ("Louis-XVI" et
"Louis-XVI") && (11 or 12 or ... > 10))

# is $evalString true?
if ($evalString) {
 # put the record in an array; i.e., that record matches the criteria in

the form
}
 

The problem with this eval is that it is unsafe (according to authors of

books on CGI scripting with Perl and the -T switch).

How can I make it safe? By using the Safe module? How would you, in this

case, use the Safe module (the Safe documentation is not very clear).

Any help on this matter would be much appreciated.

Philippe de Rochambeau
 
 
 
 
 



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

Date: Thu, 23 Oct 1997 16:38:52 -0400
From: Aaron Holtz <aholtz@network1.net>
Subject: snprintf problems under Solaris 2.5.1
Message-Id: <Pine.GSO.3.96.971023162856.2150P-100000@rocinante.network1.net>

Hello - I'm having problems getting perl compiled and installed on a
Solaris 2.5.1 machine.  I've compiled and installed successfully the
Berkeley 1.85 db lib and header file.  Upon doing a 'make test' with
5.004, I get:


lib/db-btree........Can't load '../lib/auto/DB_File/DB_File.so' for module
DB_File: ld.so.1: ./perl: fatal: relocation error: symbol not found:
snprintf: referenced in ../lib/auto/DB_File/DB_File.so at
 ../lib/DynaLoader.pm line 155.
 
 at lib/db-btree.t line 12
BEGIN failed--compilation aborted at lib/db-btree.t line 12.
dubious
        Test returned status 2 (wstat 512)
lib/db-hash.........Can't load '../lib/auto/DB_File/DB_File.so' for module
DB_File: ld.so.1: ./perl: fatal: relocation error: symbol not found:
snprintf: referenced in ../lib/auto/DB_File/DB_File.so at
 ../lib/DynaLoader.pm line 155.
 
 at lib/db-hash.t line 12
BEGIN failed--compilation aborted at lib/db-hash.t line 12.
dubious
        Test returned status 2 (wstat 512)
lib/db-recno........Can't load '../lib/auto/DB_File/DB_File.so' for module
DB_File: ld.so.1: ./perl: fatal: relocation error: symbol not found:
snprintf: referenced in ../lib/auto/DB_File/DB_File.so at
 ../lib/DynaLoader.pm line 155.
 
 at lib/db-recno.t line 12
BEGIN failed--compilation aborted at lib/db-recno.t line 12.
dubious




All other tests succeed.  How do I get around this error so that the
db_file module is loaded and usable?  I have someone who needs to have
that available to them.  I have no problem installing and running perl if
the libdb.a and the db.h files don't exist during the compile and
installation.  Any thoughts, reasons, work-arounds for a somewhat lean C
programmer??  I've read faq's and problems concerning the snprintf
function under 2.5.1, but upgrading to 2.6 is not an option at this point.
Is there a way around this?  Thanks to any who might have information.


							--Aaron

-------------------------------------------------------------------------
Aaron Holtz
First Network Group    "The First Name in Internetworking"
Manager, UNIX Systems Admin
Email:  aholtz@stockcar.network1.net
"Those that do not accept Unix are doomed to reproduce it"
-------------------------------------------------------------------------



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

Date: Thu, 23 Oct 1997 15:24:49 -0400
From: Joseph H Speredelozzi <joes@wpi.edu>
Subject: sockets
Message-Id: <Pine.OSF.3.95q.971023152017.14857A-100000@bert.WPI.EDU>

I am reading from a socket using sysread, reading x number of bytes at a
time, checking if the return value is less than x, at this point i know i
have read all the info from the socket. Then I write to the socket again
and when I go to do the next read (using the notation <socket>) it is as
if the
sysread never removed the data from the socket?? Any Ideas. 


						Thanks,
						Joe



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

Date: 23 Oct 1997 20:29:24 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: Tokyo, Japan - Application Programmer; C, C++
Message-Id: <01bcdff0$b6ec0f00$LocalHost@default>

Application Programmer; C, C++
Tokyo, Japan

Scope:
Global financial firm seeks individuals for programming positions in their
Tokyo, Japan office to develop and implement new applications for their
equity derivatives business.  A highly technical, hands on, team oriented
member is desired, preferably holding a technology degree.  Individual will
interface with relevant business units to develop functional requirements
and specifications, work with other team members on overall system
architecture and design, and all aspects of software construction including
design, development, integration, testing, documentation and deployment.

Qualifications:
Requires at least 2-3 years experience in the design and development of
application software in the UNIX/C/C++/X Windows environment.  Must have
thorough working knowledge of either BSD or SVR4 UNIX (Solaris on Sun
platforms preferred.)  Also requires one or more of the following: UNIX
network programming (especially UDP, TCP/IP protocols), Perl, Sybase, or
data modeling.  

Other:
This is a permanent position and requires a 1 year minimum commitment to
living and working in Japan. Salary is commensurate with experience. 
University degree is required.

JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529



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

Date: 23 Oct 1997 20:29:25 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: Tokyo, Japan - Application Programmer; Perl/Sybase
Message-Id: <01bcdff0$e9c247a0$LocalHost@default>

Application Programmer; Perl/Sybase
Tokyo, Japan

Scope:
Global financial firm seeks individuals for Sybase/Perl development
positions in their Tokyo, Japan.  Individuals sought will join a team to
develop and implement database applications for various business units.


Qualifications:
Candidate needs 2+ years experience working with relational databases.
(preferably Sybase).  The candidate needs to have a strong grasp of
relational database concepts and good command of SQL.  Candidate should be
comfortable writing queries, creating and populating tables, and writing
triggers and stored procedures.  Candidate must have experience with UNIX,
Perl, and 4GL Windows programming experience.  Prior financial industry
experience is a plus.  Due to frequent interaction with business units,
candidate must have strong communication skills.  

Other:
This is a permanent position and requires a 1 year minimum commitment to
living and working in Japan. Salary is commensurate with experience. 
University degree is required.  Japanese is not required.

JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529



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

Date: 23 Oct 1997 20:29:23 GMT
From: "hcondon" <hcondon@ix.netcom.com>
Subject: Tokyo, Japan - Application Programmer; Sybase
Message-Id: <01bcdff0$8ab082e0$LocalHost@default>

Application Programmer; Sybase
Tokyo, Japan

Scope:
Global investment firm is seeking an experienced developer/administrator to
join its database group.
Responsibilities would include supporting and enhancing a major database
development project which will eventually be rolled out globally. 
Candidate would also be responsible for administration, developing database
monitoring utilities, providing consultation on performance optimization,
and query tuning to other groups.

Qualifications:
Requires at least 2-3 years programming experience in Sybase or Oracle, and
some experience programming C/C++ on UNIX.  Ideal candidate would have
knowledge of the Japanese securities market, administration experience in
Sybase, Oracle, and replication servers.  

Other:
This is a permanent position and requires a 1 year minimum commitment to
living and working in Japan. Salary is commensurate with experience. 
University degree is required.  Japanese fluency is strongly preferred.

JDV International is a technical search firm specializing in the placement
of information systems professionals.  JDV has offices in New York and
Japan and places people in both permanent and consulting positions.  For
information about these and other positions please contact Kerry Condon. 
Email: kcondon@jdvinternational.com.  Or please visit us at our web site:
http://www.jdvinternational.com
JDV International
826 Broadway, 9th Floor
New York, NY 10003
Phone 212-260-5022
Fax 212-260-4529



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

Date: Thu, 23 Oct 1997 19:19:03 GMT
From: Gerben_Wierda@RnA.nl
Subject: Using //
Message-Id: <EIIqzr.LJy@RnA.NL>

Well,

	I'd like to use (for speed):

===============================================
/$matchline/;
foreach my $headerline (@header) {
    if ($headerline =~ //) { 
===============================================

but as some people have explained to me, that doesn't work because // only 
uses the pattern that was last used *succesfully*. Alas, that is not what I 
want. And $matchline *does* contain a regex, so it probably doesn't match 
itself.

I can't see a way out of this other than hacking in the perl sources (bad 
idea). Because I cannot think of a string that would match *any* regular 
expression.

Maybe Larry can add a qualifier to //, something like //l for last?

-- 
Gerben_Wierda@RnA.nl (Gerben Wierda)
"If you don't know where you're going, any road will take you there"
Paraphrased in Alice in Wonderland, originally from the Talmud.

Renee: "Met veel koper maakt men hoempa." (After hearing Brahms' 
Festouverture)


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

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

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