[8536] in Perl-Users-Digest
Perl-Users Digest, Issue: 2153 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 21 17:08:12 1998
Date: Sat, 21 Mar 98 14:00:28 -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 Sat, 21 Mar 1998 Volume: 8 Number: 2153
Today's topics:
"Newbie" Crib Notes <stackhou@execpc.com>
Re: - Looking for a Linkchecker script - <stackhou@execpc.com>
Re: Accepting Input from Forms <stackhou@execpc.com>
Apologize... <sneaker@earthling.net>
Re: Can't understand /g (match global) operator - help! <rjk@coos.dartmouth.edu>
Core dump using DB_File (Ken Williams)
Re: cperl and emacs 19.28 -- HELP (Ilya Zakharevich)
fork/exec (Ilya Zakharevich)
HTTPd: malformed header from script .HELP? <cyberman@sonoma.edu>
Re: HTTPd: malformed header from script .HELP? <default@user.org>
Re: Insensetive EQ (Todd N. Tolhurst)
Re: Perl Daemons <default@user.org>
Re: Perl Daemons (Ilya Zakharevich)
Re: Perl on IIS <john_scrimsher@hp-corvallis.cv.hp.com>
PerlRing??? <stackhou@execpc.com>
Re: PerlRing??? (Joergen W. Lang)
Re: R.E. <beans@bedford.net>
Re: reset a array? <default@user.org>
Re: reset a array? <uri@sysarch.com>
Re: reset a array? <palincss@tidalwave.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 21 Mar 1998 12:36:40 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: "Newbie" Crib Notes
Message-Id: <6f11jq$57k@newsops.execpc.com>
Please DO NOT post to this thread! The information here has
been assembled
as a resource for beginning Perlers. If you have comments,
flames, or an
excellent response to a beginners question, please reply to
"Sender Only".
I will do my best to add new information as I have time. If
you feel you must
post to the group, could you please start a new thread i.e.
Re: Was Newbies
Crib Notes? This thread should be allowed to expire. Thank
you.
Mark
##############################################################
Open a com port:
open( PORT, "+>COM1" ) or die "Can't open COM1: $!";
##############################################################
Removing text from a file line:
>I have tried the perl documentation but was not able to find any source
>for my following problem:
>I would like to remove everything between '<' and '>' in a line and for
>all the instances. I am trying to work out a script that basically
>removes all the formatting tags in an HTML document. For the script:
How about:
$line =~ s/<[^>]*>//g;
Note: The above example *will* run into problems if '<' or
'>' actually
appear
in the desired text (in the text they should be represented
as < and >
or
if each '<' is not properly matched with its corresponding
'>'.
*****
What you want is
$line =~ s/<.+?>//g;
Look for the term "greedy" in the perlre manpage.
*****
try $line =~ s/<.*?>//g; - the *? is a
non-greedy pattern
match ie it matches the shortest as opposed to the longest
pattern
##############################################################
Reverse a file line:
A script like this means you don't have to put
anything in the <>:
#!/bin/perl -w
print reverse <>;
Call this 'tac' and run it like this:
$ tac /etc/termcap
This prints termcap out line-reversed.
$ tac /etc/termcap /etc/passwd
This prints out both files line-reversed.
##############################################################
Count occurrences in a string:
This is fine if you are just looking for a single character.
However, if you
are
trying to count multiple
character substrings within a larger string, tr/// won't
work. What you can
do
is wrap a while loop
around a global pattern match. For example, let's count
negative integers:
$string = "-9 55 48 -2 23 -76 4 14 -44";
while ($string =~ /-\d+/g) { $count++ }
print "There are $count negative numbers in the string";
##############################################################
You could create a DOS batch file like the following:
@echo off
if "%1"=="" goto ERROR
perl %1 | more
goto END
:ERROR
echo "ERROR: No perl file specified."
:END
echo.
Then associate the .pl file type in windows with this batch
file.
##############################################################
Access the last element in an array:
$last_value=$array[-1]
##############################################################
Read in and query a file, line by line:
It sounds like what you want to do is look at the beginning
and end of
each word. is that right? if so, how about this?
# don't read the whole file into an array. instead, read it
in line
# by line:
open(IN, "your_file_name_here") || die "your_message_here";
while ($line = <IN>) {
# now split that line up into an array. i'll assume that
the line
# is separated by spaces...
@words = split(' ', $line);
# each element of the array @words is a word. now you can
go thru
# the words, using perl's frolicsome foreach operator:
foreach $word (@words) {
look_at_beginning;
look_at_end;
}
}
on the other hand, if i misunderstood your question and you
really do
need an array of arrays, i refer you to "Perl 5 for
dummies", by paul
e. hoffman, pp. 258-261. this will help you build the data
structure
and then iterate thru it.
|| die "Your message here";
could and probably should be written as:
or die "Your message here, $!";
** Adding the $! gets you the text of whatever the error
was;
##############################################################
Convert a string into an array:
given the scalar $string, split it into characters thusly:
@chars = split //, $string;
Now $chars[0] is the first character and $chars[$#chars] is
the last.
##############################################################
"Send mail" solution:
I have a perl script to send mail.
When the email address is good everything works.
When the email address is invalid, nothing happens. I would
like to get
returned
to the sender the same thing I get when I use email and get
returned
email because
the email address was not correct.
I added REPLY-TO in my last attempt. It did not work.
Here is my code:
open (MAIL,"| sendmail $emailList")
or die "Can not open mail at this time, try later";
print MAIL "FROM: $fromEmail \($fromFirst $fromLast
$Llong_name Team
$fromTeam\)\n";
print MAIL "SUBJECT: $subject\n";
print MAIL "REPLY-TO: $fromEmail\n";
print MAIL "\n";
print MAIL "$desc\n";
print MAIL "\n";
print MAIL "$Llong_name at
www.all-soccer.com/leagues/$league/\n";
print MAIL "email $admin\n";
print MAIL "AAA000\n";
close (MAIL);
Did you try
print MAIL "Return-path: whoever\@whereever.net\n";
##############################################################
Win-32 association file:
Usually, Perl for Win32 programmers create a file type like
"Perl Script"
and associate the extension ".pl" with that type. We specify
that the
perl interpreter binary, perl.exe, is responsible for that
file type. Several
Web servers require that you associate your scripts with
perl.exe
before the script can be run.
On Windows 95 and Windows NT 4.0, you can create a new file
type
and associate the perl interpreter with it as follows:
Open the My Computer icon on the Desktop. The My
Computer window
should appear.
From the View menu in the My Computer window, select
Options.
The Options dialog box should appear.
In the Options dialog box, select the File Types tab.
Click the New Type button. The Add New File Type dialog
box
should appear.
In the Description of type edit box, type "Perl Script".
In the Associated extension edit box, type ".pl".
Leave the Content Type (MIME) edit box blank.
Click the New button beneath the Actions list. The New
Action
dialog box will appear.
In the Action edit box, type "Open" (it's important to
use this
name for the action!).
In the Application used to perform action edit box, type
"[full
path to perl]\perl.exe %1 %*", where [full path to perl]
is the
full path to
perl.exe on your machine. Note that if perl is in your
path, you _
can_ just put perl.exe, but for esoteric reasons it's
just better
to put the
full path. Also, if the path to your interpreter
includes spaces
(like "C:\Program Files\perl5") put in the DOS path
instead
("C:\progra~1\perl5").
Click OK to close the New Action dialog box.
Click OK to close the Add New File Type dialog box.
Click OK to close the Options dialog box.
You can test your association by double-clicking on a perl
script in
the Explorer window. If perl.exe starts and executes the
script, things
are OK.
On Windows NT 4.0, you can avoid all the hassle of the above
and just
type the following from the command line:
ASSOC .pl=PerlScript
FTYPE PerlScript=[full path to perl]\perl.exe %1 %*
For more information on these commands, type HELP FTYPE at
the command
prompt.
Note that for this to work you have to have command
extensions enabled.
(These are enabled by default; you'd know if you'd turned
them
off.)
##############################################################
Executing perl scripts from a DOS shell:
Create a perl script with an editor - save it as anything
you like, but a
suffix of ".pl" is usual, i.e., fred.pl
Run "pl2bat.exe fred.pl" which will create a dos executable,
fred.bat.
Execute fred.bat in a dos window.
Alternatively set a file type for .pl in the My Computer
options window.
The command should be something like .. c:\perl\bin\perl.exe
% (this may
have been done by the install already).
Then a right-click OPEN on any file suffixed .pl will run
it.
##############################################################
Prevent Your DOS shell from "disappearing":
Check that your installation was successful. In particular
the
autoexec.bat file should have a PATH variable which includes
the
directory
where perl.exe resides.
Use your favorite editor to create a perl script in whatever
directory
you
like, give the file an extension of .pl, e.g. myscript.pl
Open an MS-DOS prompt (Start button|Programs|MS_DOS) then
cd (whatever directory you created your script in)
perl -w myscript.pl
Off you go! To make things more interesting, download the
ActiveState
Perl
Debugger, install it, and then use the command perl -wd
myscript.pl
The debugger is free until end of April (I think) when I
guess they will
start charging for it. Perl has a character mode debugger
but I have no
experience of it.
The approach of associating a .pl extension with the
perl.exe doesn't
work
with W95, although does with NT.
##############################################################
Perl tutorials:
http://www.netcat.co.uk/rob/perl/win32perltut.html
http://www.ncsa.uiuc.edu/General/Training/PerlIntro/
##############################################################
Link to the Perlring:
http://www.netaxs.com/~joc/perlring.html
##############################################################
Changing directories in Win32:
print 'Enter directory (default is perl\docs): ';
chomp($dir = <>);
$dir = 'c:\program files\perl315\docs\perl' if ($dir eq '');
chdir $dir or die "Cannot change dir $ERRNO\n";
##############################################################
Evaluate a string inside print:
If you really need to include a piece of perl into a string
(which may be reasonable if using here-doc) try this :
print "N plus one is ${$;.($_=$var + 1)}$_.\n";
Ugly hack, isn't it ;-)
Explanation:
$_=$var + 1 = sets the $_ variable to the result of your
computation
$;.(...) = prepends the result by the value of $;
$; is just a variable that is always
defined and
it's almost guaranteed that there will be
no
variable starting by it's contents
${$;.(...)} = returns the value of a variable whose name
is
computed by evaluating the $;.(...)
the variable should be undefined
${$;.(...)}$_ = prints nothing followed by your desired
text
BTW, if you use here-doc and do not want to have to
"close" string only to be forced to write print <<"*END*"
again
you may do this :
print <<"*END*",$var+1,<<"*END*";
The lengthy text
for many lines
*END*
and the rest
of the lengthy text.
*END*
*****
I tried this and it worked:
my $var = 5;
print ("N plus one is ", $var + 1, "\n");
Try something like the following:
my $var = 5;
my $string "N plus one is ($var + 1)\n";
$string =~ s/\((.*?)\)/eval $1 or '[error]'/ge;
print $string;
which should yield
N plus one is 6
That substitution line grabs everything in parentheses, and
replaces
it with its evaluated form. The 'e' modifier tells the
substitution
operator to use the replacement text as raw perl code. If
the eval
fails, an error message is used instead.
*****
This program illustrates two methods:
<snip>
#!/usr/local/bin/perl -w
use strict;
my $var = 5;
print "@{[$var+1]}\n"; # Evaluates in an array
context
print "${my $v=$var+1;\$v}\n"; # Evaluates in a scalar
context
</snip>
Everywhere you code a variable name you can also code a
BLOCK
(an expression inside a {} pair) that returns a reference to
a
variable. See perlref for details.
##############################################################
Running a script from the browser address line:
> > I'm trying to run a perl script directly from the browser's address
line as
> > follows:
> >
> > anyscript.pl?arg1
> >
> > I've tried reading stdin, getopt, and $_[0] with no success.....How
do I
> > capture the command line argument "arg1" into a program variable?
I believe what you need is something like this:
anyscript.pl?arg1=yes
where the variable is arg1 and the value is yes to see one
in action,
go to yahoo, do a search, and see what your location line
looks like:
http://search.yahoo.com/bin/search?p=smart+kid
##############################################################
Array element count:
++ How can you get the length of an array that's an element
of another
++ array?
++
++ For example, the naive approach doesn't work (prints
581688):
++
++ #!/usr/local/bin/perl
++
++ @test = (["eggs","bacon","juice"],
++ ["sandwiches","cheese"],
++ ["tofu"],
++ ["apple pie"]);
++
++ $length = @test[0]; # how many elements in the
first row?
Well, that's easy. All we need to do is get the array, and
evaluate
it in scalar context.
$test [0] is a ref to the first row.
Hence, @{$test [0]} is the first row.
Now we eval it in scalar context:
printf "%d\n", scalar @{$test [0]};
And that prints '3'.
##############################################################
--
Mark Stackhouse
***********************************************************************
homepage: http://www.execpc.com/~stackhou
"The best things in life aren't things."
--Art Buchwald
***********************************************************************
------------------------------
Date: Sat, 21 Mar 1998 10:29:37 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: - Looking for a Linkchecker script -
Message-Id: <6f0q5h$st6@newsops.execpc.com>
You may want to wander around in the Perlring for awhile.
Loads of good stuff in there (most of it's free). If your
interested, the URL is:
http://www.netaxs.com/~joc/perlring.html
Cheers,
--
Mark Stackhouse
***********************************************************************
homepage: http://www.execpc.com/~stackhou
"The best things in life aren't things."
--Art Buchwald
***********************************************************************
__Olivier__ wrote:
>
> I'm looking for a "Link Checker" script that does following work :
> as argument it should takes a filename (the file would be a list
> of about 300-500 URL's), and should return the same list, saying
> for each URL if it is still valid (working) or not.
> The script would run every night.
>
> Does someone know if such a perl program already exists ? If yes,
> I'd be _very_ interested ! Otherwise, I'll have to create it
> myself...
>
> Thanks for any hints,
> Olivier
>
> --
> Olivier Mueller | omueller@stud.ee.SToPx.ch
> EE Student @ ETHZ | http://www.stud.ee.ethz.ch/~omueller
> ...Please replace "SToPx" by "Ethz" in my email to reply...
------------------------------
Date: Sat, 21 Mar 1998 10:38:11 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Accepting Input from Forms
Message-Id: <6f0qlj$st6@newsops.execpc.com>
Try poking around in the Perlring. I think you'll find what
you need in there.
http://www.netaxs.com/~joc/perlring.html
--
Mark Stackhouse
***********************************************************************
homepage: http://www.execpc.com/~stackhou
"The best things in life aren't things."
--Art Buchwald
***********************************************************************
mr.anime@usa.net wrote:
>
> I'm writing a perl script, and I'm having trouble finding out how to
> read in javascript variables. I know it can be done through forms, but
> I don't know how to write the code. Any help would be appreciated.
------------------------------
Date: Sat, 21 Mar 1998 20:36:54 GMT
From: Sneex <sneaker@earthling.net>
Subject: Apologize...
Message-Id: <3514238B.CFCBD389@earthling.net>
I am sorry about those other
e-mail munged posts...
My anti-spammer got out of hand...
------------------------------
Date: Sat, 21 Mar 1998 15:00:49 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: brosser@gil.com.au
Subject: Re: Can't understand /g (match global) operator - help!
Message-Id: <35141C78.DF15F8E0@coos.dartmouth.edu>
[posted and mailed]
brosser@gil.com.au wrote:
>
> Hi. I've been writing a simple little lexical scanner
> today, and 'discovered' how wonderful Perl's /g regexp
> operator can be.
>
> But, near the end of the project, I'm coming a cropper -
> perl's not working the way I'd expect, so there must be
> (many!) things I still don't understand. I'd like to list
> two examples, and if someone could tell me how/why perl
> does what it does I'd be grateful!
You appear to be using * and /g together when you don't actually want to.
> 1. "abc" =~ /([abc])*/g gives (c, undef).
>
> Why doesn't it match the 'a' first, then the 'b',
> and then the 'c', giving (a,b,c)? And why the trailing
> undef (in all cases where I've used parenthesis and /g)?
First, what does /([abc])*/ match? A sequence of zero or more 'a's, 'b's, and
'c's, with the last character matched stored in $1. So, it will match the
entire string, 'abc', and put 'c' in $1. (Note that /([abc]*)/ would match
the same thing, but put 'abc' in $1.)
Now, what will /([abc])*/g do? The first time it's applied, it matches 'abc'
as above and puts 'c' in $1. Since it matched, the /g causes it to be applied
again. This time, /([abc])*/ matches the sequence of *zero* characters at the
end of the string, and $1 is equal to undef. This is why your expression
returns (c, undef).
You might have meant this:
@matches = "abc" =~ /([abc])/g;
or this, although probably not:
"abc =~ /([abc]*)/;
@matches = split //, $1;
> 2. "aXa" =~ /(a)*/g gives (a, undef, a, undef)
> which I guess I can understand - at least it's giving
> me both 'a' tokens, although I still don't know why
> the undefs come in. But
Same confusion as above. /(a)*/ matches one 'a', then zero 'a's before the
'X', then one 'a', then zero 'a's at the end of the string.
You probably meant this:
@matches = "aXa" =~ /(a)/g;
> "aaaaaXa" =~ /(a)*/g also gives (a, undef, a, undef)
>
> i.e. it's ignoring the multiple string of a's in the
> first part.
No, it's not ignoring the multiple string of a's. Note the difference between
/(a)*/ and /(a*)/. They match the same strings, but the former puts one 'a'
in $1, and the latter puts all the 'a's in $1.
You probably meant:
@matches = "aaaaaXa" =~ /(a+)/g;
Note the + instead of *, since you don't actually want to match zero 'a's.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 21 Mar 1998 16:44:26 -0500
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Core dump using DB_File
Message-Id: <ken-2103981644260001@news.panix.com>
Hi there,
I've got a fairly simple Perl script that dumps core. Its purpose is to
go through a database file (DB_File) and remove unneeded data. I vaguely
recall that older versions of Perl or DB_File or db had core-dumping
problems - can anyone confirm? Here's my Perl (owned by an ISP, I can't
make them upgrade :-(
________________________________________________________
[~],4:21pm% perl5 -MDB_File -e 'print ("$DB_File::VERSION\n");'
1.01
[~],4:26pm% perl5 -V
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
Platform:
osname=sunos, osver=4.1.4, archname=sun4-sunos
uname='sunos panix4.pa 4.1.4 3 sun4m '
hint=recommended, useposix=true, d_sigaction=define
Compiler:
cc='gcc', optimize='-O', gccversion=2.5.8
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=true
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, randbits=31
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ucblib
libs=-lnsl -ldbm -ldb -lm -lc -lposix
libc=/usr/lib/libc.a, so=none
Dynamic Linking:
dlsrc=dl_none.xs, dlext=none, d_dlsymun=, ccdlflags=''
cccdlflags='', lddlflags=''
@INC: /usr/local/lib/perl5.003/sun4-sunos/5.003 /usr/local/lib/perl5.003
/usr/local/lib/perl5.003/site_perl/sun4-sunos /
usr/local/lib/perl5.003/site_perl .
________________________________________________________
I don't know what version of db is being used - how do I determine this?
My provider also seems to have a Perl 5.004_03 lying around. I've run the
script under that, and the script dies with an "Allocation too large"
error. Under 5.004_03, the DB_File version is 1.15.
Thanks for the help.
------------------------------
Date: 21 Mar 1998 20:14:47 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: cperl and emacs 19.28 -- HELP
Message-Id: <6f173n$mol$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Allen Choy
<achoy@us.oracle.com>],
who wrote in article <35117415.1285D780@us.oracle.com>:
> Hi.
>
> I recently picked up cperl-mode.el and am a recent user of emacs. Can
> someone tell me
> how I can change the color schemes? Some perl builtins like 'ref' show
> up in extremely
> dark colors.
>
> --Allen
>
Cperl comes with a lot of documentation, hints, problems/nonproblems
descriptions and so on.
Hope this helps,
Ilya
P.S. Please let me know wheter the newer version work with 19.28. The
intent is there, but I have no way to actually check it...
------------------------------
Date: 21 Mar 1998 20:30:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: fork/exec
Message-Id: <6f180q$o4f$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Neil Briscoe
<neilb@zetnet.co.uk>],
who wrote in article <memo.19980320204729.32767A@skep.compulink.co.uk.cix.co.uk>:
> Nevertheless, I can't help agreeing with Tom's "Win32 is unlikely to be
> helpful to anyone" ;-))). Hope I've paraphrased that roughly accurately.
This depends. I know close to zilch about POSIX, but is it *possible*
to code this in POSIX:
Write a subroutine which given @_ starts an asyncroneous process
given by $_[0] with @_ as argv. Print "OK\n" if succesful.
I understand that it is easy to do if you were asked to
Print "not OK\n" if not succesful.
(using some simple IPC with forked kid). However, my limited
understanding of fork()/exec() gives me no way to solve the above
problem without busy waiting reading output of "ps" and hoping that
"@_" runs long enough, and pids are not reused.
Note that most DOSISH ports follow OS/2 convention, so should be able
to do the above with
sub doit { system 1, @_ and print "OK\n" }
Ilya
------------------------------
Date: Sat, 21 Mar 1998 12:06:22 -0800
From: "David C. McCall" <cyberman@sonoma.edu>
Subject: HTTPd: malformed header from script .HELP?
Message-Id: <35141DBE.200CC560@sonoma.edu>
Thanks ahead of time....I'll be greatful for a place to start!
Here's the situitation:
SunOS4.1.3 SparcIPX64mb, PERL 54, CGI.pm-2.37030 ...NCSA httpd 152
Here's the error message:
Can't use an undefined value as a symbol reference at (eval 7) line 10.
[Sat Mar 21 08:23:34 1998] HTTPd: malformed header from script
/home/wwwServers/httpd152/htdocs/wcb/scripts/instructors/add.student.cgi
Here's the add.student.cgi:
#!/usr/local/bin/perl
use CGI;
$query = new CGI;
use Wcbsubs qw(:DEFAULT);
use Write_Html qw(:DEFAULT);
&INIT;
&Init_Course_Info;
&setup;
###########################################################################
### Main routine
if ($query->param) { #if the form has been filled out....
if ($query->param('idno')) { # if the short form has been filled
out....
$id = $query->param('idno');
$id =~ s!,!!g; #get rid of any commas entered in id field
if ($id eq "1") {
&get_newidno;
}
&check_dups;
&get_info; #display the long form
} else { #else if the long form has been filled out....
&update_db;
&create_acct; #add to passwd.db even if access control turned
off, so i
f turned on later you have student in the password database
&Write_Roster_Page;
&Create_Studenthp;
$course_cnt = &Check_WCB_Delete("$username");
&finish;
exit 0;
}
}
blah blah blah...
------------------------------
Date: Sat, 21 Mar 1998 20:15:18 GMT
From: "You Spammer!" <default@user.org>
Subject: Re: HTTPd: malformed header from script .HELP?
Message-Id: <35141E7C.5D8C1F2C@user.org>
Just so you know, I use Web Course in the Box too :-)
It does not like CGI.pm-2.37030 - you will need to
go back to CGI.pm 2.36x if you want to continue
to use WCB. I have spoken with Madduck and
they are working with Lincoln Stein to get a fix.
HTH,
Sneex :-)
David C. McCall wrote:
> Thanks ahead of time....I'll be greatful for a place to start!
>
> Here's the situitation:
> SunOS4.1.3 SparcIPX64mb, PERL 54, CGI.pm-2.37030 ...NCSA httpd 152
>
<snipped>
------------------------------
Date: 21 Mar 1998 16:00:16 -0500
From: toto@panix.com (Todd N. Tolhurst)
Subject: Re: Insensetive EQ
Message-Id: <6f19p0$5qs@panix3.panix.com>
In article <6ergr2$kis$1@nnrp1.dejanews.com>, <wsayegh@lynx.neu.edu> wrote:
>Hey PERL eXperts:
>
>How could I come up with an insesetive EQ in perl. Here is a function that I
>wrote, and which is missing the "test" part.. if you know how to modify the
>code go ahead.. If you would like to suggest another way to do it, then go
>ahead too. What I am trying to accomplish is to have a function that will
>store the files wich have "_sim" in array1, and the files that don't have
>"_sim" in array2. Here is a part of the code:
[snip]
By "insensitive EQ", it seems that you mean that you want a pattern-
matching operator. Of course, this happens to be one of Perl's particular
strengths. The following code will do what you want:
#!/usr/bin/perl
die "Error!" if !attitude_problem('/path/to/search','_sim',\@match,\@mismatch);
print "Match:\n",join("\n",@match),"\n\n";
print "Mismatch:\n",join("\n",@mismatch),"\n\n";
sub attitude_problem {
my($dir,$pattern,$arefmatch,$arefnmatch)=@_;
opendir(DH,$dir) or return 0;
foreach (readdir(DH)) {
push(@{/$pattern/ ? $arefmatch : $arefnmatch},$_);
}
closedir(DH);
return 1;
}
>Please note.. Don't give me the nonesense you give to everyone else, "Go read
>the perl manual", "did you check out perl.com before you asking this dumb
>question". Well I didn't.. I have the PERL O'Reilly book, and it wasn't as
>helpfull as the Korn Shell O'Reilly book, nore the Sed & Awk O'Reilly book,
>and frankly I don't have time surfing the web to look for these simple
>tutorials that do nothing. If you want to help me.. Hey go ahead.. if you
>don't want to do so.. then keep your comments to yourself. And thanks to those
>that helped me, are helping me, and will help me.
And now that I've helped you, allow me to make the following
observations:
(1) Until you read and understand the Perl documentation, you'll
probably never understand how to do such simple tasks as
this one, much less anything more substantial.
(2) The O'Reilly (Camel) Perl book is very, very good. If you didn't
find it helpful, perhaps you weren't trying very hard.
(3) If you don't have the time to look this stuff up, why should
anyone take the time to do your work for you?
(4) You're welcome. This once.
--
Todd N. Tolhurst Love is not love Which alters when
Periwinkle Communications it alteration finds, Or bends with
toto@toto.com the remover to remove.
http://www.toto.com/toto -- Wm. Shakespeare
------------------------------
Date: Sat, 21 Mar 1998 20:10:20 GMT
From: "You Spammer!" <default@user.org>
Subject: Re: Perl Daemons
Message-Id: <35141D52.3358A1CE@user.org>
Oh, and make you are
standing 'outside' of the
pentagram when you
start chanting. The
daemons like better that
way :-)
Ronald J Kimball wrote:
> On the evening of a full moon, draw a pentagram on the floor with chalk.
------------------------------
Date: 21 Mar 1998 20:20:43 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Daemons
Message-Id: <6f17er$nem$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Benjamin Holzman
<bholzman@mail.earthlink.net>],
who wrote in article <3511E531.64FE39C0@mail.earthlink.net>:
> > The code to do this is :-
> >
> > #!/usr/local/bin/perl
> >
> > if (fork()) { # Invoke a child
> This is unlikely be very helpful in win32, I believe...
Depends on the port. EMX port will have no problem with this.
Ilya
------------------------------
Date: Sat, 21 Mar 1998 13:50:31 -0800
From: "John Scrimsher" <john_scrimsher@hp-corvallis.cv.hp.com>
Subject: Re: Perl on IIS
Message-Id: <6f1cn8$56f@hpcvsnz.cv.hp.com>
The first thing that I would check is in the Directories section of the
IISAdmin, do you have your cgi-bin listed with execute permissions? In my
experience the most common problem is giving read but not execute, so the
server only presents it to the browser for reading (i.e. downloading)
John Scrimsher
Computer Integrated Manufacturing
Hewlett Packard Co.
Corvallis, Oregon
john_scrimsher@ex.cv.hp.com
Ieong Sze Chung Ricci wrote in message <6enn12$s4f@ustsu10.ust.hk>...
>
> I would like to use Perl Script on MS IIS. Can any one please tell
>me possible solution.
------------------------------
Date: Sat, 21 Mar 1998 10:23:52 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: PerlRing???
Message-Id: <6f0pqq$st6@newsops.execpc.com>
I did a quick text search of this Usenet and found no
references to the Perl Ring. One would think that since CGI
type posts seem to be irritating to most who hang out here
that someone would recommend that these posters spend some
time in there. I could spend days reading all the great
stuff embedded in those URLs. Just curious. If anyone is
interested, the URL is:
http://www.netaxs.com/~joc/perlring.html
Along similar lines. I've been to many many URLs on the Net
that provide excellent "Site Search Engines". Why hasn't
such an efficient tool been incorporated into Perl FAQ and
Perl DOCS? I would think an Expert could put something like
this together in less than an hour. Wouldn't that make more
sense than repeatedly recommending that "first time posters"
read this perldoc or that perldoc? It must have taken
literally months to assemble these docs. Why didn't someone
spend a few more hours making the data that's there easier
to access? A text search from ones brouser seems to fall
short here. This is by no means a "flame". I'm just
curious. There has to be a very good reason why it wasn't
done. I, for one, would just like to know what that reason
is?
Regards,
--
Mark Stackhouse
***********************************************************************
homepage: http://www.execpc.com/~stackhou
"The best things in life aren't things."
--Art Buchwald
***********************************************************************
------------------------------
Date: Sat, 21 Mar 1998 22:54:20 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: PerlRing???
Message-Id: <1d69hyw.a1yeooyjyakgN@host043-206.seicom.net>
Mark Stackhouse <stackhou@execpc.com> wrote:
> Along similar lines. I've been to many many URLs on the Net
> that provide excellent "Site Search Engines". Why hasn't
> such an efficient tool been incorporated into Perl FAQ and
> Perl DOCS?
As far as I know, such a thing exists right at the www.perl.com
startpage, just scroll down a little. It's on the left hand side
together with a lot of predefined keywords.
<musings>
Since Perl is cross-platform, maybe it would be a good idea to have a
cross-platform version of the docs instead of (or complementing) the
pod-files ?
This way anyone who knows how to use a browser program could access the
files. Some people do not even have a UNIX compatible command-line and
therefore are not able to use "perldoc ..." due to simple incapacity of
their machines.
Sure, there are ways to acces the docs on every system, but if everybody
could access the docs in the same manner, reffering someone to the docs
would be a bit more standardized thus avoiding confusion and saving
bandwidth/time/energy...Oh, well, yes, what about Perl4 questions...:-)
It surely won't solve all the problems but it could be part of a
solution.
</musings>
Joergen
--
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------
------------------------------
Date: 21 Mar 98 20:14:24 GMT
From: "TomH" <beans@bedford.net>
Subject: Re: R.E.
Message-Id: <01bd5438$20aaad00$579163ce@beans.bedford.net>
If this isn't a FAQ there ain't one. It gets asked so often I know the
answer by heart:
perlfaq4 "How can I split a [character] delimited string except when inside
[character]? (Comma-separated files)"
Look in www.perl.com on the left side down toward the bottom (well below
the link to FAQs hint, hint) is a link to "Regular Expressions"
...
> can anyone help me with one regular expression?
>
> for example,
> i have one string> ' "hello here" hi there '
> and i want to put it in an array like this:
> arr[0] = hello here
> arr[1] = hi
> arr[2] = there
...
> and i'd like also, if possible, an URL with something about regular
> expressions!
------------------------------
Date: Sat, 21 Mar 1998 20:07:41 GMT
From: "You Spammer!" <default@user.org>
Subject: Re: reset a array?
Message-Id: <35141CB2.40B228FE@user.org>
Super :-)
I couldn't tell if you wanted to 'empty' it or
delete it...
Sneex :-)
Magnus "ShockMan" Blikstad wrote:
> @array = "";
> wont work, thats how i had it before... well, it kinda works but it wont
> remove the array it will just put nothing in it... but it will still be there.
>
> undef @array; works fine though! thanx alot...
>
> Sneex wrote:
>
> > Try either -
> > undef @array;
> > @array = '"";
------------------------------
Date: 21 Mar 1998 16:12:25 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: reset a array?
Message-Id: <x7pvjfhhom.fsf@sysarch.com>
Sneex <chasecreek.systemhouse@usa.net> writes:
> Try either -
> undef @array;
> @array = '"";
sorry, sneex, the last one is wrong. it will set the array to a list of
one element which is a null string. and your quotes are mismatched too.
you wanted:
@array = () ;
while undef @array actually removes it from the symbol table which is
more than just resetting it.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---- 8 Years of Perl Experience, Available Immediately
uri@sysarch.com --------- Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net -------- http://www.northernlight.com
------------------------------
Date: Sat, 21 Mar 1998 16:41:54 -0800
From: Steve Palincsar <palincss@tidalwave.net>
To: "Magnus \"ShockMan\" Blikstad" <shockman@telefragged.com>
Subject: Re: reset a array?
Message-Id: <35145E52.1611@tidalwave.net>
Magnus "ShockMan" Blikstad wrote:
>
> how do i reset a array, i need to do this in one of my CGI scripts... i
> looked through the perl documents but i cant find anything... any ideas?
>
> -Magnus "ShockMan" Blikstad
@array_in_question = ();
------------------------------
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 2153
**************************************