[7380] in Perl-Users-Digest
Perl-Users Digest, Issue: 1005 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 10 11:10:02 1997
Date: Wed, 10 Sep 97 08:00:39 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 10 Sep 1997 Volume: 8 Number: 1005
Today's topics:
Re: Access and Perl (Erik Y. Adams)
Re: array of references won't work (Matti Kinnunen)
Re: array of references won't work <rootbeer@teleport.com>
backreferences and /i in regex (Tom Grydeland)
Re: Book: Dynamic HTML Primer (William Wue(2xP)elma(2xN))
Re: Building dynamically named arrays <rootbeer@teleport.com>
Re: Building dynamically named arrays (Andrew M. Langmead)
Re: Building dynamically named arrays <nnyxcu@ny.ubs.com>
Call remote perl script in another script (Wei Tang)
Re: Call remote perl script in another script <bob@inorbit.com.NOSPAM>
CGI: Installing "Adverts" (Scott W. Spain)
Re: Clearing screen in CGI (felix k sheng)
Cookies <buck@huron.net>
Re: feeding keystrokes to telnet (jim williams)
Re: Getting a file from some other server <dennis.kowalski@daytonoh.ncr.com>
Re: Help in search script <mturk@globalserve.net>
Re: Hunh? Why DOES this work??? <rootbeer@teleport.com>
Re: Is it a module, or what? <rootbeer@teleport.com>
Re: Matrices in Perl (David Alan Black)
Re: Matrices in Perl <eike.grote@theo.phy.uni-bayreuth.de>
Re: Matrices in Perl (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Migrating to Berkeley db 2 using DB_File? (Ken Williams)
Re: Need some help with &parse_form_data <rootbeer@teleport.com>
NEWBIE: Installing Perl on desk top spalding@netcom.ca
PERL to restrict URL access (Julian Cook)
Re: PERL to restrict URL access (brian d foy)
Re: Regexp a Yes or No question? (Tad McClellan)
Re: Regexp a Yes or No question? <Brett.W.Denner@lmtas.lmco.com>
Secure Mail Module??? <areeves@us.ibm.com>
Re: shell command "more" (Lorenzo Pesce)
Re: sumcheck generator wanted <dennis.kowalski@daytonoh.ncr.com>
Re: Testing attempts fail.. <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Sep 1997 07:12:06 -0800
From: erik@earthlink.net (Erik Y. Adams)
Subject: Re: Access and Perl
Message-Id: <erik-ya023180001009970712060001@news.earthlink.net>
In article <3415AED7.271F@cloverleaf.net>, charles.engelke@cloverleaf.net wrote:
>
> Use ODBC. Set up an ODBC DSN pointing to your Access database with the
> Control Panel first. Say you call it "demo". Then you can use the
> following code to fetch the results of an SQL query, such as getting all
> fields of all records from table XYZ:
>
<code samples deleted>
If you're programming in PerlScript for ASPs, you can also use the ADO,
more or less how you use it in VBScript.
Erik
------------------------------
Date: 10 Sep 1997 14:21:20 +0300
From: matti@universe.pc.helsinki.fi (Matti Kinnunen)
Subject: Re: array of references won't work
Message-Id: <lzwwkpqurz.fsf@universe.pc.helsinki.fi>
In article <5v5al3$957$1@u30039.rsv.svskt.se> matlar@rsv.se (Mats Larsson) writes:
the last line of the script below should be
print ${$tab[0]},"\n";
***********
The script looks like this :
#!/rsv/pd/bin/perl5
$one = "Stockholm";
$two = "Rome";
# array of references won't work
# @tab = (\$one, \$two);
$tab[0] = \$one;
$tab[1] = \$two;
# both of the two methods above tested, neither works as intended
print $$tab[0],"\n"; # ? prints just an empty line
print $tab[0],@\n"; # prints address to scalar
--
* matti.kinnunen@helsinki.fi *
* http://universe.pc.helsinki.fi/~matti/contact.html *
* +358-(0)40-593 50 91 but try first +358-(0)9-191 23978 *
------------------------------
Date: Wed, 10 Sep 1997 06:29:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mats Larsson <matlar@rsv.se>
Subject: Re: array of references won't work
Message-Id: <Pine.GSO.3.96.970910062615.644Q-100000@julie.teleport.com>
On 10 Sep 1997, Mats Larsson wrote:
> $tab[0] = \$one;
> print $$tab[0],"\n"; # ? prints just an empty line
You're getting ${$tab}[0] instead of ${$tab[0]} . You may drop the braces
around the ref only if it's "just a plain scalar".
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Sep 1997 14:14:30 GMT
From: tom@mitra.phys.uit.no (Tom Grydeland)
Subject: backreferences and /i in regex
Message-Id: <slrn61dapq.v2n.tom@mitra.phys.uit.no>
I seem to recall a bug fix description claiming to fix it so that
backreferences and /i should work together.
I have a problem deciding for myself exactly *how* backreferences and /i
*should* work together. There are two possibilities:
1) The backreference *must* match have the same text (including
capitalisation) as the original text
2) The backreference *must* match have the same text (ignoring case)
as the original text
In case 1), /(friend).*\1/ would match 'friend friend' or
'FRiend FRiend', but not 'fRIend FRienD'. In case 2) the regex will
match all the strings.
If I want to see the same word twice on a line, regardless of how it is
capitalised, but *only* if it the same in both cases, will I have to
resort to
/([Ff][Rr][Ii][Ee][Nn][Dd]).*\1/ ?
(of course, if it was different, matching 'Friend friend' would be
equally difficult)
I'm not sure which interpretation is more obvious.
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Wed, 10 Sep 1997 14:24:06 GMT
From: williamw@rooster.igs.deleteTheRooster.net (William Wue(2xP)elma(2xN))
Subject: Re: Book: Dynamic HTML Primer
Message-Id: <3416ad12.4077532@news.igs.net>
On Tue, 09 Sep 1997 08:13:43 -0700, John Ratzan <ratzan@us.ibm.com>
wrote:
>John Burke wrote:
>>
>> There's a new book available from MIS:Press called "Dynamic HTML: A Primer", by Simon St. Laurent. It's a great intro to the topic and perhaps the first book out on the subject. You can find more information and an excerpt at:
>>
>> http://www.smartbooks.com/bw709dynhtmlprim.htm
>>
>> I hope this is helpful.
>>
>> John Burke
>
>Do you know of any additional books or resources on Dynamic HTML?
Netscape has a document entitled "Dynamic HTML in Communicator"
http://developer.netscape.com/library/documentation/communicator/
dynhtml/contents.htm
<SARCASM>(nice short URL, Netscape...)</SARCASM>
it covers a number of different elements including style sheets,
layering and downloadable font definitions.
-------------------------
William Wue(2xP)elma(2xN)
Reply-To: williamw (at) igs (dot) net
--------------------------------------------------------------
It is pitch black. You are likely to receive spam from a grue.
------------------------------
Date: Wed, 10 Sep 1997 06:06:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Matt Noel <mgn00@eng.amdahl.com>
Subject: Re: Building dynamically named arrays
Message-Id: <Pine.GSO.3.96.970910060257.644N-100000@julie.teleport.com>
On Tue, 9 Sep 1997, Matt Noel wrote:
> I would like to read some data into multiple associative arrays, where
> the array names are based on the data in the file.
Sounds like a job for references. Specifically, a hash of hashes.
> I was trying to figure out how to do this with type globbing, reading
> the description of it in the original camel book (pages 101-102) but I
> can't get anything to work.
Get the new Camel instead, or read perlref, perllol, and perldsc. Or all
of the above. :-)
> I'd really like to get by with a solution which works with perl 4.* as I
> need to port this to a system where the latest level of perl is 4.36.
It would be easier to install 5.004 than to write this stuff in a
Perl4-compatible way. At least, if you want your code to be reliable! :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Sep 1997 13:17:51 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Building dynamically named arrays
Message-Id: <EGAnLs.5Gz@world.std.com>
Matt Noel <mgn00@eng.amdahl.com> writes:
>I would like to treat the first thing ('ArrayOne' and 'ArrayTwo' in this
>case) as the name of an associative array. I would treat the other two
>values as an index into the array, and a value to store at that index.
How about if you make a hash as a common root structure, and have
ArrayOne and ArrayTwo as elements of the hash. Because basically, this
is what you are doing, but you're just trying to use perl's symbol
table as the root level.
In perl 5, you can say:
($key, $subkey, $data) = split /:/;
$hash{$key}{$subkey} = $data;
and then access $hash{ArrayOne}{one} instead of $ArrayOne{one}.
But since you want perl 4 compatibility, you'd need something more like:
($key,$subkey,$data) = split /:/;
$hash{$key,$subkey} = $data;
>I was trying to figure out how to do this with type globbing, reading
>the description of it in the original camel book (pages 101-102) but I
>can't get anything to work.
To do it with typeglobbing, you'd want something like:
($key,$elem, $data) = split /:/;
{
local(*hash) = $key;
$hash{$elem} = $data;
}
--
Andrew Langmead
------------------------------
Date: Wed, 10 Sep 1997 10:37:05 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
To: Matt Noel <mgn00@eng.amdahl.com>
Subject: Re: Building dynamically named arrays
Message-Id: <3416B091.252F@ny.ubs.com>
'eval' is the secret here.
Construct a string having the code you would write to do it directly,
and then 'eval' the string. It's really magic!
e.g.:
@x = split(/:/, 'ArrayOne:one:I'); # @x is now (ArrayOne, one, I);
$str = "\$$x[0]" . "{$x[1]} = $x[2]"; # I had to break this into two
# pieces to get it to work right.
# You might be able to figure out
# how to do it in one.
# $str is now '$ArrayOne{one} = I'
eval $str; # magic time
# I _love_ perl because of little bits like this!
This will work as long as none of the pieces look like variable names;
i.e. an input string like 'ArrayOne:$hi:$Matt' would hose you.
To protect against that case you could stick in a few extra "'"s:
$str = "\$$x[0]" . "{'$x[1]'} = '$x[2]'"
BTW: it would be worth your time to figure out how to get perl 5 on
your target system--it's a lot more fun :-).
Matt Noel wrote:
>
> I would like to read some data into multiple associative arrays, where
> the array names are based on the data in the file.
>
> Specifically, a trivial example would be a set of data like this:
>
> ---------------------------------------------------
> ArrayOne:one:I
> ArrayOne:two:II
> ArrayOne:three:III
> ArrayTwo:one:1
> ArrayTwo:two:2
> ArrayTwo:three:3
> -----------------------------------
>
> I would like to treat the first thing ('ArrayOne' and 'ArrayTwo' in this
> case) as the name of an associative array. I would treat the other two
> values as an index into the array, and a value to store at that index.
>
> I was trying to figure out how to do this with type globbing, reading
> the description of it in the original camel book (pages 101-102) but I
> can't get anything to work.
>
> Can anyone help out? I'd really like to get by with a solution which
> works with perl 4.* as I need to port this to a system where the latest
> level of perl is 4.36.
>
> --
> Matt Noel mgn00@eng.amdahl.com
> Amdahl Corporation Phone (408) 746-6283
------------------------------
Date: 10 Sep 1997 00:36:38 GMT
From: wtang@cs.ualberta.ca (Wei Tang)
Subject: Call remote perl script in another script
Message-Id: <5v4q2m$l61$1@scapa.cs.ualberta.ca>
Hi, there:
I have two Perl scripts which are on two servers (I have to place
them on two servers), say site1-perl and site2-perl. I want to run
site1-perl as a cron job and call site2-perl in site1-perl, let
site2-perl query a database and then return the results to site1-perl.
Both scripts can be accessed using URL naming convention.
Is that possible? Which is the easiest way? I don't want to implement
the httpd protocol by myself.
Please help me out. Thanks.
CC: wtang@cs.ualberta.ca
------------------------------
Date: Wed, 10 Sep 1997 13:32:05 +0200
From: "Robert J. Alexander" <bob@inorbit.com.NOSPAM>
Subject: Re: Call remote perl script in another script
Message-Id: <34168535.167E@inorbit.com.NOSPAM>
Wei Tang wrote:
>
> Is that possible? Which is the easiest way? I don't want to implement
> the httpd protocol by myself.
Why don't you take a look at the libwww bundle on CPAN (LWP) ???
It implemetds HTTP::Request, Response and UserAgent which should help
you out ... Bob
--
Robert Alexander <bob@inorbit.com>
Via Sciangai, 53 00144 Roma - Italy fax int+39(6)5966.4949
------------------------------
Date: Thu, 11 Sep 1997 02:04:28 GMT
From: swspain@value1.com (Scott W. Spain)
Subject: CGI: Installing "Adverts"
Message-Id: <5v69c1$gpu@bgtnsc03.worldnet.att.net>
I'm hoping somebody here knows something about this script. The
script is "Adverts" and can be found at:
http://awsd.com/scripts/webadverts/index.shtml
I'm setting it up as a link exchange, so I'm using the non-ssi method.
The problem is that when I run the ads_admin.pl file, it doesn't run.
I just get a display of the script. It is chmoded to 755.
This is how I have the variables set up:
$adverts_dir = "/u/web/resea2/cgi-adverts";
$admin_cgi = "http://www.researchinfo.com/cgi-adverts/ads_admin.pl";
$nonssi_cgi = "http://www.researchinfo.com/cgi-adverts/ads_nonssi.pl";
Here are the results of the Perl Script Checker in the Control Panel
Can't find string terminator '"' anywhere before EOF at
/u/web/resea2/cgi-adverts/ads_admin.pl line 1750.
The script itself can be viewed (unfortunatly) at:
http://www.researchinfo.com/cgi-adverts/ads_admin.pl
In fact, all scripts can be viewed (again, unfortunately) at:
http://www.researchinfo.com/cgi-adverts/
Thanks in advance to anybody who can help me with this.
Scott W. Spain
Valuenet
------------------------------
Date: 10 Sep 1997 14:22:43 GMT
From: felix@chance.em.nytimes.com (felix k sheng)
Subject: Re: Clearing screen in CGI
Message-Id: <slrn61db8a.b7e.felix@chance.em.nytimes.com>
On Wed, 3 Sep 1997 kchadha@hotmail.com wrote:
> How would I clear the screen from the GCI script
> after printing a couple of lines ?
i would probably investigate multipart documents. that will
probably do what you are asking.
'lx
--- felix sheng pager 800 979 2171
programmer tel 212 597 8069
the new york times electronic media company e felix@nytimes.com
------------------------------
Date: Wed, 10 Sep 1997 09:50:29 -0400
From: Stephen Hill <buck@huron.net>
Subject: Cookies
Message-Id: <3416A59E.DE073E81@huron.net>
I am using PERL for my scripts, and to set my cookies.
Does anyone know if you can set a cookie by calling the cookie script
with an image tag? And if so, how do you do it?
My script works fine, it extracts the cookie info, BUT it doesn't set
another cookie:-(
buck@huron.net
------------------------------
Date: 10 Sep 1997 14:38:28 GMT
From: jwilliam@mayo.edu (jim williams)
Subject: Re: feeding keystrokes to telnet
Message-Id: <5v6bd4$s4s$1@tribune.mayo.edu>
In article <873816060.12957@dejanews.com>, <NOSPAMbob@hsph.harvard.edu> wrote:
>
>Is there a way to feed keystrokes from a script (tcsh or perl, for
>example) to a telnet session attaching to another host? For example, I
>want to manually telnet to host A, and then run some sort of script or
---cut--
If I understand your question correctly, I believe Expect will do what
you want. It does run on top of perl, but was originally written to work
with Tcl. I use it for telnet and ftp scripts, and it relatively easy
even for someone like me with very little programming experience.
There's a good book from O'Reilly that explains its use.
Hope this is relevant to your problem and actually helpful.
cheers. jim.
------------------------------
Date: Wed, 10 Sep 1997 09:12:05 -0400
From: Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com>
Subject: Re: Getting a file from some other server
Message-Id: <34169CA5.354E@daytonoh.ncr.com>
Terry Lee wrote:
>
> This code works:
>
> open(InFile, "data.txt") || die "Sorry Bozo!\n";
> while ($line = <InFile>)
> {
> print "$line\n";
> }
> close(InFile);
>
> What do I use to open the file on another server other than where the
> code is running?
> For instance, let's suppose I saw a file on
> tigger.number1.com/var/www/temp/data.txt and wanted to display the
> contents like the above example.
>
> I tried this and it did not work:
>
> open(InFile, "tigger.number1.com/var/www/temp/data.txt") || die "Sorry
> Bozo!\n";
> while ($line = <InFile>)
> {
> print "$line\n";
> }
> close(InFile);
>
> Any suggestions?
> Thanks in advance!
> Terry
>
> --
> The beatings will continue until morale improves.....
If you are in a UNIX environment this won't help, BUT
I am working in a NT/WIN95 environment and the following works for me
when I need to access a file on the NT server.
open(InFile, "\\hostname\sharename\data.txt") || die "Sorry Bozo\n";
------------------------------
Date: Wed, 10 Sep 1997 09:23:44 -0400
From: Mike Turk <mturk@globalserve.net>
Subject: Re: Help in search script
Message-Id: <34169F60.644D@globalserve.net>
Marcantonio Fabra wrote:
>
> Hello,
>
> I have a script that searches words received via STDIN in files of a directory.
> I separate the words I want to search by blank.
> The script is functioning well.
> Someone can help me in order to change the script, giving to it the capacity of
> search composed words ?
> For instance, "american theatre" (using the " in order to determine a composed
> word).
>
> I thing the part that need to be changed is the parse_form routine on my script.
> Here you have it :
>
> sub parse_form {
>
> # Obtain the words
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
> # Split the name-value pair
> @pairs = split(/&/, $buffer);
>
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
>
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
> $FORM{$name} = $value;
> }
> }
>
> Thank's in advance.
>
> Regards,
>
> Marcantonio Fabra
Marcantonio:
The routine you have included is a standard routine for parsing form
input.... I doesn't do any searching at all.....check your script for a
another sub....maybe it's called search :)
--
Mike Turk
------------------------------
Date: Wed, 10 Sep 1997 06:09:36 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Trey Valenta <trey@zipcon.net>
Subject: Re: Hunh? Why DOES this work???
Message-Id: <Pine.GSO.3.96.970910060643.644O-100000@julie.teleport.com>
On 9 Sep 1997, Trey Valenta wrote:
> > print %ssn->{$name}, "\n";
> If probably doesn't return an error because it's not wrong.
It _is_ wrong, but nobody promised that perl would catch every error.
Don't rely on it, though; a future version of Perl will either catch it or
make that syntax do something else. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Sep 1997 05:53:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Williams <ken@forum.swarthmore.edu>
Subject: Re: Is it a module, or what?
Message-Id: <Pine.GSO.3.96.970910055054.644L-100000@julie.teleport.com>
On Tue, 9 Sep 1997, Ken Williams wrote:
> Tom Phoenix <rootbeer@teleport.com> wrote:
> >(Be
> >sure that you start with h2xs, since that's really the only way to make
> >modules.)
>
> What? Is this true? Haven't I made modules before that don't use C
> code and don't use h2xs?
If you make a module (even a Perl-only module) without using h2xs, you're
lacking in laziness, impatience, or hubris. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Sep 1997 12:46:46 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Matrices in Perl
Message-Id: <5v64rm$ka9@pirate.shu.edu>
Hello -
akil1@mindspring.com (Kevin Bass) writes:
>(1)
>@matrix = (
> [1, 2, 3 ],
> [4, 5, 6 ],
> [7, 8, 9]
>);
>$matrix [1] [2] = 100;
>Why would the value of 6 at row 1, column 2 in the matrix change to
>100? Why wouldn't the answer be a change of value 2 in the matrix?
Because $matrix[1] is a list reference. The list to which
it is a reference has three elements, initially: (4,5,6).
You then assign 100 to element 2.
Note that you could also write: $matrix[1]->[2] = 100; which
more graphically displays the dereferencing of the list
reference.
>(2)
>Why would the following created the answer (matrix) below?
>$matrix {0} {2} = 100;
>$matrix {1} {0} = 200;
>$matrix {2} {1} = 300;
>answer
>[0, 0, 100]
>[200, 0, 0]
>[0, 300, 0]
I'm not sure what you mean here. The assignments you've
written create a hash called %matrix. It has three keys.
Each of the corresponding values is an anonymous hash
reference. Each of the anonymous hashes so referenced
has one key, and the values for those keys are 100, 200, 300.
What you've written under "answer" are expressions evaluating
to list anonymous list references - I'm not sure where that
came from, or where it fits in. Maybe there's an intervening
step that could clarify the connection?
David Black
dblack@icarus.shu.edu
------------------------------
Date: Wed, 10 Sep 1997 15:05:23 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Matrices in Perl
Message-Id: <34169B13.41C6@theo.phy.uni-bayreuth.de>
Hi,
Kevin Bass wrote:
>
> (1)
> @matrix = (
> [1, 2, 3 ],
> [4, 5, 6 ],
> [7, 8, 9]
> );
> $matrix [1] [2] = 100;
>
> Why would the value of 6 at row 1, column 2 in the matrix change to
> 100? Why wouldn't the answer be a change of value 2 in the matrix?
Don't forget that array indexing starts at 0 (not at 1 which is the
usual case when working with matrices). Thus, $matrix[1][2] means
"row 2" and "column 3" (not "row 1" and "column 2").
> (2)
> Why would the following created the answer (matrix) below?
> $matrix {0} {2} = 100;
> $matrix {1} {0} = 200;
> $matrix {2} {1} = 300;
>
> answer
> [0, 0, 100]
> [200, 0, 0]
> [0, 300, 0]
The lines above don't create something like a two-dimensional array
(like in (1)), but they just show another way of representing a matrix.
Using a hash you don't have to store all the zeroes of the matrix,
but only the non-zero elements. This means that whenever you want to
read an entry of the matrix you must check if the queried hash
keys exist; if they do you can read the element using a syntax like
"$elem = $matrix{2}{1}", if they don't exist you may say "$elem = 0"
(the main purpose of this representation is to save memory).
Hoep this helps, Eike
--
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: Wed, 10 Sep 97 10:02:32 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Matrices in Perl
Message-Id: <3416a91c$5$ofn$mr2ice@speaker.kf8nh.apk.net>
In <5v4s3h$p4h@camel2.mindspring.com>, on 09/10/97 at 01:10 AM,
akil1@mindspring.com (Kevin Bass) said:
+-----
| $matrix [1] [2] = 100;
| Why would the value of 6 at row 1, column 2 in the matrix change to 100?
| Why wouldn't the answer be a change of value 2 in the matrix?
+--->8
Perl, as with just about every computer language except BASIC, starts array
numbering with 0. Thus, the first entry in the matrix is at [0][0], not
[1][1].
If you really want 1-based arrays, you can set the special variable $[ to 1.
(But since BASIC is the "odd one out", you might be better off looking up
OPTION BASE in your BASIC manual....)
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) FORZA CREW!
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
------------------------------
Date: Wed, 10 Sep 1997 10:30:26 -0400
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Re: Migrating to Berkeley db 2 using DB_File?
Message-Id: <ken-1009971030260001@news.swarthmore.edu>
pmarquess@bfsec.bt.co.uk wrote:
>
>Here is my current plan for DB_File.
>
>Firstly, to allow existing DB_File scripts that use Berkeley DB 1.x to
>be easily migrated to Berkeley DB 2.x, I've modified DB_File to allow
>it to be built with either DB 1.x or 2.x (but not both at the same
>time). I uploaded the most recent version of DB_File, 1.53, to CPAN
>yesterday.
>
>When DB_File is built with DB 2.x I've arranged things so that it
>mirrors the DB 1.x API. This means that none of the new functionality
>available in DB 2.x is available. It also means that all existing
>DB_File scripts should run unchanged.
>
>The only thing you have to do is migrate your existing DB 1.x databases
>to DB 2.x. Luckily Berkeley DB 2.x comes with utilities to dump 1.x
>databases and load them into 2.x format.
>
>Next is proper support for all the new stuff in DB 2.x. This is nearly
>ready for its first alpha release. It will not be called DB_File.
>
>Hope that clarified things.
>
>Paul
Yes, thank you. As I understand it, in order to accomplish what I was
asking about, I'd do best to wait for the new release. Either that, or
build your newest version of DB_File with DB 2.x and call it something other
than DB_File on my machine (perhaps DB_File2?). This would allow me to
change each of my applications, one by one, to the new database format,
without breaking the other applications.
Is this possible? I imagine the answer is yes, but is it something I could
do fairly easily, and if so do you advise it?
Another consideration is that I don't want to lose support for my .htaccess
password/group files, so even in my long-range plan I think I have to keep
some support around for DB 1.85. I've heard (but haven't seen in
documentation) that this is the only DB format Apache will recognize. If
you happen to know differently, I'd appreciate the info!
Thank you for your time, I certainly appreciate it!
-Ken Williams
The Math Forum
ken@forum.swarthmore.edu
------------------------------
Date: Wed, 10 Sep 1997 06:02:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Robert Eric Pearse <repearse@mail.utexas.edu>
Subject: Re: Need some help with &parse_form_data
Message-Id: <Pine.GSO.3.96.970910060110.644M-100000@julie.teleport.com>
On Mon, 8 Sep 1997, Robert Eric Pearse wrote:
> Please find a copy of my code and corresponding HTML form.
> [Part 2, Video/X-MPEG 4.7KB]
> [Cannot play this part. Press "V" then "S" to save in a file]
>
> [Part 3, Video/X-MPEG 908bytes]
> [Cannot play this part. Press "V" then "S" to save in a file]
I would if I could! :-) Try again, with type text/plain. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Sep 1997 15:30:58 GMT
From: spalding@netcom.ca
Subject: NEWBIE: Installing Perl on desk top
Message-Id: <5v6au3$j3g$1@tor-nn1.netcom.ca>
Just started into perl and would like to install Perl 5 on my
computer. I have the following in zip format;
Pw32a310. Perl for Win32 Alpha Binary
P1SEa310. Perl Script Alpha Binary
P1ISa310. Perl for ISAPI Alpha binary
Pw32s310. Perl for Win32 Source files
Which files should I be using and is there any way to run the scripts
on my computer without having to use the server, for debugging
purposes. Please e-mail any suggestions would help
Thanks C Spalding
spalding@netcom.ca
------------------------------
Date: 10 Sep 1997 14:10:10 GMT
From: siogo@ari.net (Julian Cook)
Subject: PERL to restrict URL access
Message-Id: <5v69o2$48d@ari.ari.net>
Gentlemen:
I started learning PERL a little while ago and my business has taken off
that I don't have time to devote to learning it as well as I should.
My question is that I would like to restrict access from certain Host
Names. Unfortunately after the business took off, I had to move the server
from my basement to a virtual server, so I don't have access to host.deny
or .htaccess anymore.
What I have is an opening page and once the "Continue" button is pressed,
then have the script to deny access to certain hosts that try to access
the URL.
I know that is probably an easy question and my apologies for not
presenting a more challenging problem but I am SO busy I can barely get
any sleep and I don't have time to figure this one out.
Many thanks in advance!
Julian Cook
------------------------------
Date: Wed, 10 Sep 1997 10:56:24 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL to restrict URL access
Message-Id: <comdog-ya02408000R1009971056240001@news.panix.com>
In article <5v69o2$48d@ari.ari.net>, siogo@ari.net (Julian Cook) wrote:
>My question is that I would like to restrict access from certain Host
>Names. Unfortunately after the business took off, I had to move the server
>from my basement to a virtual server, so I don't have access to host.deny
>or .htaccess anymore.
depending on your server, access control can be done on a per directory
(or even per file) level, so you don't need special access. you might
try this question in the newsgroup dedicated to your server to see
what solutions already exist for you.
you shouldn't pay for crappy service - move to a more flexible web
provider if you can't get the features you need. access control is
a pretty basic feature - you shouldn't have to deal without.
>I know that is probably an easy question and my apologies for not
>presenting a more challenging problem but I am SO busy I can barely get
>any sleep and I don't have time to figure this one out.
and this makes you different from other hackers because...? :)
--
brian d foy <comdog@computerdog.com>
------------------------------
Date: Tue, 9 Sep 1997 20:40:09 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regexp a Yes or No question?
Message-Id: <ppt4v5.rv2.ln@localhost>
Gabor Egressy (gabor@vinyl.quickweb.com) wrote:
: Matthew Cravit (mcravit@best.com) wrote:
: : In article <5v1u1k$8jn$2@flint.sentex.net>,
: : Gabor Egressy <gabor@vinyl.quickweb.com> wrote:
: : >: if ($response =~ /^[YyTtOo]/) {
: : >
: : >what if the user types 'yellow'
: : >should that be accepted?
: : As far as I'm concerned, if my program asks the user
: : Do you want to frobnicate the data (yes/no)?
: : and the user types "yellow", then s/he deserves what s/he gets. :)
: : Seriously, though, if you're really concerned about the user typing
: : random text in response to a yes/no prompt, it's probably better to
: : say
: I was thinking more along the line
: if(/^([yY]([eE][sS])?)?$/) {
^
^
So if the luser just hits return without any other keys, the
'do whatever' part should be executed?
I think it is easier to read if you write it this way:
if(/^y(es)?$/i) {
: do whatever;
: }
: else {
: say something nasty; :-)
: }
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 10 Sep 1997 09:01:47 -0500
From: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
Subject: Re: Regexp a Yes or No question?
Message-Id: <3416A84B.41C6@lmtas.lmco.com>
Sylvain St.Germain wrote:
>
> How do you regexp the answer to
> a yes or no question?
>
> I mean Y, y, yes, Yes, YES, YEs, yES,
> OK, ok, Ok, oK, true, TRUE ...
>
> and
>
> No, no, No, nO....
>
> Sylvain.
sub verify
{
$response = shift;
# note: each key must have a different first character
%answers = ( yes => 1, ok => 1, true => 1, good => 1,
"no" => 0, false => 0, bad => 0 );
foreach (keys %answers) {
return $answers{$_} if /^$response/i
}
return undef;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brett W. Denner Lockheed Martin TAS
Brett.W.Denner@lmtas.lmco.com P.O. Box
748
(817) 935-1144 (voice) Fort Worth, TX 76101
(817) 935-1212 (fax) MZ 9333
------------------------------
Date: Wed, 10 Sep 1997 09:31:00 -0700
From: Adam Reeves <areeves@us.ibm.com>
Subject: Secure Mail Module???
Message-Id: <3416CB44.7D43@us.ibm.com>
Does anyone know of an existing module, or
has anyone written a secure mailing module
for UNIX?
The module MailTools on CPAN is ok, but one
of the "to do's" is to add security.
Any help would be greatly appreciated!!!!!
Cheers,
Adam Reeves
areeves@us.ibm.com
------------------------------
Date: 10 Sep 1997 12:54:06 GMT
From: fish@chemie.fu-berlin.de (Lorenzo Pesce)
Subject: Re: shell command "more"
Message-Id: <5v659e$fbv$1@fu-berlin.de>
I have a question about how to send the output through
more | less |whatever a pager is.
I know how to:
open (FILEHANDLE,"|more ...)
but I'd like:
open (FILEHANDLE,"|xterm ....)
^^^^^
Because I'd like to send the report to an xterm.
Hope it's not a faq.
thanks in advance,
lrnz
------------------------------
Date: Wed, 10 Sep 1997 08:17:11 -0400
From: Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com>
Subject: Re: sumcheck generator wanted
Message-Id: <34168FC7.41FF@daytonoh.ncr.com>
Jim Michael wrote:
>
> Dennis Kowalski (dennis.kowalski@daytonoh.ncr.com) wrote:
> : Does anyone know of a sumcheck generator similar to the UNIX sum command
> : that will run in a NT/WIN95 environment ?
>
> What type of checksum do you require. I did extensive searching of
> dejanews on this subject so can point you to several items of interest. I
> settled on an MD5 solution. I also wrote a table driven CRC in Perl based
> on previously posted c code.
>
> Cheers,
>
> Jim
I would be interested in getting whatever solution you have.
We just need something that will verify if a file is the same as it was
when released.
------------------------------
Date: Wed, 10 Sep 1997 06:23:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Eric Hilding <eric@garlic.com>
Subject: Re: Testing attempts fail..
Message-Id: <Pine.GSO.3.96.970910061132.644P-100000@julie.teleport.com>
On Tue, 9 Sep 1997, Eric Hilding wrote:
> Ugh...I changed my data for testing but it still won't print anything
> for the $Subject string.
> I'm using the same if <blah> type of =~ matches that work find in the
> rest of the exiting script...what I'm trying to to is modify the
> Subject: line based upon certain info that comes in, so I can use
> .procmail recipies for routing to different mailboxes based upon the
> different Subject: lines.
I don't see any code which alters $Subject in your posting. Could that be
the problem?
> $FORM{'e2'} =~ 'Test Name';
> $FORM{'e4'} =~ 'Morgan Hill';
> $FORM{'r9'} =~ 'r9a';
> $FORM{'r9'} =~ 'r9b';
Those lines are (mostly) useless. What do you want them to do?
> $Subject eq "WWW Possible Agent - $FORM{'e2'}\n\n";
That's also useless. Do you want to assign a value to $Subject with the =
operator?
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
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 1005
**************************************