[7774] in Perl-Users-Digest
Perl-Users Digest, Issue: 1399 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 1 22:07:23 1997
Date: Mon, 1 Dec 97 19:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 1 Dec 1997 Volume: 8 Number: 1399
Today's topics:
Re: Confused about regex (Mark666769)
Re: Finding the longest common prefix over a list of st (Ken Fox)
Re: getting value of a variable (Martien Verbruggen)
How to download files using Perl? <ganga@internetdevices.com>
Re: How To Test if number is ODD or EVEN? (Martien Verbruggen)
Informic DBD/DBI . . . <mtaylor@informix.com>
Modules for try/catch? (Peter Scott)
Need to open/close an Excel97 workbook <cacace@ibm.net>
newbie: installing cgi.pm <lcastro@cookwood.com>
newbie: installing cgi.pm <lcastro@cookwood.com>
Re: newbie: installing cgi.pm (I R A Aggie)
Re: newbie: installing cgi.pm (Abigail)
Re: open and whitespace (John Moreno)
Re: Perl Plug-In for Netscape? (Tad McClellan)
perl-cgi frames (Sameer Shroff)
Re: perl-cgi frames (Abigail)
Re: Q: Learning perl with no progr. experience (I R A Aggie)
Re: Seems to be just another 5.004_* bug:-( (Vladimir Sovetov)
Re: Seems to be just another 5.004_* bug:-( <sova@kpbank.ru>
Set $0 (for ps) with Perl 5.003/Solaris 2.5? <ejk@uiuc.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Dec 1997 02:46:57 GMT
From: mark666769@aol.com (Mark666769)
Subject: Re: Confused about regex
Message-Id: <19971202024600.VAA03765@ladder02.news.aol.com>
Hi,
Thanks for your help. A whole book about regex's? Wow. I guess I do have
something to learn...
Just curious, why wasn't ! chosen instead of ^ ? Wouldn't that be more
consistent, since ! is already the Not operator?
------------------------------
Date: 2 Dec 1997 01:26:07 GMT
From: fox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Finding the longest common prefix over a list of strings (summary)
Message-Id: <65vo3f$g4i1@eccws1.dearborn.ford.com>
Here are some benchmark results. This supports Abigail's point pretty
strongly -- I'll even admit this shows she's right. Ilya's algorithm
(named "shrink prefix" below) is very stable and consistently comes out
on top. I guess he learned something writing that trie module. ;)
IMO, the right way to answer my original question is to write a subroutine
and hide the implementation. Then when somebody eventually posts "yet
another way to do it" you can quietly replace your code. :)
I've included another algorithm here just for fun. Gurusamy Sarathy has a
really cool algorithm based on treating strings as bit vectors. All the
code is at the end.
This table shows the performance of several algorithms used to
find the common prefix. The input array is a list of words in
this form:
words = (fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky, ...
fubar.$N.quirky, fuquirky)
The common prefix is "fu". The size of the array varies from N=200 to
N=200_000. All times shown are CPU seconds. All the tests were run 200
times.
N: 200 2_000 20_000 40_000 200_000
shrink prefix: 0.39 3.53 35.51 69.17 354.95
grow prefix: 0.66 6.55 66.65 130.24 652.83
bit string: 1.15 11.00 108.20 219.01 1079.07
regex: 1.12 12.28 141.22 - -
I couldn't get the regex test to run over the array of length 40_000
or more. I'm still running 5.004_01 though so the limit might be
different in newer perls. Abigail hasn't mentioned that the regex
algorithm uses a *lot* more temporary space. It creates a temp string
proportional to the input size plus all the space used for backtracking
and the regex itself. All the others use nearly constant space.
Only "grow prefix" and "regex" are sensitive to the common prefix
length. Doubling the common prefix to "fuba" will double the time
that "grow prefix" takes and reduce the time regex takes. Conversely,
halving the common prefix to "f" will halve the time that "grow prefix"
takes and increase the time regex takes.
abigail@fnx.com (Abigail) writes:
> Ken Fox (fox@pt0204.pto.ford.com) wrote:
> ++ I was taught that big-T is simply used to denote theoretical actual
> ++ run time, i.e. the sum of all operations an algorithm performs.
>
> Well, you are displaying T here as a function working on functions
> (and if it would be similar as big-O, it would return an equivalence
> class of functions). I guess you meant T (N) = O (k*N + f).
I see what you're saying, but that's not what I meant. T is time, not an
equivalence function, so I guess the notation should really just be
T = k*N+f. What notation is used to compare algorithms with the same big-O?
Certainly O(2*N) should be worse than O(N), but big-O doesn't mean that.
Here's some more raw data. It's interesting to see how different
algorithms perform so inconsistently on different input -- and this
is a trivial problem too! All these tests were run 20_000 times.
words = (fubar0, fubar1, fubar2, fubar3, fubar4, fubar5
fubar6, fubar7, fubar8, fubar9, fubar10, fubar11
fubar12, fubar13, fubar14, fubar15, fubar16, fubar17
fubar18, fubar19)
regex: 3 secs ( 3.31 usr 0.00 sys = 3.31 cpu)
shrink prefix: 4 secs ( 3.82 usr 0.00 sys = 3.82 cpu)
bit string: 12 secs (11.38 usr 0.00 sys = 11.38 cpu)
grow prefix: 13 secs (11.87 usr 0.00 sys = 11.87 cpu)
words = (fubar0, fubar1, fubar2, fubar3, fubar4, fubar5
fubar6, fubar7, fubar8, fubar9, fubar10, fubar11
fubar12, fubar13, fubar14, fubar15, fubar16, fubar17
fubar18, fubar19, x)
grow prefix: 3 secs ( 2.60 usr 0.00 sys = 2.60 cpu)
shrink prefix: 5 secs ( 4.83 usr 0.00 sys = 4.83 cpu)
bit string: 12 secs (11.90 usr 0.00 sys = 11.90 cpu)
regex: 14 secs (14.47 usr 0.00 sys = 14.47 cpu)
words = (x, fubar0, fubar1, fubar2, fubar3, fubar4
fubar5, fubar6, fubar7, fubar8, fubar9, fubar10
fubar11, fubar12, fubar13, fubar14, fubar15, fubar16
fubar17, fubar18, fubar19)
grow prefix: 0 secs ( 0.66 usr 0.00 sys = 0.66 cpu)
bit string: 1 secs ( 0.96 usr 0.00 sys = 0.96 cpu)
regex: 4 secs ( 3.42 usr 0.00 sys = 3.42 cpu)
shrink prefix: 4 secs ( 3.80 usr 0.00 sys = 3.80 cpu)
words = (fubar0, fubar1, fubar2, fubar3, fubar4, fubar5
fubar6, fubar7, fubar8, fubar9, fubar10, fubar11
fubar12, fubar13, fubar14, fubar15, fubar16, fubar17
fubar18, fubar19, fu)
shrink prefix: 5 secs ( 4.89 usr 0.00 sys = 4.89 cpu)
grow prefix: 8 secs ( 8.16 usr 0.00 sys = 8.16 cpu)
regex: 11 secs (10.84 usr 0.00 sys = 10.84 cpu)
bit string: 12 secs (11.91 usr 0.00 sys = 11.91 cpu)
words = (fu, fubar0, fubar1, fubar2, fubar3, fubar4
fubar5, fubar6, fubar7, fubar8, fubar9, fubar10
fubar11, fubar12, fubar13, fubar14, fubar15, fubar16
fubar17, fubar18, fubar19)
regex: 3 secs ( 3.52 usr 0.00 sys = 3.52 cpu)
shrink prefix: 4 secs ( 3.80 usr 0.00 sys = 3.80 cpu)
grow prefix: 6 secs ( 5.56 usr 0.00 sys = 5.56 cpu)
bit string: 12 secs (11.72 usr 0.00 sys = 11.72 cpu)
words = (fubar0, fubar1, fubar2, fubar3, fu, fubar5
fubar6, fubar7, fubar8, fubar9, fubar10, fubar11
fubar12, fubar13, fubar14, fubar15, fubar16, fubar17
fubar18, fubar19)
shrink prefix: 5 secs ( 4.22 usr 0.00 sys = 4.22 cpu)
regex: 4 secs ( 4.58 usr 0.00 sys = 4.58 cpu)
grow prefix: 6 secs ( 5.58 usr 0.00 sys = 5.58 cpu)
bit string: 11 secs (10.76 usr 0.00 sys = 10.76 cpu)
words = (fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky, fubar4quirky,
fubar5quirky fubar6quirky, fubar7quirky, fubar8quirky, fubar9quirky,
fubar10quirky, fubar11quirky fubar12quirky, fubar13quirky,
fubar14quirky, fubar15quirky, fubar16quirky, fubar17quirky
fubar18quirky, fubar19quirky)
regex: 3 secs ( 4.14 usr 0.00 sys = 4.14 cpu)
shrink prefix: 5 secs ( 4.96 usr 0.00 sys = 4.96 cpu)
bit string: 11 secs (11.15 usr 0.00 sys = 11.15 cpu)
grow prefix: 12 secs (12.32 usr 0.00 sys = 12.32 cpu)
words = (fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky, fubar4quirky,
fubar5quirky fubar6quirky, fubar7quirky, fubar8quirky, fubar9quirky,
fubar10quirky, fubar11quirky fubar12quirky, fubar13quirky,
fubar14quirky, fubar15quirky, fubar16quirky, fubar17quirky
fubar18quirky, fubar19quirky, xquirky)
grow prefix: 2 secs ( 2.67 usr 0.00 sys = 2.67 cpu)
shrink prefix: 6 secs ( 6.14 usr 0.00 sys = 6.14 cpu)
bit string: 12 secs (11.60 usr 0.00 sys = 11.60 cpu)
regex: 17 secs (16.83 usr 0.00 sys = 16.83 cpu)
words = (xquirky, fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky,
fubar4quirky fubar5quirky, fubar6quirky, fubar7quirky, fubar8quirky,
fubar9quirky, fubar10quirky fubar11quirky, fubar12quirky,
fubar13quirky, fubar14quirky, fubar15quirky, fubar16quirky
fubar17quirky, fubar18quirky, fubar19quirky)
grow prefix: 0 secs ( 0.65 usr 0.00 sys = 0.65 cpu)
bit string: 1 secs ( 0.94 usr 0.00 sys = 0.94 cpu)
regex: 5 secs ( 4.27 usr 0.00 sys = 4.27 cpu)
shrink prefix: 5 secs ( 5.03 usr 0.00 sys = 5.03 cpu)
words = (fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky, fubar4quirky,
fubar5quirky fubar6quirky, fubar7quirky, fubar8quirky, fubar9quirky,
fubar10quirky, fubar11quirky fubar12quirky, fubar13quirky,
fubar14quirky, fubar15quirky, fubar16quirky, fubar17quirky
fubar18quirky, fubar19quirky, fuquirky)
shrink prefix: 5 secs ( 5.75 usr 0.00 sys = 5.75 cpu)
grow prefix: 7 secs ( 7.60 usr 0.00 sys = 7.60 cpu)
regex: 13 secs (12.01 usr 0.00 sys = 12.01 cpu)
bit string: 14 secs (13.70 usr 0.00 sys = 13.70 cpu)
*** The following data set is what I consider most representative of
a sorted directory listing.
words = (fuquirky, fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky,
fubar4quirky fubar5quirky, fubar6quirky, fubar7quirky, fubar8quirky,
fubar9quirky, fubar10quirky fubar11quirky, fubar12quirky,
fubar13quirky, fubar14quirky, fubar15quirky, fubar16quirky
fubar17quirky, fubar18quirky, fubar19quirky)
regex: 4 secs ( 4.11 usr 0.00 sys = 4.11 cpu)
shrink prefix: 5 secs ( 4.94 usr 0.00 sys = 4.94 cpu)
grow prefix: 6 secs ( 5.85 usr 0.00 sys = 5.85 cpu)
bit string: 10 secs (11.43 usr 0.00 sys = 11.43 cpu)
words = (fubar0quirky, fubar1quirky, fubar2quirky, fubar3quirky, fuquirky,
fubar5quirky fubar6quirky, fubar7quirky, fubar8quirky, fubar9quirky,
fubar10quirky, fubar11quirky fubar12quirky, fubar13quirky,
fubar14quirky, fubar15quirky, fubar16quirky, fubar17quirky
fubar18quirky, fubar19quirky)
shrink prefix: 5 secs ( 5.50 usr 0.00 sys = 5.50 cpu)
regex: 6 secs ( 5.51 usr 0.00 sys = 5.51 cpu)
grow prefix: 6 secs ( 5.61 usr 0.00 sys = 5.61 cpu)
bit string: 11 secs (10.88 usr 0.00 sys = 10.88 cpu)
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
# ----------------------------------------------------------------------
use Benchmark qw(timethese);
#my @words = qw(the thick thesis thoroughly threw thor);
my @words;
for (my $i = 0; $i < 20; ++$i) {
push @words, "fubar$i";
}
my $suffix = "";
if (defined($ARGV[0])) {
if ($ARGV[0] > 5) {
$ARGV[0] -= 6;
$suffix = "quirky";
foreach (@words) {
$_ .= $suffix;
}
}
if ($ARGV[0] == 1) { push @words, ("x".$suffix) }
elsif ($ARGV[0] == 2) { unshift @words, ("x".$suffix) }
elsif ($ARGV[0] == 3) { push @words, ("fu".$suffix) }
elsif ($ARGV[0] == 4) { unshift @words, ("fu".$suffix) }
elsif ($ARGV[0] == 5) { $words[4] = "fu".$suffix }
}
print "\n\n\nwords = (";
my $columns = 6;
my $pos = 0;
while ($pos < ($#words - $columns)) {
print join(', ', @words[$pos .. $pos+$columns-1]), "\n ";
$pos += $columns;
}
print join(', ', @words[$pos..$#words]), ")\n\n";
my @test_words = @words;
my $reference = shift @test_words;
timethese(20_000, {
'regex' =>
sub {
my $prefix;
(join(',', @words).',') =~ /^(\w*)\w*,(\1\w*,)*$/;
$prefix = $1;
},
'bit string' =>
sub {
my $prefix = $reference;
foreach my $w (@test_words) {
last if $prefix eq '';
($prefix ^ $w) =~ /^([\0]*)/;
$prefix = $reference & ~$1;
}
},
'shrink prefix' =>
sub {
my $len = length($reference);
my $prefix = $reference;
foreach (@test_words) {
while (substr($_, 0, $len) ne $prefix) {
--$len;
$prefix = substr($prefix, 0, $len);
}
}
},
'grow prefix' =>
sub {
my $offset = 0;
my $prefix;
MATCH: while (1) {
$prefix = substr($reference, $offset, 1);
foreach (@test_words) {
if (substr($_, $offset, 1) ne $prefix) {
$prefix = substr($reference, 0, $offset);
last MATCH;
}
}
++$offset;
}
}
});
------------------------------
Date: 2 Dec 1997 01:27:10 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: getting value of a variable
Message-Id: <65vo5e$nt4$2@comdyn.comdyn.com.au>
In article <65r89p$a3t@mtinsc05.worldnet.att.net>,
jsaya@iname.com (John Saya) writes:
> print "Host: ";
> $line = <STDIN>;
> $host = chop ($line);
Didn't I just see a post exactly like this about two weeks ago?
>From the documentation:
perldoc -f chop
Chops off the last character of a string and returns the character
chopped.
[snip]
Hmm.. It returns the last character chopped. That must be the last
character of whatever was put in on STDIN. Maybe that is not exactly
what you wanted?
$host = <STDIN>
chop($host);
print "Host: $host\n";
If you are just trying to remove the newline, use chomp instead.
And please, read the documentation that is provided with perl.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Mon, 01 Dec 1997 16:51:33 -0800
From: Gangadhar Vaddepalli <ganga@internetdevices.com>
Subject: How to download files using Perl?
Message-Id: <34835B94.D56B5257@internetdevices.com>
Hello,
How to download a .tar file using Perl?
I tried with the following CGI code, but no use.
-------------------
#!/usr/local/bin/perl
print "Content type: application/x-tar\n\n";
open(FH, "</home/users/ganga/work/sentinel/html/afslogdata.tar");
while(<FH>) {
print $_;
}
close(FH);
----------------
Thanks for any idea or sample code.
Gangadhar
~
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Internet Devices, Inc
Work Phone: (408)541-1400 (ext. 309) Home Phone: (408)739-4521
Email: ganga@internetdevices.com
------------------------------
Date: 2 Dec 1997 01:13:14 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How To Test if number is ODD or EVEN?
Message-Id: <65vnba$nt4$1@comdyn.comdyn.com.au>
In article <65s0p9$4gi$1@dismay.ucs.indiana.edu>,
bdwheele@indiana.edu (Brian Wheeler) writes:
>> That is NOT what the poster submitted though. What the poster
>> submitted was not correct, even if it was CLOSE.
>
> Yeah, and you never typo? Looking at it, you can see what he's
The poster should have cancelled his faulty post, and resubmitted a
correct one in that case.
> trying to do, and since you know what && vs & means, then you can figure out
> why its not working.
Like I said in the post you replied to:
>> It might be trivial, but the original poster obviously didn't know how
>> to do it, so the original poster probably also wouldn't have been able
>> to figure out that the answer was wrong, and why it was wrong.
*I* know what the difference is between & and &&, the original poster
might not have known. If brian d foy hadn't posted a follow-up,
poiting out that it was wrong, the original poster wouldn't have known
it was wrong, and migth have been baffled by the unexpected results.
The whole idea was:
TEST your code before posting.
A simple little test, like brain d foy did, would have shown that it
was wrong. Code doesn't allow for typos. Posts shouldn't either.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Mon, 01 Dec 1997 19:42:41 -0700
From: Mark Taylor <mtaylor@informix.com>
Subject: Informic DBD/DBI . . .
Message-Id: <348375A1.2515@informix.com>
Hi,
We just installed Perl with the Informix DBD/DBI part and all the tests
(except a blob test) passed. But when I try a simple sonnect to a DB I
get several "can't load library" messages. I of course don't have the
names with me at home but they seem to be the Informix libraries that it
needs just to get started. I have checked and the libraries are there
and readable by me . . . What am I forgetting to do?
Thanks . . .
Mark
------------------------------
Date: 2 Dec 1997 00:57:10 GMT
From: psa@euclid.jpl.nasa.gov (Peter Scott)
Subject: Modules for try/catch?
Message-Id: <65vmd6$avk@netline.jpl.nasa.gov>
Hi. I seem to remember reading somewhere recently (CPAN? TPJ? I forget)
about a module which implemented try { } catch { } blocks for Perl.
I've found Tom's exceptions.pl, but it doesn't look like what I thought
I saw. I've searched all over CPAN for something else. I can make
exceptions.pl work for me but before I go down that road would like to
know about other possibilities that are out there.
(I plan on doing something as close as possible to the Java model of
creating new classes of exception, etc, to see how well it works.)
--
This is news. This is your | Peter Scott, NASA/JPL/Caltech
brain on news. Any questions? | (psa@euclid.jpl.nasa.gov)
(Email address will be inactivated after 1 month or first spam,
whichever happens later.)
Disclaimer: These comments are the personal opinions of the author, and
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: 2 Dec 97 01:35:31 GMT
From: "AL" <cacace@ibm.net>
Subject: Need to open/close an Excel97 workbook
Message-Id: <01bcfec2$9cf454e0$e21e2581@AL_NOTEBOOK.ibm.net>
I need to open Excel97 using a filename that I specify, put some data in
some cells (this part I can do), and then save and quit without predjudice.
In other words I don't want Excel
to ask me whether I want to replace the existing file or not. Also, I can't
seem to get
the OLE module to accept filenames like "file1.xls." It seems the 'dot' is
causing it
some grief.
Anyone that can help with all or part of this with some examples will be
appreciated.
AL
------------------------------
Date: Mon, 01 Dec 1997 19:01:35 -0500
From: Liz Castro <lcastro@cookwood.com>
Subject: newbie: installing cgi.pm
Message-Id: <34834FCD.6FF7D122@cookwood.com>
I read the FAQs, and the camel and the llama and a bunch of other stuff,
but I think my question is to basic for all of that. I'm trying to
install the cgi.pm module, and according to
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/#installation I'm
supposed to do something with a Makefile.PL. Well, after I figured out
all the paths and stuff, I finally got *this* error message: Event not
Found. What does that mean?
I'm not a programmer, but I really want to learn this, but it seems like
every bit of documentation already assumes like I know stuff about perl.
How do people start from *zero*???
Oh, yeah, and I read in some newsgroup archive that Randal Schwartz
thinks that newbies should use CGI.pm and not cgi-bin.pl...any new
thoughts on that? It sure is harder to install!!
--
Thanks,
Liz
______________________
Liz Castro (lcastro@cookwood.com)
Peachpit Press
1249 Eighth Street
Berkeley, CA 94710
Read a peach!
------------------------------
Date: Mon, 01 Dec 1997 19:00:12 -0500
From: Liz Castro <lcastro@cookwood.com>
Subject: newbie: installing cgi.pm
Message-Id: <34834F7A.542A3F50@cookwood.com>
I read the FAQs, and the camel and the llama and a bunch of other stuff,
but I think my question is to basic for all of that. I'm trying to
install the cgi.pm module, and according to
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/#installation I'm
supposed to do something with a Makefile.PL. Well, after I figured out
all the paths and stuff, I finally got *this* error message: Event not
Found. What does that mean?
I'm not a programmer, but I really want to learn this, but it seems like
every bit of documentation already assumes like I know stuff about perl.
How do people start from *zero*???
Oh, yeah, and I read in some newsgroup archive that Randal Schwartz
thinks that newbies should use CGI.pm and not cgi-bin.pl...any new
thoughts on that? It sure is harder to install!!
--
Thanks,
Liz
______________________
Liz Castro (lcastro@cookwood.com)
Peachpit Press
1249 Eighth Street
Berkeley, CA 94710
Read a peach!
------------------------------
Date: Mon, 01 Dec 1997 20:50:30 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: newbie: installing cgi.pm
Message-Id: <-0112972050310001@aggie.coaps.fsu.edu>
In article <34834FCD.6FF7D122@cookwood.com>, lcastro@cookwood.com wrote:
+ I'm supposed to do something with a Makefile.PL. Well, after I figured out
+ all the paths and stuff, I finally got *this* error message:
+ Event not Found. What does that mean?
Hmmm?? Isn't that a shell history thing??? I don't know how you got that
from:
% perl Makefile.PL
% make
% make install
+ I'm not a programmer, but I really want to learn this, but it seems like
+ every bit of documentation already assumes like I know stuff about perl.
Or in this case, a little unix. I presume that's what system you're on.
More details would be of use.
+ How do people start from *zero*???
Very carefully. When I got started in unix, it was part of my job. I
spent several hours every day going thru a book on unix, typing in the
examples and trying my own. It took awhile, but I learned it pretty
well.
Just remember: man, man -k, and perldoc are your friends... :)
+ Oh, yeah, and I read in some newsgroup archive that Randal Schwartz
+ thinks that newbies should use CGI.pm and not cgi-bin.pl...any new
+ thoughts on that? It sure is harder to install!!
IMHO, replace "newbies" with "everyone". cgi-LIB.pl was useful in its time.
Its time is past, and CGI.pm is available and quite easy to use. On
<url:http://www.perl.com/> somewhere should be a document on why you shouldn't
use cgi-lib.pl.
For one, it's buggy. IMHO, it is also intermittently buggy -- sometimes a
script would work, sometimes it wouldn't. When I replaced cgi-lib.pl with
CGI.pm (in the compatibility mode [1]), those intermittent gremlins went
away.
James
[1] simply replace "require 'cgi-lib.pl';" with "use CGI qw(:cgi-lib);" and
your old scripts will still work as written.
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 2 Dec 1997 02:08:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie: installing cgi.pm
Message-Id: <slrn686rft.175.abigail@betelgeuse.wayne.fnx.com>
Liz Castro (lcastro@cookwood.com) wrote on 1554 September 1993 in
<URL: news:34834F7A.542A3F50@cookwood.com>:
++
++ Oh, yeah, and I read in some newsgroup archive that Randal Schwartz
++ thinks that newbies should use CGI.pm and not cgi-bin.pl...any new
++ thoughts on that? It sure is harder to install!!
It is? Odd. CGI.pm comes with Perl. cgi-bin.pl doesn't.
So, I install Perl and do nothing, and I have CGI.pm.
or, I install Perl and install cgi-bin.pl and I have cgi-bin.pl
Why exactly is doing nothing harder than installing cgi-bin.pl?
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Mon, 1 Dec 1997 21:46:44 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: open and whitespace
Message-Id: <1d0ldvq.14pujarcxn5x2N@roxboro-161.interpath.net>
Tom Phoenix <rootbeer@teleport.com> wrote:
> On Mon, 1 Dec 1997, Niall O Broin wrote:
>
> > I need to process files generated by Macintosh users who quite often use
> > filenames with leading spaces (deliberately because space sorts to the
> > top of a Finder file list) and trailing spaces (probably accidentally).
>
> > Does anyone know why open strips leading and trailing whitespace ?
>
> IMHO, you've given a good reason why MacPerl shouldn't strip leading and
> trailing whitespace in open(). Maybe you should report this as a bug in
> MacPerl, and try to get it fixed. :-)
It doesn't look to me like he was talking about files generated by or
processed by MacPerl - although it could be of course, but note that he
is posting using a unix version of Netscape and says he a UNIX Net/Adm
in his sig. It looks like the files are either being generated on a Mac
and transferred over to a unix or pc box and processed or there is a
platform independent way of generating the file names and the Mac users
are including spaces in the name so that they sort first when viewed on
their machines - if it's the latter then they need to be told to stop.
A better solution would be to have some way of telling open that that
the file name isn't a expression and have it evaluated 'as is' (say if
the file name was quoted using 's).
But using a full pathname (as recommended in the faq) seems to work (I
couldn't get the other methods to work using MacPerl - not sure if
that's because of a bug in MacPerl or my own incompetence but I know
which way to bet and it's not on a bug).
--
John Moreno
------------------------------
Date: Mon, 1 Dec 1997 17:53:54 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl Plug-In for Netscape?
Message-Id: <imiv56.4b3.ln@localhost>
Patrick Hayes (Patrick.Hayes.CAP_SESA@renault.fr) wrote:
: tadmc@metronet.com (Tad McClellan) writes:
: > Eric Hilding (eric@hilding.com) wrote:
: > : I've looked around but just can't seem to find the
: > : info on an alleged Perl 'Plug-In' for Netscape.
: > Where did you hear the allegations?
: >
: > I've not heard of such a thing.
: >
: > What do you want to do that you need a plugin for?
: I believe he is may be referring to perlscript, the browser side perl
: implementation by ActiveWare/ActiveState/... Perlscript is not a plug-in, but
: an implementation of perl that's supposed to let you the same kind of tasks
: people are using JavaScript for, but using perl.
: See: <URL:http://www.ActiveState.com>
Oh. So it is not Perl he wants. It is Perlscript.
Is there a newsgroup for Perlscript?
This one ain't it. This one is for discussing Perl...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 01 Dec 1997 23:08:27 GMT
From: ss492@columbia.edu (Sameer Shroff)
Subject: perl-cgi frames
Message-Id: <3483435e.10308582@news.columbia.edu>
I need help using frames in cgi-perl. I have created a page with two
frames with a form on one side and information on the other. When the
user clicks on a button I would like the user to go to a new page
without any frames. This is where I need help, I do not know how to
delete the frames and show the user a new page.
If it is possible I would like a response in english.
Thank you,
Sameer Shroff
ss492@columbia.edu
------------------------------
Date: 2 Dec 1997 02:09:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: perl-cgi frames
Message-Id: <slrn686ri7.175.abigail@betelgeuse.wayne.fnx.com>
Sameer Shroff (ss492@columbia.edu) wrote on 1553 September 1993 in
<URL: news:3483435e.10308582@news.columbia.edu>:
++
++ I need help using frames in cgi-perl.
You should be using CGI.pm instead.
++ I have created a page with two
++ frames with a form on one side and information on the other. When the
++ user clicks on a button I would like the user to go to a new page
++ without any frames. This is where I need help, I do not know how to
++ delete the frames and show the user a new page.
++ If it is possible I would like a response in english.
So, what exactly is your Perl question again?
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Mon, 01 Dec 1997 20:35:21 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Q: Learning perl with no progr. experience
Message-Id: <-0112972035220001@aggie.coaps.fsu.edu>
In article <slrn6864ds.lve.rodgerd@orwell.rm.gen.nz>, rodgerd@ihug.co.nz wrote:
+ On 1 Dec 1997 13:15:16 GMT, ? the platypus {aka David Formosa}
<dformosa@st.nepean.uws.edu.au> wrote:
+ >Perl is not a good lannguge to learn programing on IMHO.
+ I beg to differ. Perl is a naturalistic languange that allows one to do
+ useful things quickly. It ay not straitjacket the learner into doing things
+ correctly as much as pascal does, but it won't straightjacket the user into
+ being able to do next to nothing useful, either. Perl has a happy knack of
+ encouraging the beginner to keep going.
On the other hand, perl will quite cheerfully hand the programmer
(beginner, intermediate, expert, Larry Wall) all the rope they need
to hang themselves. Or possibly just their machine.
Good perl requires discipline. Most beginners don't have that, and
thus need to learn it, preferably in a language that enforces it. Then
they can brag about perl's flexability... :)
+ (All in my opinion and experience, of course).
But of course. :)
James - been hung out to dry once or twice...definitely not perl's fault,
but mine... ;)
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 2 Dec 1997 02:19:56 GMT
From: sova@kpbank.ru (Vladimir Sovetov)
Subject: Re: Seems to be just another 5.004_* bug:-(
Message-Id: <65vr8c$33p$1@home.kpbank.ru>
Tom Phoenix (rootbeer@teleport.com) wrote:
: On 1 Dec 1997, Vladimir Sovetov wrote:
: > 2. And perl -v
: > This is perl, version 5.004_04 built for i386-bsdos
: >
: > HANG-UP!!!!
: I don't know what you're meaning by that. Are you saying that the command
: 'perl -v' somehow disconnects your network?
I never said this, at least didn't intend to:-))))
All I want to ponit out, that version 5.004_04 of Perl could hang-up
while trying to evaluate not very complicated rexep.
The code was intentionaly non-correct, but still I believe it's
absolutely unappropriate behavior.
---
Vladimir Sovetov | Kuzbassprombank
------------------------------
Date: 2 Dec 1997 09:22:01 +0700
From: Vladimir Sovetov <sova@kpbank.ru>
Subject: Re: Seems to be just another 5.004_* bug:-(
Message-Id: <199712020221.JAA08673@arf.hq.kem>
>
> >>>>> "V" == Vladimir Sovetov <sova@kpbank.ru> writes:
>
>
> Write it like this (otherwise it will make some confusing retry ) :
It seems so:-)))
>
> V> % cat test.pl
> V> #!/usr/bin/perl -w
>
> V> while (<>)
> V> {
> V> print "Before: $_\n";
> V> s/<(?:[^>'"]+|(['"]).+?\1)*>//gs;
>
> s/<(?:[^>'"]|(['"]).+?\1)*>//gs;
Thanks, but it wasn't exactly the thing I wanted to do.
I mean, yes, it will work, but still would not delete multy-line
HTML TAGs like this one
<IMG blah-blah
BORDER=0>
The correct approach seems to be.
undef $/;
$_=<>;
s/<(?:[^>'"]+|(['"]).+?\1)*>//gs;
And the idea of initial posting wasn't the plea for help :-)))
but rather pointing out that very trivial error in rexep could end up
as Perl hang-up. I belive it's absolutely unacceptable behavior.
Is it?
--
Vladimir Sovetov | System and Network Support
| KuzbassPromBank
------------------------------
Date: Mon, 01 Dec 1997 16:51:48 -0600
From: Ed Kubaitis <ejk@uiuc.edu>
Subject: Set $0 (for ps) with Perl 5.003/Solaris 2.5?
Message-Id: <34833F84.29BAAB58@uiuc.edu>
Hi,
Used Perl "$0 = ..." for an application I originally
developed on AIX 4.2. This provided a handy cheap
tool for relaying status of the application to system
admins.
On porting the app to a Solaris 2.5.1 system though,
I find this nifty feature no longer works. Am I
missing something, or just SOL on Solaris?
Thanks - Ed
--------------------------
Ed Kubaitis - ejk@uiuc.edu
CCSO - University of Illinois at Urbana-Champaign
------------------------------
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 1399
**************************************