[7299] in Perl-Users-Digest
Perl-Users Digest, Issue: 924 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 26 14:17:50 1997
Date: Tue, 26 Aug 97 11:00:38 -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 Tue, 26 Aug 1997 Volume: 8 Number: 924
Today's topics:
Re: $#name ???? <rael@zx81.dnai.com>
Re: Email address verification <boss.hogg@prozac.org>
Re: Email address verification (Greg Bacon)
GD.pm and text at angle? <byersa@agva.com>
Re: HELP! WinNT/perl cgi newbie <ryanb@netscape.com>
Re: Help!! mail from cgi/perl-script under win-nt/windm <ryanb@netscape.com>
Re: Help: Give Perl to an uneducated slob & this is wha <rootbeer@teleport.com>
Re: How do I break up a line <pcunnell@csfp.co.uk>
Re: How do I pass data to a sort function? (Greg Bacon)
Re: Info needed: implementation of hash tables? (Mike Stok)
Re: Modem Control (Charlie Stross)
Re: Need help: how to exit a subroutine if a test insid <rootbeer@teleport.com>
Re: Perl (kind of) math question. <seay@absyss.fr>
Re: Perl (kind of) math question. (Greg Bacon)
Re: Perl (kind of) math question. <tonylabb@infonline.net>
Perl and DDE commands <pascal_amram@ml.com>
Re: perl bug in pushing anonymous arrays?? (Mike Stok)
perl modules and OOP (dmouse)
Re: perl modules and OOP (M.J.T. Guy)
Re: Perl Regular Expression has a bug? (Andreas Schmidt)
perl script suid problem in Solaris 2.5.0 <fil@amnh.org>
Re: Perl/Tk Examples?? <johnsone@camax.com>
Re: protect a perl-script (Greg Bacon)
require error ("did not return a true value") (Alan Leung)
Re: require error ("did not return a true value") (Greg Bacon)
Re: require error ("did not return a true value") (Billy Chambless)
Re: require error ("did not return a true value") (M.J.T. Guy)
Returning a hash list (associative array) (Jacob Miner)
Re: Safe Perl Programming Manual?? Book??? (Greg Bacon)
Re: Search Engine scripts ? (Faust Gertz)
Re: sort - help needed (Mike Stok)
Suppressing a specific Perl warning (Terry Michael Fletcher - PCD ~)
Re: uninit'd value annoyance (M.J.T. Guy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Aug 1997 09:45:50 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: $#name ????
Message-Id: <87en7gc2pt.fsf@zx81.dnai.com>
denis@mathi.uni-heidelberg.de writes:
> there i read something like $list[$#list]. what does $#list mean?
$#list refers to the index of the last element in the array @list.
Therefore, $list[$#list] refers to the value of the last element
in the array @list. This is equivalent to $list[-1].
For example...
@list = ("one","two","three");
print $#list; # prints "2" (remember that array indeces start at 0)
print $list[$#list]; # prints "three"
print $list[-1]; # also prints "three"
Rael
---------------------------------------------------------------------------
/Rael Dornfest/ <title>Maven</title>
%company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206 To: rael@dnai.com
Berkeley, CA 94704 atdt 888 321 3624 (DNAI)
ADDRESS <a href="http://www.dnai.com">Website</a>
------------------------------
Date: Tue, 26 Aug 1997 11:37:49 -0400
From: Kernel Santos <boss.hogg@prozac.org>
Subject: Re: Email address verification
Message-Id: <3402F84D.2781@prozac.org>
John Henson wrote:
>
> This may seem like a stupid question, but can someone
> tell me how to make sure an email address field in a www form
> contains an "@"?.
>
> Thanks in advance,
>
> j:wq
Thanks for the help. But i found an even better one.
Check this out.
$email !~
/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
print "Some kind of error";
}
This seems to do the trick.
j:wq
------------------------------
Date: 26 Aug 1997 15:50:59 GMT
From: gbacon@adtran.com (Greg Bacon)
To: John Henson <johnh@partnersweb.com>
Subject: Re: Email address verification
Message-Id: <5tuu13$rh8$4@info.uah.edu>
[Posted and mailed]
In article <3402E58C.41C6@partnersweb.com>,
John Henson <johnh@partnersweb.com> writes:
: This may seem like a stupid question, but can someone
: tell me how to make sure an email address field in a www form
: contains an "@"?.
Read the entry on index in the perlfunc(1) manpage (if you have
5.004, you can perldoc -f index).
After that, you'd do well to read the Perl FAQ at
http://www.perl.com/perl/faq/
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 26 Aug 1997 12:29:51 -0400
From: Al Byers <byersa@agva.com>
Subject: GD.pm and text at angle?
Message-Id: <3403047F.430F@agva.com>
Does anyone know of any work done in GD.pm to allow text to be drawn at
an arbitrary angle? I assume it would be some sort of polygon-based
library.
--
Al Byers Automation Group of Virginia
(540) 949-8777 P.O. Box 1091
byersa@agva.com Waynesboro, VA 22980
------------------------------
Date: Tue, 26 Aug 1997 09:48:22 -0700
From: "Ryan S. Barton" <ryanb@netscape.com>
Subject: Re: HELP! WinNT/perl cgi newbie
Message-Id: <340308D6.97D25028@netscape.com>
This is a multi-part message in MIME format.
--------------0B857F827DDC2F0EA6DA2F6E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Matthew Cravit wrote:
>
> In article <mblase-2508971350110001@mblase.ncsa.uiuc.edu>,
> Marty Blase <mblase@ncsa.uiuc.edu> wrote:
>
> >- what do filenames look like? (Just C:\dir\dir\file.txt, right?)
>
> No. Since the "\" character is a special one in Perl, you need to double
> it to produce an actual "\". So:
>
> $foo = "C:\\dir\\dir\\file.txt";
>
Actually, running perl 5.003_7, I am able to use the following:
$foo = 'c:\dir\dir\file.txt';
> >- what's the NT equivalent of sendmail, and how to I call it?
>
> There isn't one built in; there are a number of shareware/freeware
> programs you can use to send mail from Perl. I don't have any direct
> experience with any of them, but I'm told blat.exe works pretty well.
> Try searching the web for it.
BLAT.EXE works very well as long as you have access to an SMTP server
via IP, at least for the applications that I have used it for (server
monitoring, etc.) You can find it here:
http://gepasi.dbs.aber.ac.uk/softw/Blat.html
>
> >- what do I put at the top instead of #!/usr/local/bin/perl ?
>
> #!/usr/bin/perl, I think, although as long as it mentions perl, I don't
> think it matters. (NT runs perl scripts based on the file extension, not
> the shebang-magic that UNIX uses.)
Actually, you can use the following:
#!c:\usr\local\bin\perl
and whatever switches you want....
Ryan S. Barton
Senior Systems Administrator
Netscape Communications, Corp.
--------------0B857F827DDC2F0EA6DA2F6E
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ryan S. Barton
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Ryan S. Barton
n: Barton;Ryan S.
org: <FONT COLOR="#000080"><FONT SIZE=+1>Netscape Communications, IS Operations</FONT></FONT>
adr;dom: ;;;;;;
email;internet: ryanb@netscape.com
title: <FONT COLOR="#800000">Senior Systems Administrator</font>
tel;work:
note: <A HREF="http://www.netscape.com">
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------0B857F827DDC2F0EA6DA2F6E--
------------------------------
Date: Tue, 26 Aug 1997 09:50:15 -0700
From: "Ryan S. Barton" <ryanb@netscape.com>
To: ck@pp-ulm.de
Subject: Re: Help!! mail from cgi/perl-script under win-nt/windmail
Message-Id: <34030947.A1BB0FF2@netscape.com>
This is a multi-part message in MIME format.
--------------A7D07ECEDCB35A91420A6EA4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi!
Sounds more like you have not yet set up your Enterprise server to run
CGI scripts. Refer to the docs for Enterprise to setup the Shell-CGI
file-type or directory........you need to do this before the Enterprise
server will recognize a file as executable, and actually execute it.
-Ryan S. Barton
Senior Systems Administrator
Netscape Communications
ol@pp-ulm.de wrote:
>
> I want to send mails from a cgi-perl script.
> I use windmail as mail-client under Windows NT and the Enterprise Server
> 2.0 from Netscape.
> There's a funny thing. When I'm starting the perl-script directly from the
> www-server (in the dos-box), then the script send the mail, as the script
> has to do. But when I start the cgi-perl-script from a html-site like
> "<form method=post action="http://xxx.xxx.de/cgi/script.pl"> or indirect
> from a browser, then the browser get the message "Server error".
> Is this a problem by the server, by the script or what...
> Please for some help and sorry for my english
> christian
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
--------------A7D07ECEDCB35A91420A6EA4
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ryan S. Barton
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Ryan S. Barton
n: Barton;Ryan S.
org: <FONT COLOR="#000080"><FONT SIZE=+1>Netscape Communications, IS Operations</FONT></FONT>
adr;dom: ;;;;;;
email;internet: ryanb@netscape.com
title: <FONT COLOR="#800000">Senior Systems Administrator</font>
tel;work:
note: <A HREF="http://www.netscape.com">
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------A7D07ECEDCB35A91420A6EA4--
------------------------------
Date: Tue, 26 Aug 1997 10:34:42 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Artz <martz@standard.net.au>
Subject: Re: Help: Give Perl to an uneducated slob & this is what ya get
Message-Id: <Pine.GSO.3.96.970826102959.13463H-100000@julie.teleport.com>
On Mon, 25 Aug 1997, Michael Artz wrote:
> I can split the file on the commas, but I need to get rid of the " from
> those fields that have it.
How about this kind of thing? (Assuming that you have a list of items,
some with quotes and some without - this won't work if you haven't split
the lines correctly, of course, but it shouldn't hurt, either.)
@fields = map { s/^"(.*)"$/$1/s; $_ } @fields; # Zap "quotes"
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/
------------------------------
Date: Tue, 26 Aug 1997 15:44:57 +0100
From: Paul Cunnell <pcunnell@csfp.co.uk>
To: Mike Rambour <mikey@inline-tech.com>
Subject: Re: How do I break up a line
Message-Id: <3402EBE9.41C67EA6@csfp.co.uk>
Try this (available at every CPAN site):
NAME
Text::Wrap -- wrap text into a paragraph
SYNOPSIS
use Text::Wrap;
$Text::Wrap::columns = 20; # Default
print wrap("\t","",Hello, world, it's a nice day, isn't it?");
DESCRIPTION
This module is a simple paragraph formatter that wraps text into a
paragraph and indents each line. The single exported function, wrap(),
takes three arguments. The first is included before the first
output line, and the second argument is included before each subsequest
output line. The third argument is the text to be wrapped.
Mike Rambour wrote:
>
> from a textarea in a html form. I have a form with a textarea in it
> and I writing the output to a file, that I later read into a HTML
> page that unfortunately has a PRE in it. The end result is that my
> output is all messed up, if a user presses the return key it all works
> but it they just type in the textarea it ends up as one long line.
>
> What I am trying to do is split the line into multiple lines at 70
> chars or less, but I also need to break up words. I have it working
> at <70 but it splits words.
>
> mike
> mikey at inline-tech dot com
> (replace at with @ and replace dot with . to reply)
>
> And for you automated email spammers out there, here's the email addresses
> of the current board of the Federal Communications Commission:
> Chairman Reed Hundt: rhundt@fcc.gov
> Commissioner James Quello: jquello@fcc.gov
> Commissioner Susan Ness: sness@fcc.gov
> Commissioner Rachelle Chong: rchong@fcc.gov
>
> And let's help you send some spam to the USPS, too:
> customer@email.usps.gov
:-) :-)
--
Paul Cunnell CSFB RDG +44 171 888 2946
------------------------------
Date: 26 Aug 1997 15:17:42 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: joshp@silmaril.com (Josh Purinton)
Subject: Re: How do I pass data to a sort function?
Message-Id: <5tus2m$rh8$1@info.uah.edu>
[Posted and mailed]
In article <5ttsb1$ue$1@shell3.ba.best.com>,
joshp@silmaril.com (Josh Purinton) writes:
: [ posted and mailed ]
:
: The one and only Scott Grosch <grosch@ichips.intel.com> writes:
: > [If] I have something like this:
: >
: > sub bysomething {
: > my $recordA = $href->{records}->{$a}->{someElement};
: > my $recordB = $href->{records}->{$b}->{someElement};
: > $recordA cmp $recordB;
: > }
: > sub someRoutine {
: > my $href = new someClass @args;
: > @blah = sort bysomething keys %{$href->{records}};
: > }
: >
: > Then I'm screwed, since bysomething doesn't have access to $href.
:
: Pass the hash reference to bysomething() like this:
:
: sub bysomething {
: my($hash) = @_;
: $hash->{$a}->{someElement} cmp $hash->{$b}->{someElement};
: }
:
: @sorted = sort { bysomething($href->{records}) } keys %{$href->{records}};
TMTOWTDI! How about a... *fanfare* Schwartzian Transform! :-)
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, $href->{records}->{$_}->{someElement} ] }
keys %{$href->{records}};
Written in longhand:
## get the keys at the level we're interested in
@keys = keys %{$href->{records}};
## bundle keys and an associated interesting value
@keys_elts = map { [ $_, $href->{records}->{$_}->{someElement} ] } @keys;
## sort our bundles by ASCIIbetical comparison of the interesting values
@sorted_keys_elts = sort { $a->[1] cmp $b->[1] } @keys_elts;
## pull the keys out of the sorted bundles
@sorted = map { $_->[0] } @sorted_keys_elts;
You'll notice that if you perform "algebraic-ish" substitution (i.e.
replace @sorted_keys_elts with sort { $a->[1] cmp $b->[1] } @keys_elts)
plus a bit of reformatting, you get the first solution.
map -> sort -> map is a very handy way of massaging data into a useful
format no matter how you choose to express it. :-)
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 26 Aug 1997 15:45:46 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Info needed: implementation of hash tables?
Message-Id: <5tutna$65j@news-central.tiac.net>
In article <5tseou$djh@bcarh8ab.bnr.ca>, Edward Chen <etchen@bnr.ca> wrote:
>I am just curious about how hash tables are implemented in Perl.
How curious? Have you had a look in the source, hv.c is one place to
start (though I generally avoid looking at internals if I can :-)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Tue, 26 Aug 1997 14:42:10 +0100
From: charlie@nospam.antipope.mapson.org (Charlie Stross)
Subject: Re: Modem Control
Message-Id: <slrn605n9i.ld.charlie@SPAMBLOCKED>
forster@na-cp.rnp.br<forster@na-cp.rnp.br> wrote
(in article <872378205.30937@dejanews.com>):
>Hello Folks!
>
>I was wondering... Is there any module or something to control modems?
>
>I've made a script to make dial-up connections using dip, but I have some
>problems with dip. e.g.: when in a PABX.
>
>And of course, I'd like to use only perl on the script.
Sounds like you're after some way of driving a SLIP/PPP session from
Perl? If so, you might want to be more precise.
If not (i.e. if you're asking about serial comms via a modem), then the
answer seems to be, "it's difficult". On some platforms, Comm.pl gives
good results -- not on Linux, as I can testify from personal experience.
(I'm currently playing around with a module I'm writing to control a
modem connection, but as I'm not that knowledgable about tty handling it's
painful in the extreme. And certainly nothing I'd consider ready to pass
on to members of the public.)
-- Charlie
"Many computer scientists have fallen into the trap of trying to define
languages like George Orwell's Newspeak, in which it is impossible to
think bad thoughts. What they end up doing is killing the creativity
of programming." -- Larry Wall
>> To reply: remove NOSPAM and anagrams, or see http://www.antipope.org/ <<
------------------------------
Date: Tue, 26 Aug 1997 10:45:04 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Alex Dong Li <li@globalserve.net>
Subject: Re: Need help: how to exit a subroutine if a test inside fails?
Message-Id: <Pine.GSO.3.96.970826103516.13463I-100000@julie.teleport.com>
On Sun, 24 Aug 1997, Alex Dong Li wrote:
> I am writing a big subroutine. There are some tests in the subroutine.
> Could anyone tell me how to exit the subroutine if a test fails?
Method one: Simply return. Your caller will get undef (in a scalar
context) or the empty list (in a list context), which can signal that an
error occurred.
return unless @_ > 2; # Require two parameters
Method two: Die with an appropriate error message. (This should be
reserved for extreme cases, since it's _much_ less convenient for the
caller. If they fail to prepare for this, their program quits(!) so it
should be an error of that magnitude.) The caller can check for this by
using eval { } to trap the error.
die "Can't open vital file 'foo.text': $!";
In either case, you must be sure that your method is clear to the person
writing the calling code, since that affects the way in which it's called.
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/
------------------------------
Date: Tue, 26 Aug 1997 17:31:53 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Perl (kind of) math question.
Message-Id: <3402F6E9.1E5D6030@absyss.fr>
Ed Jamison wrote:
>
> I just started learning Perl. I got a "Learn Perl in 21 days book. I
> got to the third day with no problems. Then they introduced octal and
> hexidecimal notation. Unfortunately I slept through Calculus (as well
> as a lot of the rest of my first 2 years of college, and I missed any
> info on these types of notations. The book I have supplies a quick
> "tutorial", but I'd like to get some more in depth information. I like
> to have a thorough understanding of something before I have to work with
> it. My question is, where is a good source of information on this,
> preferably on the web?
No idea where to find it on the web, but here is a quick tutorial.
Octal/Decimal/Hexadecimal has zero to do with calculus. They deal with
representation of numeric data. In normal life we use base 10 (0..9)
symbols to represent numbers. This is called "decimal". Computers
don't care for this, they prefer 2^x numbers, namely
1,2,4,8,16,32,64,... (note: using decimal representation). The two that
are closes to dear-old 10 are 8 (octal) and 16 (hexadecimal). Octal
uses the symbols 0..7 and hexadecimal uses 0..9abcdef (yes, 'letters'
are used to show values larger than 9). Here are a few sample values
decimal octal hexadecimal
0 0 0
5 5 5
10 12 a
15 17 f
20 24 14
32 40 20
64 80 50
100 144 64
127 177 7f
255 377 ff
256 400 100
Most programming languages default to decimal numbers unless you
specifically state octal or hexadecimal format. C and Perl state that a
number is decimal unless the first digit is 0, then it is octal. If the
first digit is 0 (octal), but the second is an 'x' then the number is in
hexadecimal. This means that
255 == 0377 == 0xff
0x777 > 777 > 0777.
Usually octal and hexadecimal don't represent negative numbers (minus
sign) unless you are using two's compliment. I'm not about to go into
that here, so if this isn't enough, go get a book.
- doug
------------------------------
Date: 26 Aug 1997 16:19:23 GMT
From: gbacon@adtran.com (Greg Bacon)
To: edwardj@hmsmch.cncoffice.com
Subject: Re: Perl (kind of) math question.
Message-Id: <5tuvmb$rh8$5@info.uah.edu>
[Posted and mailed]
In article <3402EA44.1E7B1682@hmsmch.cncoffice.com>,
Ed Jamison <edwardj@hmsmch.cncoffice.com> writes:
: I just started learning Perl. I got a "Learn Perl in 21 days book. I
: got to the third day with no problems. Then they introduced octal and
: hexidecimal notation. Unfortunately I slept through Calculus (as well
: as a lot of the rest of my first 2 years of college, and I missed any
: info on these types of notations.
No calculus required. Octal is another way of saying base eight, just
as hex or hexadecimal is another way of saying base sixteen. Most
humans are used to dealing with either base ten or base six.
The difference between different bases is the place values for numbers.
In base ten (what we're used to dealing with), as you go left, each
position or place is weighted by increasing powers of ten. There is
also the additional restriction that all digits in base n must be less
than n (e.g. only 0, 1, and 2 are valid in base three). Take the
Answer, for instance:
42 = (4 * 10) + (2 * 1) = (4 * 10**1) + (2 * 10**0)
Another example:
120 = (1 * 100) + (2 * 10) + (8 * 1) = (1 * 10**2) + (2 * 10*1)
In octal (base eight), the Answer is expressed as
52 = (5 * 8) + (2 * 1) = (5 * 8**1) + (2 * 8**0)
Hex (base sixteen) is interesting because we're used to expressing the
numbers 10 through 15 with two digits. The convention is to use the
letters a-f for these numbers. The Answer in base sixteen is
2A = (2 * 16) + (10 * 1) = (2 * 16**1) + (10 * 16**0)
Numbers in different bases are especially useful in the realm of
computer science because they form compact ways of expressing bit
patterns. The most common example is permissions of Unix files. Octal
is convenient because each octal digit expresses three bits. For
instance, chmod 755 file results (roughly) in permission bits of
111101101 or
rwxr-xr-x
BTW, I wouldn't try to learn Perl from a book that has number in its
title. The perlbook(1) manpage has suggestions for good Perl books.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 26 Aug 1997 12:46:25 -0400
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: Perl (kind of) math question.
Message-Id: <34030860.610CF96A@infonline.net>
This is a cryptographically signed message in MIME format.
--------------ms100046FE402D9A79D6F9D568
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ed Jamison wrote:
> I just started learning Perl. I got a "Learn Perl in 21 days book. I
>
> got to the third day with no problems. Then they introduced octal and
>
> hexidecimal notation. Unfortunately I slept through Calculus (as well
>
> as a lot of the rest of my first 2 years of college, and I missed any
> info on these types of notations. The book I have supplies a quick
> "tutorial", but I'd like to get some more in depth information. I
> like
> to have a thorough understanding of something before I have to work
> with
> it. My question is, where is a good source of information on this,
> preferably on the web?
>
> Thanks for your time and sorry of the (sort of) off topic question...
>
> Ed Jamison
Mr. Jamison,
I'll make this quick. Octal is base 8 and hex is base 16 whereas
decimal is base 10. Octal uses digits 0-7 so you will get a sequence
such as 0,1,2,3,4,5,6,7,10,11,12,13,14,15,...17,20,21... Hex on the
other hand uses digits 0-9 and letters A-F so you will get a sequence
like 0,1,2,3,...,9,A,B,C,D,E,F,10,11,...,19,1A,1B,...,1F,20... Anyhow,
if you have WIN95 you can run Calculator from your accesories group. It
can do conversions from decimal, hex, octal, and binary. I hope this
helps.
--
****************************************
* Tony Labbiento *
* Infinity Online, Inc. *
* Programmer/Network Administrator *
****************************************
--------------ms100046FE402D9A79D6F9D568
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature
MIIRbQYJKoZIhvcNAQcCoIIRXjCCEVoCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC
D2UwggqvMIIKGKADAgECAhB6h0vRx+CTFUsiPCAFqCPIMA0GCSqGSIb3DQEBBAUAMGIxETAP
BgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVy
aVNpZ24gQ2xhc3MgMSBDQS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6h0vRx+CTFUsiPCAFqCPIMAkGBSsOAwIaBQCggbEwGAYJKoZIhvcNAQkDMQsG
CSqGSIb3DQEHATAjBgkqhkiG9w0BCQQxFgQU9kHPn/RJDq2g+n8gm73dlHr1LZ0wHAYJKoZI
hvcNAQkFMQ8XDTk3MDgyNjE2NDYyNlowUgYJKoZIhvcNAQkPMUUwQzAKBggqhkiG9w0DBzAO
BggqhkiG9w0DAgICAIAwBwYFKw4DAgcwDQYIKoZIhvcNAwICAUAwDQYIKoZIhvcNAwICASgw
DQYJKoZIhvcNAQEBBQAEgYAmhvdlY+LJbH/tgItn27vsVBofwunmHsBWrwDXaWy5D5sgarCr
+LZCdZ7jZDFfrn2nviGhBn7pJyYSGEqqYumLMDnNqLYFzF8hKaoPpTNsk6dMLYeexv8pX7G7
7waYyZKxpszfudUtX22jmo4Z5EC2AcP8O+8ShPQK2C2hcQiXxA==
--------------ms100046FE402D9A79D6F9D568--
------------------------------
Date: Tue, 26 Aug 1997 19:30:06 +0200
From: Pascal AMRAM <pascal_amram@ml.com>
Subject: Perl and DDE commands
Message-Id: <3403129E.C1ABD651@ml.com>
Is it possible to use DDE command with perl (for nt) and how :) ?
------------------------------
Date: 26 Aug 1997 16:06:46 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl bug in pushing anonymous arrays??
Message-Id: <5tuuum$7nk@news-central.tiac.net>
In article <wkd7mdaxdrx.fsf@suntan.sce.carleton.ca>,
Curtis Hrischuk <ceh@suntan.sce.carleton.ca> wrote:
>================================================================
>Segment #2:
> push(@ar1, \(ref($$redge), $rserver_entry));
>
>Segment #2 flattens the array @ar1, appending the items; it does not
>create the reference to the anonymous array. Is this a bug?
One way to do it it to use the anonymous array constructor [] e.g.
push @ar1, [ref ($$edge), $rserver_entry];
\( ... ) is documented like this in perlref:
Note that taking a reference to an enumerated list is
not the same as using square brackets--instead it's
the same as creating a list of references!
@list = (\$a, \@b, \%c);
@list = \($a, @b, %c); # same thing!
As a special case, \(@foo) returns a list of
references to the contents of @foo, not a reference to
@foo itself. Likewise for %foo.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 26 Aug 1997 15:01:24 GMT
From: gt1535b@acmex.gatech.edu (dmouse)
Subject: perl modules and OOP
Message-Id: <5tur44$mcr@catapult.gatech.edu>
Hi there,
I'm running perl5 on Win32 and I want load some subroutines into my
program via a module but I keep getting errors like this:
Unquoted string "md" may clash with future reserved word at
showp.bat line 26.
Unquoted string "uulog" may clash with future reserved word at
c:\BOWEN\perl\perl5\sct/Scti.pm line 116.
Unquoted string "uulog" may clash with future reserved word at
c:\BOWEN\perl\perl5\sct/Scti.pm line 117.
Scalar value @_[0] better written as $_[0] at
c:\BOWEN\perl\perl5\sct/Scti.pm line 218.
Can't locate object method "cat" via package "rm" at showp.bat line 26.
BEGIN failed--compilation aborted at showp.bat line 26.
Scti.pm is the name of the module that I'm trying to load and the
names of the subroutines that are included are scti, ls, cat, rm, md,
and cp, defined in that order. The thing that has me confused
is the "Can't locate object..." error. I am using the Exporter
module but I don't want the module to be seen as an object per se,
I just want to import the subroutines. This is the line I used to
import them:
use Scti (scti ls cat rm md);
Has anyone run into this before? Any advice would be greatly
appreciated.
thanks,
Daryl
--
<>< Daryl Bowen <><
Georgia Institute of Technology
E-mail: gt1535b@prism.gatech.edu
Siemens Stromberg-Carlson Co-op
------------------------------
Date: 26 Aug 1997 15:28:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perl modules and OOP
Message-Id: <5tusmc$5p1$1@lyra.csx.cam.ac.uk>
dmouse <gt1535b@acmex.gatech.edu> wrote:
>I just want to import the subroutines. This is the line I used to
>import them:
>
> use Scti (scti ls cat rm md);
use Scti qw(scti ls cat rm md);
or
use Scti ('scti', 'ls', 'cat', 'rm', 'md');
Mike Guy
------------------------------
Date: 26 Aug 1997 14:52:58 GMT
From: schmidt@miserv2iai.kfk.de (Andreas Schmidt)
To: dennis@csie.nctu.edu.tw ()
Subject: Re: Perl Regular Expression has a bug?
Message-Id: <5tuqka$nlj$1@nz12.rz.uni-karlsruhe.de>
In article <5tup1n$cnd$1@news.ncu.edu.tw>, dennis@csie.nctu.edu.tw () writes:
|> See my program:
|> #!/usr/bin/perl
|> $date = localtime();
|> print "$date\n";
|> if($date = ~/(..):(..):(..)/)
|> {
|> print "Now \$date = $date\n";
|> print "Time: $1:$2:$3\n";
|> }
|>
hola dennis,
'=~' is one operator and does not allow an space in it, so
you have to write '=~' instead of `= ~'.
smiff
------------------------------
Date: 26 Aug 1997 13:20:05 -0400
From: Fil Krohnengold <fil@amnh.org>
Subject: perl script suid problem in Solaris 2.5.0
Message-Id: <ehg1rw7tfe.fsf@amnh.org>
I'm having some problems getting a perl script to run on one of my
Solaris 2.5 boxes (it's an Ultra 1). The strange thing is that it
will run just fine on two other boxes with identical OS's and (I'm
pretty sure) identical perl distributions - It was a while ago - but
I'm pretty sure I just compiled perl5.003 for one and then installed
the same binaries on all three via NFS.
The program is mostly the passwd program right out of the Camel book
with a couple of revisions for our site. Here's where it chokes:
science:~> passwd
Changing password for fil.
Insecure dependency in eval while running setuid at /dev/fd/4 line 220.
science:~>
And here's some context
206: # Build up a subroutine that does matching on bad passwords.
207: # We'll use an eval to define the subroutine.
208:
209: # I don't understand the need to do it this way
210:
211: $foo = 'sub badpats {local($_) = @_;study;';
212: open(BADPATS,$BADPATS);
213: while (<BADPATS>) {
214: ($badpat,$maybe) = split(/[\n\t]+/);
215: ($response = $maybe) =~ s/'/\\'/ if $maybe;
216: $foo .= "return '$response' if /$badpat/;\n";
217: }
218: close BADPATS;
219: $foo .= 'return 0;}';
220: eval $foo; # Note: this defines sub badpats
Let's see - oh yes:
science:~> perl -v
This is perl, version 5.003 with EMBED
built under solaris at Apr 10 1997 17:36:18
+ suidperl security patch
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
science:~>
Again - this same code runs just fine with perl5.003 on two other
Solaris 2.5 machines. I thought maybe the problem could be related to
the perl5.003 binary and how it was configured to handle suid stuff -
but my attempts to retrace those steps and recompile have not been
successful - I've already posted to comp.lang.perl.misc about that
problem.
Thanks all, for any help!
-fil
___________________________________________________________________________
Fil Krohnengold | UNIX Systems Admin, Interdepartmental Laboratories
fil@amnh.org | The American Museum of Natural History
212/769-5294 | CPW @ 79thSt / NY, New York / 10024
------------------------------
Date: Tue, 26 Aug 1997 11:30:24 -0500
From: Eric Foster-Johnson <johnsone@camax.com>
To: "Masoud Z. Khan" <mzk1@Ra.MsState.Edu>
Subject: Re: Perl/Tk Examples??
Message-Id: <340304A0.133D@camax.com>
Masoud Z. Khan wrote:
>
> Hi !!
>
> Can some one please tell me who can I use Perl/tk tograther...
> Like I have created a tk program with the GUI how can I combine
> them...
>
> Q:Should I be calling Tk from Perl program or vis versa?
> An exapmle would be very nice.
>
> Are there any examples on web if so please do tell me.
> Thanking you in advance.
My Web page has a few examples for using Perl/Tk:
http://www.pconline.com/~erc/perltk.htm
Good luck,
-Eric
--
Eric Foster-Johnson http://www.pconline.com/~erc/
CAMAX, SDRC's CAM Business
7851 Metro Parkway phone: +1 612 854 5300 fax: +1 612 854 6644
Minneapolis, MN 55425 USA johnsone@camax.com
------------------------------
Date: 26 Aug 1997 15:41:19 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: bbutz@student.uni-kl.de (Benjamin Butz)
Subject: Re: protect a perl-script
Message-Id: <5tutev$rh8$2@info.uah.edu>
[Posted and mailed]
In article <5tslk5$mkb$2@sun.rhrk.uni-kl.de>,
bbutz@student.uni-kl.de (Benjamin Butz) writes:
: how can I protect a perl-script? Everybody
: can execute the script, but nobody can read
: the source code (it is not a CGI access problem)
The *only* way to protect source code is with a copyright. All other
methods are futile. You'll notice that most code in CPAN includes a
copyright notice similar to
## Copyright (c) 1997 Perl Q. Hacker
## This program is free software; you can redistribute it
## and/or modify it under the same terms as Perl itself.
Like Chip S. said, "software without source code isn't software; it's
hardware on CD-ROM". Help yourself and the world by making your
software freely available.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 26 Aug 1997 16:05:08 GMT
From: aleung@cs.ualberta.ca (Alan Leung)
Subject: require error ("did not return a true value")
Message-Id: <5tuurk$rem$1@scapa.cs.ualberta.ca>
When I have
require 'lib_common.pl'; # getting an error!
in one of my files, I get
lib_common.pl did not return a true value at webfile_creator.pl line 3.
when I execute the perl script. The file is in the directory and if I comment the require
line out, interpretation is successful. I can also execute the lib_common.pl successfully,
so there are no syntax errors there?
I have used the require command before and haven't experienced too much trouble.
Any help would be appreciated.
--
@@@@@@@@@@ Alan Leung, aleung@gpu.srv.ualberta.ca | Comp Sci @@@@@@@@@@
@@ http://www.ualberta.ca/~aleung/ @@
@@@ Web pages: Gong Li, Bruce Lee, Aliens RECONSTRUCTION @@
@@ Design of classes and main for Aliens game @@
------------------------------
Date: 26 Aug 1997 16:27:37 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: aleung@cs.ualberta.ca (Alan Leung)
Subject: Re: require error ("did not return a true value")
Message-Id: <5tv05p$rh8$6@info.uah.edu>
[Posted and mailed]
In article <5tuurk$rem$1@scapa.cs.ualberta.ca>,
aleung@cs.ualberta.ca (Alan Leung) writes:
: When I have
:
: require 'lib_common.pl'; # getting an error!
:
: in one of my files, I get
:
: lib_common.pl did not return a true value at webfile_creator.pl line 3.
Read the entry on require in the perlfunc(1) manpage.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 26 Aug 1997 16:41:34 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: require error ("did not return a true value")
Message-Id: <5tv0vu$nie$1@NNTP.MsState.Edu>
In article <5tuurk$rem$1@scapa.cs.ualberta.ca>, aleung@cs.ualberta.ca (Alan Leung) writes:
|> When I have
|>
|> require 'lib_common.pl'; # getting an error!
|>
|> in one of my files, I get
|>
|> lib_common.pl did not return a true value at webfile_creator.pl line 3.
|>
|> when I execute the perl script. The file is in the directory and if I comment the require
>From the perldiag man page:
%s did not return a true value
(F) A required (or used) file must return a true value
to indicate that it compiled correctly and ran its
initialization code correctly. It's traditional to end
such a file with a "1;", though any true value would do.
See the require entry in the perlfunc manpage.
If you really want to understand, look up "require" in the perlfunc man
page; else just stick "1;" at the end of all your .pl and .pm files.
--
* daniel@HKSTAR.COM and account@HKSTAR.COM both love spam
* nemo@HKNET.COM mok@HKNET.COM rimen@HKSTAR.COM
------------------------------
Date: 26 Aug 1997 17:19:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: require error ("did not return a true value")
Message-Id: <5tv36g$9kg$1@lyra.csx.cam.ac.uk>
Alan Leung <aleung@cs.ualberta.ca> wrote:
>When I have
>
>require 'lib_common.pl'; # getting an error!
>
>in one of my files, I get
>
>lib_common.pl did not return a true value at webfile_creator.pl line 3.
And if you'd gone "use diagnostics;", you'd have got
(F) A required (or used) file must return a true value to indicate that
it compiled correctly and ran its initialization code correctly. It's
traditional to end such a file with a "1;", though any true value would
do. See perlfunc/require.
"use diagnostics;" is your friend.
Mike Guy
------------------------------
Date: 26 Aug 1997 11:06:15 -0600
From: jacob@bitsrfr.cnd.hp.com (Jacob Miner)
Subject: Returning a hash list (associative array)
Message-Id: <wjkoh6knabb.fsf@bitsrfr.cnd.hp.com>
Hi All,
How can I return a hash list, the following won't work
and I have tried many different permutations...
sub Families {
local(%Name);
$Name["Fred"]="Flinstone";
$Name["Barney]="Rubble";
return %Name;
}
%Test = GetMachines();
print %Test["Fred"];
This prints nothing. I have tried using references as well, but
to no avail...
--
---------------- .-. ------------------------------------
Jacob Miner .-.
---------------- .-. ------------------------------------
------------------------------
Date: 26 Aug 1997 15:47:15 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: gabe@sover.net (Apropos of Nothing)
Subject: Re: Safe Perl Programming Manual?? Book???
Message-Id: <5tutq3$rh8$3@info.uah.edu>
[Posted and mailed]
In article <gabe-2608971002430001@pm1a11.bratt.sover.net>,
gabe@sover.net (Apropos of Nothing) writes:
: I'm looking for manuals and/or books that programming guidlines... It
: would have info such as:
:
: Calls that fork a shell, how to work around them
: Calls that can overflow a buffer, alternative calls
: Etc...
The perlsec(1) manual page makes an excellent starting point.
: I'm also looking for info for perl and shell, and C.
The Camel book (a.k.a. Programming Perl -- ISBN 1-56592-149-6) is *the*
authoritative reference on Perl.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 26 Aug 1997 17:25:11 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Search Engine scripts ?
Message-Id: <340237f5.26737215@news.wwa.com>
On Sat, 23 Aug 1997 00:23:50 -0700, anthony@outshine.com (Anthony
Boyd) wrote:
>Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:
>> So let me get this straight,
>>
>> (1) You are being paid to do some work
>> (2) You would like to steal someone else's code as a framework
>
>Be nice Eli, he didn't say what he was going to do with it. He may want
>to steal code and get paid for it, but he may also want to write the
>entire thing himself, learning by example. I myself have had the concept
>of indexing explained many times, but until I saw the actual code for
>building an index, I couldn't visualize a practical implementation.
Or he might be looking to say, "Look, I can charge you and try to
write this code for you or we can make this a whole lot simpler and
cheaper by using this public domain (or shareware, etc. . . ) code."
Depending on my needs, I might thank the guy for seeing if there
existed a more economical option than paying him to reinvent a wheel
which was already freely available.
Faust Gertz
Philosopher at Large
------------------------------
Date: 26 Aug 1997 15:37:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: sort - help needed
Message-Id: <5tut8d$4rs@news-central.tiac.net>
In article <340182B7.167E@mathi.uni-heidelberg.de>,
<denis@mathi.uni-heidelberg.de> wrote:
>i have an array (@xx) with fields such as these:
>
>$xx[]="text1 text2 number text3";
>
>and i want so sort it by the numbers. so i tries something like
>this:
>
>sub numb
>{
> @tmp=split(/\s+/);
> $tmp[2]{$a} <=> $tmp[2]{$b};
>}
>
>@xx2=sort numb @xx
>
>but this doesnot work... maybe i search in the wrong variable...
>or is $tmp[2]{$a} wrong?
You probably want to look at the FAQ which you can get to via
http://language.perl.com/faq/index.html or the documentation distributed
with recent perls in perlfaq4 where the question
How do I sort an array by (anything)?
is answered.
If you're using perl 5 then something like
@sorted = map {$_->[0]}
sort {$a->[1] <=> $b->[1]}
map {$_, (split)[2]} @list;
which builds a temoprary array of [list entry, 3rd field of list entry]
and then sorts by the 3rd field and then rebuilds a list of the original
list entries might be useful.
The code is untested, and the suggestions in ther FAQ answer -
http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html in particular - are worth
examining and understanding.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 26 Aug 1997 16:55:13 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Suppressing a specific Perl warning
Message-Id: <5tv1ph$sq3$1@news.fm.intel.com>
this is an interesting situation that i have come across. i am writing a
compiler, and every bit of Perl it uses is invoked with the "-w" switch to
at least force the user to quote strings, and try to predefine variables
and such.
well, the particular warning message i would like to suppress is the
Misplaced _ in number
because its not important. the syntax i use allows for binary strings to
contain underscores as placeholders between nybbles, i.e.:
1011_0010_1110_1111
and all my subroutines and such know how to handle that. Perl sees this
string of digits (w/out letters) as a decimal number with underscores not
placed on a three digit boundary.
things i cannot do:
1. set the $^W flag off, then reset it on, because i dont know where
the user may use a binary string.
2. have some sort of binary indicator like b1100_0001_0001 because of some
backward compatibility issues.
3. dont *want* to filter everything that is sent to STDERR because the
scripts may be large, and many warnings may be issued.
4. eliminate the use of the "-w" switch.
if anyone has suggestions other than the above taboos, i would love to
hear them.
it is an interesting problem, and i havent seen anything relating to it on
here or the FAQ.
--
print "J" ."u". # -- Terry Fletcher
"s" ."t". " A", "n" # tfletche@pcocd2.intel.com
. "o" ,""."". "the", "r ","P". # Views expressed....not
"e"."rl" ." Ha", "c",'' ."" ."". # INTeL's....yadda yadda
"" , "k". "e" ."r" ;# yadda....
------------------------------
Date: 26 Aug 1997 16:09:25 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: uninit'd value annoyance
Message-Id: <5tuv3l$7cm$1@lyra.csx.cam.ac.uk>
In article <33FDD12C.1CFB@sdrc.com>, Joe Kline <Joe.Kline@sdrc.com> wrote:
>
>warning I get:
> Use of uninitialized value at:
> /gekline/test7/qppg_repgen.pm line 117, <STATS> chunk 1.
>
>My output and everything come out ok, the program does
>what I want it to, but it's just that I
>can't figure out why I am getting this warning which
>I find annoying.
>
>if ( ($button ne "button3") && ($button ne "button7" ) )
>^^^^^^^^^^^^^^line117
The line number printed in a Perl (runtime) error message is the line of
the last statement obeyed. This means that when an error is detected
in the header of a foreach, while etc, the statement number you get is
that of the last statement obeyed in the loop (either a next or redo,
or the last statement of the loop).
In your case, the flagged if statement is the last statement of four
loops:
BUT: foreach
GROUP: foreach
while ( <STATS> )
foreach $fields
so look for errors in any of these places.
Not exactly transparent, but that's the way it is.
Mike Guy
------------------------------
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 924
*************************************