[13264] in Perl-Users-Digest
Perl-Users Digest, Issue: 674 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 29 17:07:21 1999
Date: Sun, 29 Aug 1999 14:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 29 Aug 1999 Volume: 9 Number: 674
Today's topics:
Re: CGI in PERL <jimmy@blackhole-designs.com>
Re: CGI in PERL <jkline@one.net>
Re: CGI in PERL (Abigail)
Re: CGI in PERL <bie@connect.ab.ca>
Re: formmail and timestamp modification <rabrody@earthlink.net>
Getting HTTP document <dheera@my-deja.com>
Hiring Perl Programmer For Edit Of Script jmlcards@jmlcards.com
Re: How to chown a symbolic link in Perl? (Paul David Fardy)
identifying an empty line (Jimtaylor5)
Re: identifying an empty line <jkline@one.net>
Re: Images <jimmy@blackhole-designs.com>
Re: Images <mike@crusaders.no>
Re: Images <flavell@mail.cern.ch>
Re: new perl user : probs w/ processes <nileshdm@isha.cis.upenn.edu>
Obtaining Values from Mulitple Selects pete@pcrev.com
Perl on PalmPilot <asquith@macconnect.com>
Re: Perl on PalmPilot <jkline@one.net>
Re: Perl on PalmPilot (Abigail)
Re: random number (Glenn Paulsen)
Re: Searching an array (Anno Siegel)
Where is Binary Module DBI and DBD:ODBC for Window 95/9 <rctwo@erols.com>
Re: Where is Binary Module DBI and DBD:ODBC for Window <hahuis@us.lhsgroup.com>
Re: Will you help me solve this <mhc@Eng.Sun.COM>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 29 Aug 1999 17:03:27 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: CGI in PERL
Message-Id: <37C967D1.5D0A0D38@blackhole-designs.com>
CGI is just an extension of a programming language that the server uses
to work with the script and browser. CGI is just more "environment"
variables in Perl (well, in a nutshell). Mainly with doing cgi in perl,
all you will have to do is "use CGI;" at the top of your program, and
everything else is really easy. Only thing you might need to know is
HTML forms and such.
Here is a little tip to save you some time in using cgi with perl.
#!/usr/bin/perl
use CGI;
$form_value1 = param("name");
$form_value2 = param("last");
print "Content-type: text/html\n\n";
# you can put html header tags here if you want
print "Your First Name: $form_value1 <br>\n";
print "Your Last Name: $form_value2 <br>\n";
Now, you can use either POST or GET form methods in your HTML form.
Let's look at a few lines of the code above though.
use CGI;
This line imports the CGI perl module. CGI.pm comes with all recent
versions of perl (I think actually 5.0003+) and is heavily documented.
Next line's:
$form_value1 = param("name");
$form_value2 = param("last");
The "param" function is part of the CGI perl module that will read POST
and GET methods of an HTML form. You use to have to do all sorts of
hasel to get something like that to work in older versions of perl
(around 10 lines of code). The first value is from the HTML form tag
with an id of "name" (such as <input type="text" name="name">). The
param function calls the input "name" value, so it's param(form_name);.
The next line is looking for a form named "last", so <input type="text"
name="last">.
Next, you put ...
print "Content-type: text/html\n\n";
This tells the HTML browser the document type, otherwise, the browser
won't print it and an error will. There are dozens if not hundreds of
different mime-types you can print at the start of a page. If you are
going to display an HTML page, you would print "Content-type:
text/html\n\n"; This must be printed before you send ANY text
information to the browser. You can also print things such as images
"Content-type: image/gif\n\n"; but that is another story :) You also
must have the two trailing "new line" characters. Otherwise, you will
get an error.
Oh yeah, here is the html page for this example. Remember, you get to
choose post or get methods for your form. Post will keep information out
of the url, but if you use GET, people can edit information from the
browser url. They will see such information as
"http://search.yahoo.com/cgi-bin/search.pl?search_for=a+yellow+dog", and
the like. I usually like to use post, but if it's something you want
people to be able to bookmark (such as search results), use the GET
method.
<html>
<head><title> My form </title></head>
<body>
<form method="POST" action="/cgi-bin/myfile.pl">
Your First Name: <input type="text" name="name" length="20"><br>
Your Last Name: <input type="text" name="last" length="20">
<input type="submit" value="Submit!">
</form>
</body>
</html>
Just change the form method="" with POST or GET depending on what you
want to do. These are just some of the basics, but really, all you
might ever need. You can find more information about CGI.pm (more than
you'd ever want to know) at
http://www.perl.com/pub/doc/manual/html/lib/CGI.html
Good luck,
Jimmy
------------------------------
Date: Sun, 29 Aug 1999 14:18:23 -0400
From: Joe Kline <jkline@one.net>
Subject: Re: CGI in PERL
Message-Id: <37C9796F.22B6F1DF@one.net>
Jimmy Humphrey wrote:
>
> CGI is just an extension of a programming language that the server uses
> to work with the script and browser. CGI is just more "environment"
CGI is a protocol. Common Gateway Interface.
> variables in Perl (well, in a nutshell). Mainly with doing cgi in perl,
> all you will have to do is "use CGI;" at the top of your program, and
> everything else is really easy. Only thing you might need to know is
> HTML forms and such.
>
> Here is a little tip to save you some time in using cgi with perl.
>
> #!/usr/bin/perl
>
> use CGI;
>
> $form_value1 = param("name");
> $form_value2 = param("last");
>
> print "Content-type: text/html\n\n";
If you're going to use CGI.pm then use it:
print start_header, "\n";
The default is text/html, you can modify this to what you want. CGI.pm
contains the details.
> # you can put html header tags here if you want
> print "Your First Name: $form_value1 <br>\n";
> print "Your Last Name: $form_value2 <br>\n";
print "Your First Name: $form_value1", br, "\n";
The best newsgroup for CGI questions is:
comp.infosystems.www.authoring.cgi
joe
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Aug 1999 14:31:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CGI in PERL
Message-Id: <slrn7sj2pc.23d.abigail@alexandra.delanet.com>
Nate (bsdtruck@email.msn.com) wrote on MMCLXXXIX September MCMXCIII in
<URL:news:#5Ph4xi8#GA.273@cpmsnbbsa03>:
\\ Do I need to learn/know any other language prior to PERL if I want to learn
\\ CGI in PERL?
I'd certainly recommend knowing English first, as all the primary
documentation is written in English.
And it's spelled Perl, not PERL.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 29 Aug 1999 13:37:37 -0600
From: Tim <bie@connect.ab.ca>
Subject: Re: CGI in PERL
Message-Id: <37C98C01.8FA@connect.ab.ca>
no,
experience of course helps, but u don't need it. html know how would
help to make good scripts however.
Nate wrote:
>
> Do I need to learn/know any other language prior to PERL if I want to learn
> CGI in PERL?
>
> Thanks.
>
> Nate
--
-------------------------------------------------------
| TBE: http://tbe.virtualave.net |
| * 3:2 Ratio + 100 Free credits! * |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/ |
-------------------------------------------------------
------------------------------
Date: Sun, 29 Aug 1999 13:49:42 -0700
From: "Robert Brody" <rabrody@earthlink.net>
Subject: Re: formmail and timestamp modification
Message-Id: <7qc5ca$2cu$1@oak.prod.itd.earthlink.net>
David Cassell <cassell@mail.cor.epa.gov> wrote in message
news:37C5D940.439411F0@mail.cor.epa.gov...
> Robert Brody wrote:
> >
> > Hi. I'm using Matt Wright's formmail.pl and it presents a default
screen
>
> Mistake # 1
>
> > Is there a modification I could make to the script to offset
> > the time by a given value (in this case, -2)?
>
> Yes. But you'll have to patch the code yourself, since everyone here
> avoids touching Matt Wright's programs for fear of infection.
>
> There must be some code in there which gets the current time, probably
> using localtime() . But whether Matt gets the code right, or even
> makes it Y2K-compliant, I can't tell you.
>
> But when localtime(time) gets the current time,
> localtime(time - 2 * 60 * 60) gets the current time minus 2 hours.
> This will be off whenever you and your server differ on things like
> Daylight Savings Time. And issues of scalar vs list context matter
> for localtime, as you can see by looking it up in the perlfunc
> manpage.
Thank you for the help. I was able to make the modification and have what I
was after. Here, btw, is the unaltered snip of code from formmail's
get_date sub (after defining arrarays for the day of week and month):
# Get the current time and format the hour, minutes and seconds. Add #
# 1900 to the year to get the full 4 digit year. #
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
$year += 1900;
I am not aware of problems encountered using Matt Wright's formmail but in
light of the less than complimentary comments I've seen, perhaps I should
look at other scripts. I have cgiemail already configured via this host,
though I was looking around for Perl scripts in particular (and perhaps
convert times to 12 hours A.M. and P.M.)
If you're familiar with a flexible email forms script that you like, free or
commercial, I would appreciate recommendations. Again, thank you.
Bob
------------------------------
Date: Sun, 29 Aug 1999 20:16:35 GMT
From: Dheera <dheera@my-deja.com>
Subject: Getting HTTP document
Message-Id: <7qc4et$dd5$1@nnrp1.deja.com>
Hello,
I have libwww-perl, and I'm using ActivePerl for Windows.
Can anyone please tell me the code fragment to go and get an http
document, and store it in a variable? I am behind a http proxy...
Any ways to set a proxy with HTTP::UserAgent?
Thanks,
Dheera
dheera@usa.net
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 29 Aug 1999 17:00:38 GMT
From: jmlcards@jmlcards.com
Subject: Hiring Perl Programmer For Edit Of Script
Message-Id: <7qbovj$5pm$1@nnrp1.deja.com>
I am currently in need of two scripts I have currently to be edited so
they work together.
The scripts are:
From EveryAuction, the Feeder Addon (lets users leave feedback on
others)
From DcScripts, DCForum99 (quite simply the best forums scripts on the
net)
The feeder addon must be modified so it works with DcForum. Currently
the feeder addon looks for usernames by reading a directory of
usernames. Unfortunately DcForum saves all username in a text delimited
file.
This job pays $125 Flat!
Please email us at jmlcards@jmlcards.com if you would like to accept
this job. Work must be completed by September 15th. But it should only
be maybe an hour and a half job.
The forums are located currently at: http://www.waxpack.com/member
The feeder addon is alot like eBay's feedback program.
Thanks, and I hope to hear from someone very soon.
Sincerely,
Jared Landress
President & CEO
JML'S Cards & Collectibles
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 29 Aug 1999 18:45:40 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: How to chown a symbolic link in Perl?
Message-Id: <7qbv4k$5dn$1@coranto.ucs.mun.ca>
"Stein-Erik Engbråten" <seen@statoil.no> writes:
> How do I change the UID and/or GID on a symbolic link in Perl (this is
> on Unix machines, by the way...:-)
Tom Christiansen <tchrist@mox.perl.com> writes:
> Perl doesn't do this. Do you know why many systems don't support the
> idea? Because it conveys no distict functionality. Modes and owners
> and times on symbolic links have no meaning. So why bother? And it's
> very non-portable.
It seems to mean something to web servers. I've seen Apache and NCSA
httpd refuse to follow a symlink unless the owner of the link matched
the owner of the target.
Is that unusual? Maybe it's a (mis?)configuration option.
Paul Fardy
--
Paul David Fardy | pdf@morgan.ucs.mun.ca
Computing and Communications | pdf@InfoNET.st-johns.nf.ca
Memorial University of Newfoundland |
St. John's, NF A1C 5S7 |
------------------------------
Date: 29 Aug 1999 17:59:03 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: identifying an empty line
Message-Id: <19990829135903.07304.00000712@ng-fu1.aol.com>
I'm trying to indentify an empty line in a text file via perl, but to no avail.
Can anyone tell me how I could write code to identify an empty line (a line
with no text on it). I tried If ($line) exists but of course, that was dumb
(even for me) because it exists even if there's nothing on it, and all sorts of
matching but no go. Can anyone help? Thanks in advance for any help you can
give me.
------------------------------
Date: Sun, 29 Aug 1999 14:36:30 -0400
From: Joe Kline <jkline@one.net>
Subject: Re: identifying an empty line
Message-Id: <37C97DAE.404ADD6C@one.net>
Jimtaylor5 wrote:
>
> I'm trying to indentify an empty line in a text file via perl, but to no avail.
Take a good look at 'perldoc perlre' this will enlighten you to the
wonder that is Perl's regex engine.
First a short primer.
I am assuming you're looping through the file either after a dump of
the file to a list, or a while loop. Let's do the while loop.
open(FH,"< some_file") or
die "can't open some_file:$!";
while (<FH>)
{
chomp;
if ( m/^\s*$/ )
{
# do something
}
{
close(FH);
Let's break this down.
m # let's Perl know I'm interested in doing a match)
/ # opening delimiter for this expression, I can use others
^ # match Beginning of the line
\s* # match 0 or more occurences of whitespace, option depending upon
# how "empty" you want your line to be
$ # match the end of the line
/ # closing delimiter
I am using the implicit $_. I could have done:
while (<FH>)
{
chomp;
$line = $_;
if ( $line =~ m/^\s*$/ )
{
# do something
}
}
Please, please, please read the documentation that comes with Perl.
Just do 'perldoc perl' on a command-line ( or if on Windoze find the
Active State documentation and find the documentation there) to see
the vastness that is the documentation that comes with each and every
distribution of Perl.
joe
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 29 Aug 1999 16:41:26 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Re: Images
Message-Id: <37C962A8.9F6BFD22@blackhole-designs.com>
Ok I fixed it, hope you guys are "happy". It's really something you
guys live to attack people that use HTMl mail, how about getting a
browser that reads HTML mail or mime encoded stuff, after all it is very
available. Maybe they should just make e-mail/newsgroup readers so that
the user getting mail can have all the "crap code" they don't want
removed automatically.
Jimmy
------------------------------
Date: Sun, 29 Aug 1999 19:11:04 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Images
Message-Id: <YQdy3.347$sd.1187@news1.online.no>
Jimmy Humphrey <jimmy@blackhole-designs.com> wrote in message
news:37C962A8.9F6BFD22@blackhole-designs.com...
> Ok I fixed it, hope you guys are "happy". It's really something you
> guys live to attack people that use HTMl mail, how about getting a
And this makes this group different from any other high-traffic Usenet
group in exactly what way?
> browser that reads HTML mail or mime encoded stuff, after all it is
very
So dumping toxic waste in the Atlantic is OK since you can't see it?
There is no place for HTML on Usenet.
> available. Maybe they should just make e-mail/newsgroup readers so
that
> the user getting mail can have all the "crap code" they don't want
> removed automatically.
Well, I guess it wouldn't be too difficult to set up the killfilters to
ignore messages that are posted in text/html. All the mailing-lists I
manage has been set up to reject messages with text/html, and I think
it's pretty easy to achieve this on moderated newsgroups as well.
--
Trond Michelsen
------------------------------
Date: Sun, 29 Aug 1999 19:26:48 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Images
Message-Id: <Pine.HPP.3.95a.990829192059.16747A-100000@hpplus03.cern.ch>
On 29 Aug 1999, Jonathan Stowe wrote:
> On your keyboard between the main section and the numeric keypad there will
> be found two sets of keys : the bottom set are marked with arrows pointing
> in four directions one of which happens to point down -
[...]
> Hope That Helps.
I doubt it. It would appear that you're dealing here with a point,
click and drool merchant, that solves all complaints by expecting the
rest of usenet to get with their program, and install some non-usenet
multimedia "mail" software instead.
"Film at the eleventh hour", to mix a metaphor.
------------------------------
Date: Sun, 29 Aug 1999 15:48:14 -0400
From: NILESH D MANKAME <nileshdm@isha.cis.upenn.edu>
To: Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
Subject: Re: new perl user : probs w/ processes
Message-Id: <Pine.GSO.3.95.990829154557.15496A-100000@isha.cis.upenn.edu>
hi,
I figured that out . Anno - thanks for pointing the direction.
In brief the reqd code is..
print("\n File $ARGV[0]1.inp exists\n") if (-r "$ARGV[0]1.inp");
unless(fork)
{
exec("/pkg/grasp/abaqus57/abaqus job=$ARGV[0]1 queue= ")||
die("Unable to exec");
exit;
}
wait;
unless(fork)
{
exec("$ARGV[0]1.com ");
exit;
}
wait;
ThanX again.
- Nilesh
-------------------------------------------------------------------------------
Nilesh D. Mankame
Dept of Mech Engg. & App. Mechanics.| 297, Towne Bldg, 220 S.33rd street,
School of Engg. & App. Science. | Philadelphia, PA 19104-6315.USA
University of Pennsylvania. | Tel:(215) 898-4825 Fax:(215)573-633
--------------------------------------------------------------------------------
------------------------------
Date: Sun, 29 Aug 1999 16:16:26 GMT
From: pete@pcrev.com
Subject: Obtaining Values from Mulitple Selects
Message-Id: <7qbmck$472$1@nnrp1.deja.com>
Hi, I have a form with a multiple select which is used to put data into
a perl script. How do i get the values (I need both the text, and the
value of each selected entry) and use them in my CGI script?
please email me at pete@pcrev.com if you can help, thanks a lot.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 29 Aug 1999 10:41:15 -0500
From: "Asquith" <asquith@macconnect.com>
Subject: Perl on PalmPilot
Message-Id: <7qbknu$2upk@enews1.newsguy.com>
I thought that I heard somewhere that we can run Perl on PalmPilots. Could
someone point me in the proper direction? If I can run Perl, what
limitations are imposed?
Thanks,
-wha
------------------------------
Date: Sun, 29 Aug 1999 14:24:10 -0400
From: Joe Kline <jkline@one.net>
Subject: Re: Perl on PalmPilot
Message-Id: <37C97ACA.6D0D2D4F@one.net>
Asquith wrote:
>
> I thought that I heard somewhere that we can run Perl on PalmPilots. Could
> someone point me in the proper direction? If I can run Perl, what
> limitations are imposed?
Currently there is no port to Perl (that I know of), to track current
port of Perl go to:
http://www.perl.com/CPAN/ports/index.html
joe
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Aug 1999 14:27:13 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl on PalmPilot
Message-Id: <slrn7sj2i3.23d.abigail@alexandra.delanet.com>
Asquith (asquith@macconnect.com) wrote on MMCLXXXIX September MCMXCIII in
<URL:news:7qbknu$2upk@enews1.newsguy.com>:
** I thought that I heard somewhere that we can run Perl on PalmPilots. Could
** someone point me in the proper direction? If I can run Perl, what
** limitations are imposed?
Perl doesn't run on the Palm pilot. From what I understand, the biggest
difficulty in porting Perl to the Palm is the memory usuage. Perl is a
memory hog for all but the most trivial programs. Earlier Palms could
only allocate memory in 64k blocks, but I think that's solved in the
later versions.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 29 Aug 1999 19:51:00 GMT
From: glepa@yahoo.com (Glenn Paulsen)
Subject: Re: random number
Message-Id: <37c98efe.34303394@news.online.no>
Thanks for the tip, but is there a way that i can call this script from inside
the html code to get the random number right at the right place?
On Fri, 27 Aug 1999 13:40:50 -0700, Kin Lum <kin@0011.com> wrote:
>
>
>Glenn Paulsen wrote:
>>
>> Hi, i need help realy bad here, can anyone make a simle script that insert a
>> random number into some html code. The code is below.
>> I need a random number where there is the number 1 now, im going to use this as
>> a server side include at the bottom of the page.
>
>use
>
>$n = int rand 10;
>
>the number is from 0 to 9.
>
>try
>for($i = 0; $i < 20; $i++) {
> print int rand 10, "\n";
>}
>
>note that the random number seed is different
>every time. (using time())
>
>to get a good introduction to Perl, get
>Learning Perl. more info at http://www.0011.com/books/perl
------------------------------
Date: 29 Aug 1999 19:41:52 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Searching an array
Message-Id: <7qc2e0$nno$1@lublin.zrz.tu-berlin.de>
Bill Moseley <moseley@best.com> wrote in comp.lang.perl.misc:
>I've got an array of hashes, sorted by one of the fields in the hash,
>say 'name'. The array is between 5000 and 8000 elements long.
>
>What I'd like to do is pass to a sub an array letters and return back
>the first position the letter in located in the array.
>
> @starting_points( \@sorted_array, qw/a k s x/ );
This is gibberish.
If I understand you, you want a list of indices, as many as you
have letters, so that each index points to the first entry in the
list whose name begins with the corresponding letter.
If so, we can deal with a sorted list of strings, the fact that they
are accessed via a hash is unimportant.
>I know, I should benchmark, but I haven't started writing yet. So I'm
>wondering if anyone already does this, and if so, what's a good fast
>approach for an array of this size.
>
>The FAQ suggests just run down the length of the array. But I'm
>wondering at what point (array size) it would make sense to be a little
>smarter in the searches, perhaps by doing the recursive divide in half
>approach.
Of course you can do a binary search for each letter if it's worth
the effort. You'd get a modified binary search, because you're
not looking for a specific element, but for the smallest element
with some constraint (beginning with "s", say). Binary search is
notoriously hard to get right. You'll have to decide if it's worth
while.
I don't know what the faq says, but I'd go with a linear pass,
entering the starting points into a hash of one-letter keys as
they come along. Make it fast when and if it proves to be a
bottleneck.
You might also reconsider your data structure: Instead of the sorted
list you might have a hash with one sorted list for each letter of the
alphabet. With that structure, you'd indeed have something like
@starting_points = @hash_of_lists[ qw( a g h s)];
it'd just be a hash slice.
>I love to end up with a nice Abigail-ish one-liner.
Abigail's one-liners are famous for their one-linishness, not for
efficiency.
Anno
--
$,=$"; $\=$/;
print map { m/"(\w*)"/g } map { eval; $@ } 'another->Just', 'Hacker->Perl';
------------------------------
Date: Sun, 29 Aug 1999 12:39:48 -0400
From: Ruiming Chen <rctwo@erols.com>
Subject: Where is Binary Module DBI and DBD:ODBC for Window 95/98?
Message-Id: <37C96253.3C93DD73@erols.com>
This is a multi-part message in MIME format.
--------------B935406E0CE57A9726CCC439
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
The Subject says its all.
I installed ActiveState Perl 5.005 but I don't see DBI.pm and ODBC.pm
modules. So I went to
http://www.symbolstone.org/technology/perl/DBI/index.html
to downloaded DBI and DBD::ODBC modules
But these requires a C compiler and nmake (make) do the install
for UNIX system. I have no problem installed DBI and DBD::Informix
modules in my UNIX HP-UX 10.20. Because I have gcc and make in my UNIX
machine.
But my PC Window 95/98 does not have C developement package nor nmake.
So where I can get above binary modules for Window 95/98?
Thank you in advance!
--
RC Square Team.
--------------B935406E0CE57A9726CCC439
Content-Type: text/x-vcard; charset=us-ascii;
name="rctwo.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ruiming Chen
Content-Disposition: attachment;
filename="rctwo.vcf"
begin:vcard
n:Chui /Chen;Raymond/Ruiming
x-mozilla-html:TRUE
org:RC Square
adr:;;;;;;U.S.A.
version:2.1
email;internet:rctwo@erols.com
title:CS
tel;fax:301-498-8959
tel;home:URL http://www.erols.com/rctwo/
tel;work:301-498-8959
note:Raymond Chui & Ruiming Chen Company
x-mozilla-cpt:;0
fn:Chui /Chen, Raymond/Ruiming
end:vcard
--------------B935406E0CE57A9726CCC439--
------------------------------
Date: Sun, 29 Aug 1999 13:24:07 -0400
From: "Hendrik Ahuis" <hahuis@us.lhsgroup.com>
Subject: Re: Where is Binary Module DBI and DBD:ODBC for Window 95/98?
Message-Id: <x0ey3.14349$zE6.83170@news3.mco>
Use the ActiveState 'packet manager' ppm.bat to download and install
packages.
Cheers,
Hendrik
Ruiming Chen wrote in message <37C96253.3C93DD73@erols.com>...
>
>The Subject says its all.
>
>I installed ActiveState Perl 5.005 but I don't see DBI.pm and ODBC.pm
>modules. So I went to
>
>http://www.symbolstone.org/technology/perl/DBI/index.html
>
>to downloaded DBI and DBD::ODBC modules
>But these requires a C compiler and nmake (make) do the install
>for UNIX system. I have no problem installed DBI and DBD::Informix
>modules in my UNIX HP-UX 10.20. Because I have gcc and make in my UNIX
>machine.
>
>But my PC Window 95/98 does not have C developement package nor nmake.
>So where I can get above binary modules for Window 95/98?
>
>Thank you in advance!
>
>--
>RC Square Team.
>
>
------------------------------
Date: 29 Aug 1999 09:17:05 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Will you help me solve this
Message-Id: <8p6671yzhmm.fsf@Eng.Sun.COM>
jp_48504@yahoo.com writes:
> I am sure that this is a simple problem to most of you, but i am still
> very much an infant when it comes to perl. This is my problem: I have
> a program that is to figure out some totals, but it will print out a
> number like 32.0746153846154 what I want it to do is to round it to the
> nearest tenth such as 32.1 for this number. Can anyone help me with
> this. I really do appreciate it.
printf "%8.1f", 4.56789;
will print "4.6". See the FAQ for details and variations.
-mike
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 674
*************************************