[7035] in Perl-Users-Digest
Perl-Users Digest, Issue: 660 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 25 06:17:20 1997
Date: Wed, 25 Jun 97 03:01:42 -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, 25 Jun 1997 Volume: 8 Number: 660
Today's topics:
Perl "compiler" or how do you protect your code? (Subodh Desai)
Re: perl and perl5 (Tad McClellan)
Perl Network/Socket programming kingzem@nationwide.com
Perl script retrieving URL's (Ivo Bieleveldt)
Re: Possible Bug: Multiple DBM Files at once <qzyn64@tpc.natp.gmeds.com>
Possible typo in FileHandle module m.hunt@elsevier.co.uk
Prototypes and pass-by-reference. <cmason@ti.com>
Re: Q: an alternative to this use of "goto"? <rra@stanford.edu>
Re: Q: an alternative to this use of "goto"? (Abigail)
Re: Q: List/scalar context with methods <rootbeer@teleport.com>
Re: Quick PERL Quesiton <vinbetro@vantek.net>
Re: Random access files in PERL (Randy J. Ray)
Re: Random access files in PERL <rootbeer@teleport.com>
Random seeding and returning the seed? (Terry Michael Fletcher - PCD ~)
Re: real/effective GID/UID <rootbeer@teleport.com>
regex question (Dan Pfefferkorn)
Re: regex question (Tad McClellan)
Re: regular expressions <rootbeer@teleport.com>
Re: RFC: Xlib.pm (Randy J. Ray)
Re: Sending e-mail using Perl for NT - don't wanna... g <cap@imagine.de>
Re: socket programming (Bob Shair)
Re: What is "exec format error"? (Nathan V. Patwardhan)
Re: what is my, lc and etc and where to learn it? (Tad McClellan)
Re: What's wrong with my scripts??????? <jhoglund@mirage.skypoint.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Jun 1997 18:18:45 -0700
From: subodh@best.com (Subodh Desai)
Subject: Perl "compiler" or how do you protect your code?
Message-Id: <5oprll$of4@shellx.best.com>
Is there some way to compile the perl code into an executable?
Asked other way around -- if you make product that uses perl/cgi scripting
extensively, how do you protect the perl source code which is part your
product?
Thanks in advance for any help.
/Subodh Desai
------------------------------
Date: Mon, 23 Jun 1997 23:38:12 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: perl and perl5
Message-Id: <kvino5.du9.ln@localhost>
mike mah (esupu@warwick.ac.uk) wrote:
: hi perl gurus,
: I wonder whether there is different between
: #!/usr/local/bin/perl and
: #!/usr/local/bin/perl5
Yes there is a difference.
One of them is one character longer than the other one.
: will the same version of perl call?
I don't know because I don't have access to your filesystem...
They may point to separate executables.
They may point to the same executable.
They may point to separate executables that are identical.
what do you get from this command:
ls -l /usr/local/bin/perl /usr/local/bin/perl5
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Tue, 24 Jun 1997 15:43:52 -0600
From: kingzem@nationwide.com
Subject: Perl Network/Socket programming
Message-Id: <867183733.9237@dejanews.com>
I'm trying to get a client/server program to talk back and forth over a
tcp socket. I've pretty much just 'reworked' the examples in programming
Perl, but without success.
The problem I've narrowed this down to is that neither the client nor the
server sees the string sent across the socket until the socket is closed.
I've tried flushing the filehandle to the socket after each print command,
but it does not seem to help. I realize the client is probably buffering
the filehandle, but I don't know how to get around this. Any ideas or
examples?
Thanks!
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 24 Jun 1997 21:21:29 GMT
From: obp@onlinebp.com (Ivo Bieleveldt)
Subject: Perl script retrieving URL's
Message-Id: <33b03993.32114225@news.tref.nl>
Hi All,
Does anyone of a perl script that allows you to retrieve WWW pages. I
want to make a list of URLS, store these URL's in a seperate file.
Then I want to let the Perl script retrieve the first URL and store
the output in a seperate file and so on until the last URL.
I haven't found an application like this.
Thanks for your help !
Ivo Bieleveldt
---------------------------------
Online Business Productions
** abonneer nu op Nettips !! **
http://www.onlinebp.com/
------------------------------
Date: Tue, 24 Jun 1997 17:31:43 -0400
From: Scott Hammer <qzyn64@tpc.natp.gmeds.com>
To: henning@forge.franken.de
Subject: Re: Possible Bug: Multiple DBM Files at once
Message-Id: <33B03CBF.2F2C@tpc.natp.gmeds.com>
Henning Schmiedehausen wrote:
>
> Ok, I give up. I thought I understand this language. But I have the
> following problem, I stumbled over it in perl 5.003 and perl 5.004,
> using either NDBM oder DB data bases. This is on a SUN Ultra 1 running
> Solaris 2.5.1
>
> Basically I do the following thing:
>
> tie %firsthash, "DB_File", "list of entries", O_CREAT|O_RDWR, 0664)
>
> foreach $i (keys %firsthash)
> {
> tie %secondhash, "DB_File", "$DATADIR/$i", O_CREAT|O_RDWR, 0664)
> [ modify some fields in %secondhash ]
> untie %secondhash;
> }
> untie %firsthash;
>
> though I have to iterate over about 2000 database files, I should never
> have more than two database files open at once.
>
> But I run after about 60 ties's (db) or 30 ties's (NDBM) into "Too
> many open files". Reproduceable. And fuser tells me, that my program
> has indeed 60+ files open with an ulimit of 64. So the computer is
> right (bugger :-( )
>
Henning,
I have come across a similar problem in my work. I posted the problem
about 6 months ago to c.l.p.m. and have yet to receive a response. I
store 0 to 200 records daily to my DBM database, and have had to use
perl 4.036 to do it correctly. I am also running Perl 5.003, using
Solaris 2.5.1 on a Sun Ultra 1 system. I have tried using the tie/untie
with each of the five DBM modules listed in the latest Camel book, and
each gives me the same problem. After about 25-30 records are
processed, all tie commands and system calls return an error "Too many
open files".
Due to compliance directives from on high, we are to remove Perl 4.036
from our system in the near future.
Has anyone responded yet to your request (by e-mail, perhaps)? If not,
would someone out there PLEASE look into this. It is definitely a
repeatable and consistent error on my platform.
A snippet of code for reference:
use Fcntl;
use NDBM_File;
[snip ... building hashes here]
[foreach record]
tie( %DB_OBJECT, "NDBM_File", "$pdis_db/$ctrl",
O_RDWR | O_CREAT | O_EXCL, 0644
);
%DB_OBJECT = %text_obj;
untie( %DB_OBJECT );
Thanks in advance.
--
Scott Hammer qzyn64@tpc.natp.gmeds.com
EDS/GM Truck Engineering (248) 753-4739 (8-238)
------------------------------
Date: Tue, 24 Jun 1997 10:39:22 -0600
From: m.hunt@elsevier.co.uk
Subject: Possible typo in FileHandle module
Message-Id: <867165718.21104@dejanews.com>
I had a problem with the FileHandle module using the
following piece of code (from Programming Perl and the
FileHandle pod):
use FileHandle;
$fh = new FileHandle;
if ($fh->open "< file") {
print <$fh>;
$fh->close;
}
Which I could only make work if I changed the if line to:
if ($fh->open("< file")) {
(note added parentheses)
Is this a typo in the man page or am I missing something
subtle?
Matt.
--
Matthew Hunt - Electronic Product Development Analyst
Tel +44 (0) 1865 843188 Fax +44 (0) 1865 843967
m.hunt@elsevier.co.uk
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 24 Jun 1997 11:18:26 -0500
From: Chris Mason <cmason@ti.com>
Subject: Prototypes and pass-by-reference.
Message-Id: <33AFF352.50B4@ti.com>
All-
I'm reading Camel in the section about Prototypes (~p118) and I'm
confused. I'm trying to write a function which takes two arguments, a
string and a hash, adds some elements to the hash, and then returns the
hash. I'd like to pass the hash by reference rather than copying it
from @_, because it could be quite large. Here's what I have, which
doesn't work:
sub revdefine ($\%){
local ($filename, %aref) = @_;
my ($macro, $num);
open INFILE, "<$filename";
while (<INFILE>) {
if (/^\#define\s+(\w+)\s+(-?\d+)\s+/) {
$macro = $1;
$num = $2;
$aref{$num} = $macro;
}
}
print "Loaded $filename.\n";
close (INFILE);
return %aref;
}
I'd like to be able to call this function like so:
%hash = revdefine("file.h", %hash); # or something like that.
The Camel book talks about implicit references being made with
prototypes, but doesn't seem to get specific about how the values are
passed in. For example it gives:
declared as: called as:
------------------------------ --------------------------
sub mykeys (\%) mykeys %{$hashref}
But doesn't say how the hash shows up in &mykeys().
I guess I'm confused by both references and prototypes.
Thanks for any help. I really appreciate this group.
-c
--
Chris Mason -- <cmason@ti.com> -- Texas Instruments Software
"...the monstrous thing is not that men have created roses out of
this dung heap, but that...they should _want_ roses." -H. Miller
------------------------------
Date: 24 Jun 1997 12:05:37 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Q: an alternative to this use of "goto"?
Message-Id: <m390zzddoe.fsf@windlord.Stanford.EDU>
Randal Schwartz <merlyn@stonehenge.com> writes:
> Note: if you don't know what this does, DON'T BOTHER LEARNING. It's for
> Autoload handlers, and if you don't know what that is, don't bother with
> that either. :-)
Now, now. No need to be quite *that* way about it. :)
I had quite a lot of fun learning the innermost details of AUTOLOAD
handlers and using goto &func to great effect, resulting in a module that
can support loadable plug-in modules for various functions, making it
*much* more flexible for its intended purpose. And I didn't find learning
how to do that all that confusing at all; multiple inheritance via @ISA
gives me a lot more headaches.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 24 Jun 1997 21:51:30 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Q: an alternative to this use of "goto"?
Message-Id: <ECAvDu.7yo@nonexistent.com>
Randal Schwartz (merlyn@stonehenge.com) wrote on 1393 September 1993 in
<URL: news:8cvi3482e5.fsf@gadget.cscaper.com>:
++ >>>>> "Lloyd" == Lloyd Zusman <asfast@asfast.com> writes:
++
++ Lloyd> Of course. But in the subset of cases where "redo" and "goto" are
++ Lloyd> equivalent, there is nothing wrong with "goto" ... or at least
++ nothing
++ Lloyd> worse about it than using the equivalent "redo" construct.
++
++ ... except speed, which has already been pointed out elsewhere in this
++ thread. A "goto" is implemented by a *linear* search of all opcodes
++ from beginning to end looking for the goto target.
Hmmm, you should perlbug that. The compiler could have stored
at least all the lables in a hash.
If Perl allows goto's, it should do them efficiently.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Mon, 23 Jun 1997 18:47:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: kevinz@model-t.stortek.com
Subject: Re: Q: List/scalar context with methods
Message-Id: <Pine.GSO.3.96.970623183849.15285D-100000@kelly.teleport.com>
On 23 Jun 1997, Kevin Zwack wrote:
> What I what to be able to do is determine how many elements
> $Q->param('foo') will return. I could do this:
>
> @foo = $Q->param('foo')
> if (scalar(@foo) == 3) ...
>
> but this creates an extra array which seems wasteful.
No, it's not wasteful. You were going to use that data anyway, right? :-)
Seriously, a few small variables aren't a waste. You can always make them
lexically scoped if you're worried about their memory usage.
But I'm not sure that I understand _why_ you're doing this. If you're
simply counting items to make sure that they're entered properly, this is
probably the best way to do it, except that you should assign the items to
their target variable or variables instead of @foo. For example,
if ( ( ($bart, $lisa, $maggie) = $Q->param('foo') ) != 3 ) {
die "Wrong number of elements"; # or whatever
}
# Exactly three were assigned, all is well.
Of course, you don't _need_ to combine it all into the conditional of the
if statement, but this way you aren't "wasting" any scratch variables. :-)
{ # Naked block, for local scope
my(@list, $count);
$count = @list = $Q->param('foo');
die "Wrong number of elements" if $count != 3;
($bart, $lisa, $maggie) = @list;
}
Just Another Way To Do It, but this may be easier to maintain and
understand. 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, 24 Jun 1997 18:42:54 -0500
From: "Vince Betro" <vinbetro@vantek.net>
Subject: Re: Quick PERL Quesiton
Message-Id: <5opm9a$vk0$1@news.socomm.net>
I didn't get a thing you said Tom. I am just a beginer.
Jeff
------------------------------
Date: 24 Jun 1997 20:26:30 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: Random access files in PERL
Message-Id: <uowzpsfe7u1.fsf@tremere.ecte.uswc.uswest.com>
Randal Schwartz <merlyn@stonehenge.com> writes:
> >>>>> "Don" == Don Botten <donb@wcnet.org> writes:
>
> Don> I want to read and write to Random access files.
> Don> . . .
> Don> I have a few of Sams books on perl but cannot find
> Don> anything on random access files.
>
> Perl has C-like seek(), tell(), and read() functions and sends output
> with print() (not write). See the relevant Perl docs for these.
^^^^^^^^^^^^^^^^^^
Randall seems to have indirectly defined whether the Sams Perl books qualify.
:-) As it would happen, I agree.
Randy
--
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS Phone: (303)595-2869
Denver, CO rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin
------------------------------
Date: Mon, 23 Jun 1997 18:56:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Don Botten <donb@wcnet.org>
Subject: Re: Random access files in PERL
Message-Id: <Pine.GSO.3.96.970623185600.15285H-100000@kelly.teleport.com>
On Mon, 23 Jun 1997, Don Botten wrote:
> I want to read and write to Random access files. For example, I want to
> be able to change only one record of a file, or goto a particular spot
> to read some data.
Look for seek() in perlfunc(1). Does that do it? 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: 24 Jun 1997 16:37:15 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Random seeding and returning the seed?
Message-Id: <5oot3r$r40$1@news.fm.intel.com>
--
------------------------------
Date: Mon, 23 Jun 1997 18:37:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Alex `Taker` Pircher <pircher@informatik.tu-muenchen.de>
Subject: Re: real/effective GID/UID
Message-Id: <Pine.GSO.3.96.970623182159.15285C-100000@kelly.teleport.com>
On Mon, 23 Jun 1997, Alex `Taker` Pircher wrote:
> What's the difference between the real & effective UID/GID?
The real one is the one which belongs to the user. The effective one is
the one which is (temporarily) effective because the script is setuid.
> If I want to check if the User has the right to read the File which
> way must I use?
>
> if (-R $file) ...
> or
> if (-r $file) ...
You could use the first one, but there might be a better way. The better
way would be to use the method on p. 343 of the new Camel, which forks an
unprivileged child process to do the open. (That example writes instead of
reads, but that's easily changed.)
Why is this better? It may be that the user has rights to read the file,
but not one of its parent directories, for example. This way, you let the
system determine their access, rather than trying to do it yourself and
possibly being fooled into doing something wrong.
I'd use the first one for a quick sanity check, and then actually use the
fancier method to open and read the file. 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: 24 Jun 1997 02:02:57 GMT
From: danp@salaam.Eng.Sun.COM (Dan Pfefferkorn)
Subject: regex question
Message-Id: <5on9sh$m44$1@engnews2.Eng.Sun.COM>
Consider the following snippet:
$pattern = '$test';
while(<>) {
print "yes\n" if (/$pattern/);
}
It seems to me that this will never print out anything, since 'pattern'
has a '$' as the first character of the string. It turns out that perl
will substitute the string but then will consider the '$' of the string
'$test' as the end-of-line marker.
How can I do a pattern match where the pattern is quoted, i.e., where it
will match correctly if I type $test in stdin?
The point of this question is to understand how to use variable pattern
matching; please don't say: just use /\$test/ or something like that.
Basically I don't know what the pattern will contain but it may have one
(or more) '$' symbols in it.
Is there an easier way than to do a:
@foo = split(/\$/, $_);
and then do pattern matching on each element of @foo?
thanks
-dan
------------------------------
Date: Mon, 23 Jun 1997 23:33:58 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: regex question
Message-Id: <mnino5.du9.ln@localhost>
Dan Pfefferkorn (danp@salaam.Eng.Sun.COM) wrote:
: Consider the following snippet:
: $pattern = '$test';
: while(<>) {
: print "yes\n" if (/$pattern/);
: }
: It seems to me that this will never print out anything, since 'pattern'
: has a '$' as the first character of the string. It turns out that perl
: will substitute the string but then will consider the '$' of the string
: '$test' as the end-of-line marker.
: How can I do a pattern match where the pattern is quoted, i.e., where it
: will match correctly if I type $test in stdin?
$pattern = quotemeta '$test';
^^^^^^^^^
while(<>) {
print "yes\n" if (/$pattern/);
}
OR
$pattern = '$test';
while(<>) {
print "yes\n" if (/\Q$pattern/);
^^
}
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Mon, 23 Jun 1997 20:17:27 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tri Tram <tram@olympic.seas.ucla.edu>
Subject: Re: regular expressions
Message-Id: <Pine.GSO.3.96.970623201622.15285O-100000@kelly.teleport.com>
On Mon, 23 Jun 1997, Tri Tram wrote:
> Can somebody please help me with the regular expressions? I have the
> following:
> text #(text)
> text #(more test)
> test #(text and more text)
>
> I want to change it to:
> text add_text(text)
> text add_text(more_text)
> test add_text(text_and_more_text)
Do you want something as simple as using s/// with '#' in the left part
and 'add_text' in the right? That's too easy... :-)
-- 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: 24 Jun 1997 20:17:23 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: RFC: Xlib.pm
Message-Id: <uow205rfmto.fsf@tremere.ecte.uswc.uswest.com>
A few questions:
* Why avoid using Xlib (or any of the X link libs)? Is there a reason to not
write the XS code as wrappers over the known Xlib?
* If you are aiming for an Xlib clone, why try to make it OO?
* Will you be planning to offer any of the "shortcuts" X programmers are
familiar with, such as BlackPixel, WhitePixel, DefaultScreen, etc.?
Randy
--
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS Phone: (303)595-2869
Denver, CO rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin
------------------------------
Date: Tue, 24 Jun 1997 14:15:14 +0200
From: Carl Berger <cap@imagine.de>
Subject: Re: Sending e-mail using Perl for NT - don't wanna... gotta
Message-Id: <33AFBA52.3F01@imagine.de>
There is an excellent tool for sending
email under NT. And its free !!
Its called wMailto (or wSendmail, the older
version) and its available from
http://www.jgaa.com
Carl
------------------------------
Date: 25 Jun 1997 02:59:04 GMT
From: rmshair@uiuc.edu (Bob Shair)
Subject: Re: socket programming
Message-Id: <5oq1ho$se0$1@vixen.cso.uiuc.edu>
"Raymond K. Bush" <rbush@up.net> writes:
>
>On a similiar note with sockets. I have a small server which takes five
>lines from a small client. Now i want to throw this information and
>some analysis of this information into a log file. What i have been
>noticing is that the last line is never processed until the next request
>is made. Is there a way to "flush" this information out asap?
from one of my servers:
open(LOG,">>/cold/pwergrab/grabem/LOG.$jobname.$jobno") || <gripe...
select(LOG); # make LOG the default output file
$| = 1; # force flush after each write to LOG
--
Bob Shair Open Systems Consultant
1018 W. Springfield Avenue rmshair@uiuc.edu
Champaign, IL 61821 217/356-2684
< Not employed by or representing the University of Illinois >
------------------------------
Date: 25 Jun 1997 01:38:57 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: What is "exec format error"?
Message-Id: <5opsrh$fto@fridge-nf0.shore.net>
changhsu (changhsu@csua.berkeley.edu) wrote:
: exec format error
Problems like this generally mean that you're using a program compiled
on an incompatible OS, like compiling a program in Windows 95 and
trying to run it on a machine running Solaris (without a DOS emulator,
of course).
This isn't a Perl issue, though. You might try running the .exe file
from the command-line and see what happens, or re-compiling the
program under Windows NT and trying again. You should re-direct your
question to a misc or windows WWW servers newsgroup once you've fixed
the problem or have some solid leads.
Hope this helps!
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 23 Jun 1997 23:19:02 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: what is my, lc and etc and where to learn it?
Message-Id: <mrhno5.ls9.ln@localhost>
mike mah (esupu@warwick.ac.uk) wrote:
: hi perl gurus,
: I feel so strange, you know. Although I finished reading Learning
: Perl, I never encounter my, lc and etc. Why is that so?
Because they are part of Perl 5, and the Llama was written to
(more or less) Perl 4.
: Where can I get to
: learn complete (probably advance features) set of command (like above)?
>From the man pages that are included with the perl distribution.
>From the Perl FAQ available at http://www.perl.com/FAQ/
>From the next edition of the Llama book ( RSN I heard )
>From the Camel book: "Programming Perl", 2nd edition, http://www.ora.com/
: Any help is very appreciated. Thanks in advance.
: Let's strike for exellent.
^^^^^^^^
I like your subtle approach to humor...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 24 Jun 1997 17:08:17 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.com>
Subject: Re: What's wrong with my scripts???????
Message-Id: <5oouu1$5pu$1@shadow.skypoint.net>
Aya fall <ayafall@dartmouth.ccfne.ns.ca> wrote:
: Hi there:
: I have a file where the data is stored in fields.
: Name question1 question2 question3 question4....
: input1......................................................
: input2......................................................
: input3......................................................
: ...
: inputn.......................................................
: I wrote another script to open that file, and add every rating by field.
: open (RESULTS, "myfile.txt");
: while (<RESULTS>)
: foreach $name {
: $question1++;
: $question2++;
: .............
: $questionn++;
: Then I divide each total by the number of respondants. But it is not
: working, and I would appreciate any help.
If I'm guessing right, your data is numeric? and your trying to count the
numbers in each field?
if so this might help.
Jerry 1 2 3 4
John 7 3 2 4
you might try using something like @array = split() in place of foreach.
Then counting the numbers in each numeric element (for each pass on the
file) keeping a count of the number of lines.
$fld[1] =+ $array[1];
(I probably have the =+ backwards, I always seem to do that)
Jamie
------------------------------
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 660
*************************************