[6930] in Perl-Users-Digest
Perl-Users Digest, Issue: 555 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 2 03:07:49 1997
Date: Mon, 2 Jun 97 00:00:31 -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 Mon, 2 Jun 1997 Volume: 8 Number: 555
Today's topics:
data structure question (Jon Nathan)
Getting Perl5 from vendors <stuartc@ind.tansu.com.au>
Re: help!!! <perlprogrammer@hotmaill.com>
Re: help!!! <perlprogrammer@hotmaill.com>
Re: help!!! <rootbeer@teleport.com>
Re: Help, embeding perl in C++ (Nathan V. Patwardhan)
Re: Help, embeding perl in C++ (Abigail)
How can I set up this server to run perl faster?... <perlprogrammer@hotmaill.com>
Is It Possible to Invoke Adduser Command in Perl Code?? <swsung.bbs@cis.nctu.edu.tw>
Re: Is It Possible to Invoke Adduser Command in Perl Co (Nathan V. Patwardhan)
Re: More PERL questions (Andrew M. Langmead)
newbie question about the sort function and hashes (Shane 'Fishman' Sherman)
Newbie: Perl & SMTP & uuencode/decode <ecox@nibupls1.telstra.com.au>
Re: OS/2 : Backticks causing runtime crash (Koos Pol)
Output to a printer <ulsass@berlin.snafu.de>
perl and graphics (David Dougal)
Re: perl and graphics (Nathan V. Patwardhan)
Re: Processing many form fields (Andrew M. Langmead)
Re: Protecting perl code *Important* <rootbeer@teleport.com>
Re: Protecting perl code *Important* (Abigail)
Re: Socket reading (Charles DeRykus)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Jun 1997 06:31:16 GMT
From: jn0729a@cage.cas.american.edu (Jon Nathan)
Subject: data structure question
Message-Id: <5mtpbk$ei4$1@paladin.american.edu>
hello
i'm trying to write a script that will be a simple quote server. it will read
in a quote and the source of the quote from a textfile formatted as such:
1.Take me out to the ballgame.
1.Some song
2.Whatever
2.Joe Smith
etc. the format for the file is not written in stone, however it seemed good to
me at the time. once it reads in all the quotes from the file, it should print
one out at random, along with the source. because i would eventually like to
play with the source too, i want to keep it in a seperate variable. that said,
this is my (ugly) code so far:
-----start code-------
open(QUOTES, "//usr//people//nathanj//quotes");
while ($quote=<QUOTES>){
chop($quote); #get a line from the file
$num=/$(\d+\.)/; #digit(s) followed by a period
$quote=~s/\1//; #take the digit(s) and period out
chop($source); #get the next line from the file
$source=~s/\$1//; #take the digit(s) and perious out
@\$1=($quote,$source); #set up array named (the number of the quote)
%fullquote={ #set up hash with key of (the number of the quote)
#and value of (the array containing the quote
# and source)
$1 => \@\$1,
}
}
#now pick a random key from the @fullquote array
#and print out the quote associated with that number
#later i'll deal with the source of the quote
#put all the keys into another array
@possibilities = keys (@fullquote);
#now choose a random one from @possibilities
#hmm don't quite know how here
---end of code----
i realise that this is very ugly and wrong in places but would appreciate any
ideas to simplifly/beautify/make it work. if you can, please cc your reply to my
email.
thank you
--
Jon Nathan
jon@blading.com
www.csis.american.edu/~jn0729a
------------------------------
Date: 30 May 1997 13:11:51 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Getting Perl5 from vendors
Message-Id: <yeowwohejrb.fsf_-_@parakeet.ind.tansu.com.au>
>> Randal Schwartz:
>> My, how time flies. Perl5.000 was released 2.7 years ago, and was in
>> usable alpha/beta releases since at least mid 1993. "Everyone was
>> using perl version 4" hasn't been true for roughly 4 years.
>>
>> Perl4 is dead, long dead. Long live Perl5 (until Perl6 comes along :-).
> Jonathan Hudson:
> Having recently accepted delivery of two new Unix boxes from "industry
> leaders" and typed 'perl -v', the leading version digit was *NOT* 5.
> If your management forbids you to install upgrades that don't come
> from the vendor, then unfortunately perl 4 is a fact of life.
If your management won't put non-Vendor products on your machine;
talk to them. Some suggestions (in possible order of usefulness)
========================================================================
1) Put pressure on the vendor to provide a 'supported' Perl 5. You are
probably paying your vendor good dollars in maintenance on all sorts
of products, including I would guess Perl 4. What value are you getting
for this money when the vendor isn't keeping up to date with Perl and
isn't providing a new Perl 5? What value (besides 10 minutes worth of their
own C compiler time,a tape and maybe some verification checks) are the
vendor providing in the versions of Perl they give you versus the
full source code releases you'd install yourself if you were
allowed? If the vendor is *not* giving you value for your Perl; ask
management why Perl has to be got from them only.
2) Explain to management who writes and develops Perl.
3) Know your rights. Read whatever rights Perl is distributed under;
and make sure your vendor is not contravening these. Read some GNU
licenses (OK; I'm told Perl isn't under the GNU Public License and
is actually distributed under something more free. I haven't read the
Perl license because at the moment I don't need to: my employer has no
'vendor only' restrictions)
4) In regard to your vendor make sure:
(a) you are allowed to give your version of Perl to other people
(b) you have or you can get the source code for it.
(c) you are allowed to get Perl from another source
<your employer's policy may prohibit (c) but your vendor may not. They
might refuse to support it; and they might blame all future system problems
at your scary Perl 5; but they cannot legally lock you in to getting Perl
from them>
5) What are the reasons for your vendor-only policy? Is it
(a) supported by vendor/hand-holding
(b) fear of Internet/security concerns
(c) ... and other reasons ...
Argue against these if you can't get what you want (Perl 5) from the
vendor.
========================================================================
If there were no GNU/FSF/Linux etc. we would all be labouring under
the old system of vendor-dependance. "Free" Software is more about the
license freedom than the fact you don't have to pay $500 for it. It is
a philosophy and one I feel strongly about.
It is in no way the fault of anyone in "the Perl Community" that Perl 4
is for you a fact of life. Put pressure on your management and your vendor.
Stuart Cooper
stuartc@ind.tansu.com.au
------------------------------
Date: Sun, 01 Jun 1997 18:31:14 -0700
From: perl guy <perlprogrammer@hotmaill.com>
Subject: Re: help!!!
Message-Id: <33922262.6903@hotmaill.com>
A. Deckers wrote:
>
> In comp.lang.perl.misc,
> yzhou@mtu.edu wrote:
> >I am tired.
> >
> > There's a perl program,
> >
> >#!/usr/local/perl/bin/perl
> >
> >print "Content-type: text/html\n\n";
> >
> > print <<END1;
> >
> > <HTML>
> > <BODY>
> > <H1>WHY!!!!!!!!!! </H1>
> > </BODY>
> > </HTML>
> >
> > END1
> ^
> |--------- This must start on column 0. Remove the space in front of it.
>
> >exit (0);
> >
> > It's so simple, but the complier refused to accept it,
> >with error message:"
> >Can't find string terminator "END1" anywhere before EOF."
>
> Because there is a space in front of END1.
>
> Alain
>
> --
> Perl information: <URL:http://www.perl.com/perl/>
> Perl archive: <URL:http://www.perl.com/CPAN/>
> Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
> >>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<
what he said.. *duh*.. sorry.. I should really configure my news groups
to thread.. :)
------------------------------
Date: Sun, 01 Jun 1997 18:29:51 -0700
From: perl guy <perlprogrammer@hotmaill.com>
Subject: Re: help!!!
Message-Id: <3392220F.5A36@hotmaill.com>
Yan Zhou wrote:
>
> I am tired.
>
> There's a perl program,
>
> #!/usr/local/perl/bin/perl
>
> print "Content-type: text/html\n\n";
>
> print <<END1;
>
> <HTML>
> <BODY>
> <H1>WHY!!!!!!!!!! </H1>
> </BODY>
> </HTML>
>
> END1
>
> exit (0);
>
> It's so simple, but the complier refused to accept it,
> with error message:"
> Can't find string terminator "END1" anywhere before EOF."
>
> but, I also have another program with much more output
> than it, working well.
>
> I totally have no idea how can it be.
>
> Any hint will be greatly appreicated.
>
> Yan Zhou
> yzhou@mtu.edu
take out the space..
print "Content-type: text/html\n\n";
print <<END1;
<HTML>
<BODY>
<H1>WHY!!!!!!!!!! </H1>
</BODY>
</HTML>
END1 <-- there...
exit (0);
------------------------------
Date: Sun, 1 Jun 1997 18:58:15 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Yan Zhou <yzhou@mtu.edu>
Subject: Re: help!!!
Message-Id: <Pine.GSO.3.96.970601185412.14975C-100000@kelly.teleport.com>
On Sun, 1 Jun 1997, Yan Zhou wrote:
> Subject: help!!!
>
> I am tired.
Even when you're tired, it's a good idea to follow the guidelines in the
frequent posting about choosing good subject lines. Everybody with a
question needs "help!!!"
> #!/usr/local/perl/bin/perl
That's an interesting place to keep it.
> print <<END1;
[ snip ]
> END1
> It's so simple, but the complier refused to accept it,
> with error message:"
> Can't find string terminator "END1" anywhere before EOF."
Make sure that that last line has nothing on it but END1, with nothing
before it but the previous newline and nothing after it but the next
newline. (It looks to me like it has a leading space, so it's " END1"
instead of "END1".)
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 2 Jun 1997 01:13:05 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Help, embeding perl in C++
Message-Id: <5mt6n1$o3g@fridge-nf0.shore.net>
Larry D'Anna (ldanna@ix.netcom.com) wrote:
: Does anyone know how to embed perl functions in C/C++? Thanks a lot.
man perlembed.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 2 Jun 1997 02:40:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help, embeding perl in C++
Message-Id: <EB4nG2.35n@nonexistent.com>
On Sun, 01 Jun 1997 16:55:23 -0400, Larry D'Anna (ldanna@ix.netcom.com)
wrote in comp.lang.perl.misc
<URL: news:3391E1BB.2C76@ix.netcom.com>:
++ Does anyone know how to embed perl functions in C/C++? Thanks a lot.
man perlembed
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: Sun, 01 Jun 1997 23:22:22 -0700
From: perl guy <perlprogrammer@hotmaill.com>
Subject: How can I set up this server to run perl faster?...
Message-Id: <3392669D.73BE@hotmaill.com>
Huge aplogies for the major cross-postings.. but I have NO idea where to
post to, other then the fact that it has to do wth all the formentioned
subjects.
Ok, first off, I am running perl 5.003 on a Linux Kernel 2.0.18 on an
i486 server with Red Hat 4, Apache 1.1.1, 5 disk partiions of 300 Megs
each, 48 MEGS RAM with a 60 MEG swap file..
I am running a chat site that is getting a huge amount of traffic, and I
need to find out a way, to only run one continous instance of perl, or
something that won't chew up the drive or slow things down so terribly!
It's literally killing the hard drive from all the people. I need to
find out a way to configure something too possibly for the best way to
run the server for this sort of thing. I wish it was on the NT bo,
because I could do an ISAPI type thing.. but what can I do on a Linux
with Perl?. I seriously have no idea. every time someone transfers the
data, it's calling to the perl.exe, and wth all the people at once, it's
too much! I read the error logs, and I see a lot of these errors for
example:
"send script output lost connection to client -blah-", *mostly these*
"request lost connection to client -blah-", *a lot of these*
"access to /my_dir/chat.pl failed for -blah-, reason: POST or PUT
without Content-length:" *a few of these*
That's not really the problem though.. I assume that the time out,
keepalive, keepalive timeout, etc. time needs to be set differently..
I'm not sure what these need to be set to really.. as I did the perl..
but my server admin seems to need advice on how to configure the server
better, and I am clueless.. This is why it's partly being posted in the
unix/linux. As well as for the server configs that may help or IDEAS
that may help me with how to run less instances, etc of the perl.exe?. I
am so lost.. the script works great, untill I get over 50 or 60 people
in the rooms.. then it gets very slow and has problems.. it starts to
crash my server, and I have to telnet in and restart the websever 3
times a day!.. it's getting out of control, and I don't have weeks or
months ro read up on this.. unfortunately, it's too late to take the
site down until *I* find out how to configure the script, and the
server, etc.. I am also posting this to the perl news groups, as wel as
cgi because I'm sure that someone there will have some experiance of how
to run things more smoothly in the script configuartion.. something I
may have missed.. sorry this is so vague.. but this is all my problem
seems to be, and I don't have a clue of what to do now!. I hope someone
can help.. for an idea of what's going on (at a slow time of the day), I
go to telnet and type in "ps -aux" and I get this.. you can see how it's
killing my drive..
BTW, the pipe is not being hogged up at all.. it's taking barely any...
Here's what the mess looks like..
USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
nobody 29774 0.3 1.5 1232 720 ? S 22:11 0:02 httpd
nobody 29936 0.2 1.5 1228 728 ? S 22:14 0:01 httpd
nobody 29985 0.3 1.5 1232 728 ? S 22:15 0:02 httpd
nobody 29991 0.2 1.4 1204 704 ? S 22:15 0:01 httpd
nobody 30075 0.2 1.5 1228 720 ? S 22:16 0:01 httpd
nobody 30128 0.3 1.5 1232 724 ? S 22:17 0:01 httpd
nobody 30180 0.2 1.5 1228 720 ? S 22:18 0:01 httpd
nobody 30189 0.1 1.5 1232 728 ? S 22:18 0:01 httpd
nobody 30504 0.4 1.5 1208 708 ? S 22:24 0:00 httpd
nobody 30528 0.4 1.4 1208 704 ? S 22:24 0:00 httpd
nobody 30531 0.3 1.4 1204 704 ? S 22:24 0:00 httpd
nobody 30534 0.1 1.4 1204 704 ? S 22:24 0:00 httpd
nobody 30582 0.5 1.4 1204 704 ? S 22:25 0:00 httpd
nobody 30587 0.3 1.4 1208 704 ? S 22:25 0:00 httpd
nobody 30589 0.4 1.4 1204 704 ? S 22:25 0:00 httpd
nobody 30590 0.3 1.4 1208 704 ? S 22:25 0:00 httpd
nobody 30595 0.6 1.4 1208 704 ? S 22:25 0:00 httpd
nobody 30598 0.3 1.5 1232 724 ? S 22:25 0:00 httpd
nobody 30602 0.3 1.4 1204 704 ? S 22:25 0:00 httpd
nobody 30604 0.1 1.5 1208 708 ? S 22:25 0:00 httpd
nobody 30620 0.3 1.5 1208 708 ? S 22:25 0:00 httpd
nobody 30622 0.1 1.4 1208 704 ? S 22:25 0:00 httpd
nobody 30623 0.3 1.5 1216 708 ? S 22:26 0:00 httpd
nobody 30630 0.3 1.4 1208 704 ? S 22:26 0:00 httpd
nobody 30633 0.2 1.4 1208 700 ? S 22:26 0:00 httpd
nobody 30636 0.0 1.4 1204 704 ? S 22:26 0:00 httpd
nobody 30641 0.2 1.4 1208 700 ? S 22:26 0:00 httpd
nobody 30642 0.4 1.4 1208 700 ? S 22:26 0:00 httpd
nobody 30687 6.7 3.2 2088 1516 ? R 22:26 0:01 perl5.003 /my
home dir path
nobody 30688 6.0 3.2 2088 1516 ? R 22:26 0:01 perl5.003 /my
home dir path
nobody 30691 7.0 3.2 2092 1520 ? R 22:26 0:01 perl5.003 /my
home dir path
nobody 30692 7.1 3.2 2092 1520 ? R 22:26 0:01 perl5.003 /my
home dir path
nobody 30694 6.2 3.1 2084 1496 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30695 6.6 3.2 2084 1512 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30698 6.5 3.0 2076 1452 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30699 7.0 3.1 2080 1492 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30700 0.0 1.4 1188 672 ? S 22:27 0:00 httpd
nobody 30702 7.7 2.8 2028 1320 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30703 0.1 1.4 1188 672 ? S 22:27 0:00 httpd
nobody 30704 8.4 2.8 2032 1324 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30706 0.1 1.4 1188 672 ? S 22:27 0:00 httpd
nobody 30707 9.5 2.8 2032 1324 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30708 10.1 2.6 1960 1252 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30709 0.1 1.4 1188 672 ? S 22:27 0:00 httpd
nobody 30710 8.0 2.0 1728 964 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30711 11.0 2.3 1864 1120 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30712 8.0 1.6 1548 776 ? R 22:27 0:00 perl5.003 /my
home dir path
nobody 30713 7.0 1.6 1540 768 ? R 22:27 0:00 perl5.003 /my
home dir path
How can I stop this, por fi the problem?. Anyone.. please help.. I beg
of you.. any suggestions, or any pointers to a site that specifically
talks about this.. I have endlessly searched dejanews, and all the other
arhives, been to all the sites for Apache, Linux, Unix, Perl, CGI,
etc..etc.. and no one has any info on this delima..
Thank you very much for the time you took to even read this.. :)
#stressed$%....
------------------------------
Date: 2 Jun 1997 01:01:43 GMT
From: $j,u?OE" <swsung.bbs@cis.nctu.edu.tw>
Subject: Is It Possible to Invoke Adduser Command in Perl Code???How???
Message-Id: <5mt61n$46q@netnews.hinet.net>
As subject.
Any answers will be highly appreciated.
Truman
------------------------------
Date: 2 Jun 1997 01:20:34 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Is It Possible to Invoke Adduser Command in Perl Code???How???
Message-Id: <5mt752$o3g@fridge-nf0.shore.net>
$j,u?OE" (swsung.bbs@cis.nctu.edu.tw) wrote:
: Any answers will be highly appreciated.
Yes. If you're running FreeBSD, the adduser command *is* a Perl
script. :-) This was just discussed a week or so ago, so you might
have good luck checking http://www.dejanews.com.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Sun, 1 Jun 1997 16:20:31 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: More PERL questions
Message-Id: <EB3uq7.9v9@world.std.com>
Doyle Tracy <doyle@teleport.com> writes:
Later on, you state that there aren't any books on the specifics of
the language, just books on programming, but:
>1. What are the expression evaluation rules for PERL? What are the
>operator precedences? Is left to right or right to left the
>direction among operators of equal precedence?
I'd assume a book for teaching programming in perl would explain
precedence rules. I'd bet even the man pages would have them.
> Also, I am looking for an EBNF representation for these rules.
Appendix A of the first edition of the book "Programming Perl" had a
"Semi-formal Description" of the language. It isn't in the second
edition (and the syntax has changed in many ways.) There's always
perly.y.
>2. Does PERL permit an unconditional branch into the block of
>statements executed under control of a conditional?
The perltrap man page says:
o You can't do a goto into a block that is optimized away.
Darn.
Which would imply that the language syntax does allow it, but the
implementation may not always do it correctly. This bug may is
considered too unimportant to fix.
>3. What types are permitted for the control expression of a case
>statement?
>4. How does PERL react when an unspecified choice is evaluated for
>the expression controlling a case statement?
Again, if you would read the man pages or a book like "Programming
Perl", you would find out there is no case statement.
All conditional control expression are evaluated in a scalar
context. List types are coerced into scalar types.
>5. Does PERL permit unconditional branching into or out of the body
>of an iteration?
Perl has specific syntax constructs for branching out of an interated
block. There are also some implicit iterations functions like grep and
map that don't allow exits.
>6. What is the value of the ICV (Iteration Control Variable) after
>the completion of an iteration?
Again, this is matter than would be in material (the book "Programming
Perl" and the man pages.) that would teach perl.
In "for $icv (@list)" loops, the previous value of the saved
before the start of the loop and restored on exit.
In a "foreach ($icv=0; $icv < 10; $icv++)" loop, $icv would be 10.
>7. When is the final expression evaluated in a fixed-count iteration?
Which of the above two loop control statements do you consider "fixed
count"? I see them both as executing a fixed number of times, but I
assume you mean only the second.
Thats a bit of a problem that you might have going at perl from this
"shopping list" approach. You're looking for the aspects of the
language that fits your list, and missing out on the aspects that make
it unique.
>8. Does PERL permit in ICV to be of a real type?
There are no "real" types. Only scalar and list types. The ICV must be
a scalar type.
>9. Does PERL permit an iteration to have multiple exit tests?
There are loop control commands, "next", "last", and "redo". A "next"
inside of a conditional will exit the loop whose label it specifies,
by default the innermost loop.
>10. Does PERL permit modification of the ICV in the body of a
>fixed-count iteration?
Yes, but depending on the particular fixed count construct, it may
reset the ICV to what would be the next occuring element anyway.
>11. When is the index of an array checked against its domain type?
It isn't. Any value can be put as an array index. If it is a list
value, it is coerced into a scalar. For numerically indexed arrays,
the value is then truncated to its integer portion and used. For
associative arrays, a list value is only coerced into a scalar.
>12. When is the domain of an array bound to the array?
>13. What types are permitted for the domain of an array?
>14. What types are permitted for the range of an array?
>15. Is array assignment permitted? How are arrays with different
>domains and the same cardinality handled?
>16. Is ordering defined in arrays? If so, how?
Numerically index arrays are named lists. Lists hold scalar
values. They grow as needed. Any value not previously set is returned
as an "undefined" value. Associative arrays, often called hashes, are
unordered key value pairs. If assigned to or from a list context,
hashes return a list of alternating key/value pairs.
>17. Is there a maximum length enforced on strings? Is it user
>definable?
The perl man page says:
Unlike
most Unix utilities, Perl does not arbitrarily limit the
size of your data--if you've got the memory, Perl can slurp
in your whole file as a single string.
>18. If PERL has varient records, is the discriminant selection
>enforced? Is assinment permitted to components not currently
>activated by the discriminant?
Perl has no records, but often hashes are used for their
purpose. There are no varient records.
>I realize there are alot of questions here. And I appreciate the
>patience everyone has with me. I've looked high and low for a book to
>find these answers in but I can only find books on programming PERL, not
>the specifics of the language. In addition to these specific questions,
>I'm also looking for a little history on the language such as what
>platform was is designed for?
Again, I'd recommend reading the man pages and the book "Programming
Perl". The book is written by the creator of the perl language as well
as some of its most skilled users.
The First chapter, "An Overview of Perl" will give you a flavor of the
language. With it, I think you would be much less apt to ask
inapplicable questions. The second chapter, "The Gory Details" will
answer many of the items on your shopping list. The end of chapter
eight. "History Made Practical" tells the story of why and how perl
came into being.
--
Andrew Langmead
------------------------------
Date: Mon, 02 Jun 1997 06:21:04 GMT
From: fishman@vvm.com (Shane 'Fishman' Sherman)
Subject: newbie question about the sort function and hashes
Message-Id: <339264fe.17052439@news.tamu.edu>
What i am trying to do is sort a hash by the keys but then print the
whole hash sorted and not just the keys...here is my code:
print"How many lakes: ";
$numlakes=<STDIN>;
for($i=0;$i<$numlakes;$i+=1){
print "Name of lake: ";
$name=<STDIN>;
chomp($name);
$name=$name." - ";
print "\ndescription? ";
$info=<STDIN>;
$lakeinfo{$name}.=$info . " ";
}
@sort = sort %lakeinfo;
print @sort;
i have tried numerous things such as:
print "\n",sort %lakeinfo;
but that seems to break everything into a array and sorts it all...so
descriptions come before name, etc. If anyone could help me out i
would greatly appreciate. Thanks. if you post a followup reply please
forward it to me. thanks.
---Shane 'Fishman' Sherman
---fishman@vvm.com
---Fishman's Bass Fishing World(http://www.vvm.com/~fishman)
------------------------------
Date: Mon, 26 May 1997 16:24:11 +1000
From: Edward Cox <ecox@nibupls1.telstra.com.au>
Subject: Newbie: Perl & SMTP & uuencode/decode
Message-Id: <33892C8A.EE952F62@nibupls1.telstra.com.au>
I'm brand new to this group - and a newbie to Perl 5 for NT as well.
I'm looking for some words of wisdom and advice on writing a Perl CGI
that will allow me to send an email message (a'la' Blat) and allow the
attachment of a uuencoded message - and possible uudecode when a message
is received. Can someone point me in the right direction for a code
snippet/ example etc.
Thanks,
Ed Cox
Web Master - Telstra Multimedia Pty Ltd
ecox@nibupls1.telstra.com.au
------------------------------
Date: 2 Jun 1997 06:33:57 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Re: OS/2 : Backticks causing runtime crash
Message-Id: <5mtpgl$od4@news.nl.compuware.com>
In <5mneni$f4e$2@mathserv.mps.ohio-state.edu>, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
>
>You still did not put Perl docs into your bookbag...
>
>Ilya
>
>
Oh yes I did :-) But as you may have noticed my name being new to this
list (all those silly OS/2 questions in just a couple of days...), you
may also appreciate that Perl -with it's typical Unix style of going
about- it not the easiest matter for a typical PC guy. And the docs are
about 5 foot thick. So, I am getting there but not today or tomorrow.
Cheers,
Koos Pol
----------------------------------------------------------------------
S.C. Pol
PC Systems Administrator
Compuware Europe B.V.
email:Koos_Pol@nl.compuware.com
------------------------------
Date: Mon, 02 Jun 1997 07:18:39 +0200
From: "Markus Ulsa_" <ulsass@berlin.snafu.de>
Subject: Output to a printer
Message-Id: <339257AF.34BF155@berlin.snafu.de>
Hello,
How can I print out something to a printer, w/o printing it first to a
file and then print it to a printer (with "help" from the OS)?
E.g.
print "$Date\t $Photographer\t $Fee\n";
should print the output direct to a printer. I'm working under win95/nt.
And how to print it to a printer on the network ?
Regards,
Markus
------------------------------
Date: 2 Jun 1997 00:06:08 GMT
From: ddougal@gte.net (David Dougal)
Subject: perl and graphics
Message-Id: <5mt2pg$gfe$1@news10.gte.net>
I am writing a program in Perl and I am now ready to start on the graphics
subroutine. The problem is how do I display my graphic in X-windows. I have
played with the gd.pm add-on to Perl and created a gif image, I was able to
view the image on a web browser but unable to view it in X windows. I also need
to update the gif every 30 seconds and need a two button interface to stop the
program and start it.
Could I use tk for the 2-button interface and gd for the graphics and Perl for
the engine?
------------------------------
Date: 2 Jun 1997 01:19:24 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: perl and graphics
Message-Id: <5mt72s$o3g@fridge-nf0.shore.net>
David Dougal (ddougal@gte.net) wrote:
: Could I use tk for the 2-button interface and gd for the graphics
: and Perl for the engine?
How 'bout using pTk (Perl/Tk - portable tk) for your Unix machine?
pTk handles all events with Perl subroutines, along with the same
functions you're familiar with in Tk.
The current version is 400.202 (402.000 seems to be a development or
alpha release [I forget which], and I believe there's a readme that
informs you of this). Available at a CPAN near you!
Also, see comp.lang.perl.tk, where the pTk FAQ is regularly posted.
And yes, pTk *will* do what you want - GIFs are supported as part of
the distribution, and can be viewed with Photo(); naturally, buttons
are part of pTk. You could use sleep() and update to update the image
every x seconds.
If you don't want to go through all this trouble, you could use xv. :-)
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Sun, 1 Jun 1997 14:48:01 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Processing many form fields
Message-Id: <EB3qG2.I4D@world.std.com>
gpylant@cc.memphis.edu writes:
>I am using odbc, MSaccess, and Perl to process a form with 30 or so input
>fields. Is there any way to use subscripts for the field names on the server
>side instead of the usual input{'field1'}, input{'field2'} etc.?
>It would be nice if there was something like input{name}[1] or whatever.
>Thanks in advance....
If some library that you are using for data access, (for example, a
library for the CGI protocol. You don't quite say how the data gets
into the %input hash.) returns the data in one hash, you go through
that hash and copy the data to new variables. Maybe in an array if it
is convienient.
foreach $field (keys %input) {
next unless /^field(\d+)/;
$field[$1] = $input{$field};
}
# now all the fields that were in $input{field1}, $input{field2},
# $input{field3}, etc. are in the @field array
--
Andrew Langmead
------------------------------
Date: Sun, 1 Jun 1997 18:53:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Carl Eklof <noasat@acm.vt.edu>
Subject: Re: Protecting perl code *Important*
Message-Id: <Pine.GSO.3.96.970601184811.14975B-100000@kelly.teleport.com>
On Sun, 1 Jun 1997, Carl Eklof wrote:
Subject: Protecting perl code *Important*
Everything's important to somebody, or they wouldn't have posted it. But
you might benefit from the frequent posting on choosing good subject
lines.
> How does one protect perl code.
I keep good backup files.
> I have a very serious issue; I am selling some code that I wrote and
> would like to protect it against copying, etc.
Oh. Well, you simply put a copyright notice near the top of your script.
Your local library probably has some good books about copyright.
> I have heard that there are ways to convert perl into its binary form.
> Is that true?
Yes, and the details are in the FAQ.
> That would certainly solve my problem.
How? I could copy a binary just as easily as I could copy source code.
Since you're going to need to put a copyright on it anyway, why hide the
source?
> The code will be on their machine, so they could pretty much do what
> ever they want.
Exactly right, which is why you want to use a copyright. Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Mon, 2 Jun 1997 02:48:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Protecting perl code *Important*
Message-Id: <EB4ntC.3tI@nonexistent.com>
On Sun, 01 Jun 1997 15:16:10 -0400, Carl Eklof (noasat@acm.vt.edu) wrote in
comp.lang.perl.misc
<URL: news:3391CA7A.6E64@acm.vt.edu>:
++ How does one protect perl code.
++
++ I have a very serious issue; I am selling some code that I wrote and
++ would like to protect it against copying, etc. I have heard that there
++ are ways to convert perl into its binary form. Is that true? That would
++ certainly solve my problem.
That's not the Perl way. This is what Tom C once wrote:
The Internet Revolution was founded on open systems: an open system is one
whose software you can look at, a box you can unwrap and play with. It's
not about secret binaries or crippleware or brother-can-you-spare-a-dime
shareware. If everyone always had hidden software, you wouldn't have
1/100th the useful software you have right now.
And you wouldn't have Perl.
[Tom Christiansen in `The new Camel and compiling perl'
<53mal3$4b5$1@csnews.cs.colorado.edu>]
Perl comes with full sources, and you don't need to pay a dime. The
spirit of Perl is openess, freedom. Hiding your sources is not the Perl
way.
Furthermore, a binary is as easily copied as a non binary.
But alas, there is someone (Malcolm B) working on a Perl compiler.
Though I doubt its intention is 'hiding sources'. Go to
http://www.perl.org or http://www.perl.com/perl and follow the right
links. Just don't look at the software you find there.
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: Sun, 1 Jun 1997 00:39:10 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Socket reading
Message-Id: <EB2n5A.46n@bcstec.ca.boeing.com>
In article <EB0HIL.4nu@bcstec.ca.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <naked-ya02408000R2905971940060001@news.sci.fi>,
>Nuutti Kotivuori <naked@paivola.sci.fi> wrote:
> >Ok... I have this problem. I have a socket that I want to read line by
> >line... just one line at a time, but I can't just use <FILEHANDLE> because
> >I need to get back to my program every second on the second. The more
> >selects the inputs. Is there a better way?
> ....
>Hm, could you set an alarm, e.g,
>..... snipped...
On 2nd thought, a 1 second alarm wouldn't leave you
any time to process what you're read from the
socket. You'd probably be better off forking another
process to read from the socket. I'd need to know
more about your program.
--
Charles DeRykus
ced@carios2.ca.boeing.com
------------------------------
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 555
*************************************