[7654] in Perl-Users-Digest
Perl-Users Digest, Issue: 1280 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 6 14:17:19 1997
Date: Thu, 6 Nov 97 11:00:39 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 6 Nov 1997 Volume: 8 Number: 1280
Today's topics:
An excellent example of perl madness (or "split stupidi <ghowland@hotlava.com>
Re: An excellent example of perl madness (or "split stu <merlyn@stonehenge.com>
Re: An excellent example of perl madness (or "split stu (Mike Heins)
Re: An excellent example of perl madness (or "split stu (Andrew M. Langmead)
Re: An excellent example of perl madness (or "split stu <ajohnson@gpu.srv.ualberta.ca>
Re: An excellent example of perl madness (or "split stu (Ilya Zakharevich)
Another batch of some simple newbie questions. :) (Pelt)
Calling Subroutine using Perl 5.0 for IntraNetware (Web <rlluhman@netins.net>
Calling Subroutine using Perl 5.0 for IntraNetware (Web <rlluhman@netins.net>
Calling Subroutine using Perl 5.0 for IntraNetware (Web <rlluhman@netins.net>
Calling Subroutine using Perl 5.0 for IntraNetware (Web <rlluhman@netins.net>
Calling Subroutine using Perl 5.0 for IntraNetware (Web <rlluhman@netins.net>
Re: Calling Subroutine using Perl 5.0 for IntraNetware <rootbeer@teleport.com>
Re: Declare hash of hashes in Perl4 <yozg@tdv.com>
extracting values from localtime <bobm@tiac.net>
Re: extracting values from localtime <bobm@tiac.net>
Re: extracting values from localtime (Honza Pazdziora)
Re: extracting values from localtime <ptimmins@netserv.unmc.edu>
inet_aton socket problem (J. Robert Mueller)
Re: IRIX (5.3/6.2), PERL, APACHE problem!!!! HELP !!!! (I R A Aggie)
Perl 553 Malformed Header error <gshepard@remc7.k12.mi.us>
PERL Teacher needed ASAP: DC Area (Richard Puckett)
Re: Perl->Java? Java->Perl? Gaaaaa! dg50@chrysler.com
Perl/NT file rights, how do I... <perlguy@inlink.com>
Perlmenu shell escape <s9ulzf@fnma.com>
Re: Q: locking and re-writing file (Henry Gabryjelski)
record level locking in perl dbm surat@indiamart.com
simple problem <scotts@mdmgr.com>
Re: simple problem <paulp@jumper.mcc.ac.uk>
Re: sockets on win95 <nick@glencros.demon.co.uk>
Re: Sorting and Counting with PERL <merlyn@stonehenge.com>
Re: Sorting and Counting with PERL (Mike Stok)
Re: Stoopid Question ??? <henry@DotRose.com>
Re: Stoopid Question ??? <westxga@ptsc.slg.eds.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 06 Nov 1997 17:25:30 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: An excellent example of perl madness (or "split stupidity")
Message-Id: <3461EF7A.73B1@hotlava.com>
It's not a bug, it's a feature! There's more than one way to do it!
This example helps to show what a monster of a language perl really is,
with unexpected (inconsistent?) behaviour not found anywhere else. The
follow-ups will demonstrate how the perl community think that this is a
good thing, all part of perls eclectic nature (as if that is some sort
of virtue), and how features such as this are certainly more important
than threads or typed exceptions...
Three of the following work as expected. A pint for anyone who can tell
my which three (without running the code):
print join(", ", split('|', "hello|world")), "\n";
print join(", ", split("|", "hello|world")), "\n";
print join(", ", split(/|/, "hello|world")), "\n";
print join(", ", split(/\|/, "hello|world")), "\n";
print join(", ", split("\|", "hello|world")), "\n";
print join(", ", split('\|', "hello|world")), "\n";
my $sep = "|"; print join(", ", split($sep, "hello|world")), "\n";
my $sep = "\|"; print join(", ", split($sep, "hello|world")), "\n";
my $sep = '|'; print join(", ", split($sep, "hello|world")), "\n";
my $sep = '\|'; print join(", ", split($sep, "hello|world")), "\n";
And, yes, I am well aware that some smartarse will point out that this
is in the documentation, section 9.12.4.5.14.56a, and I should have read
it before wasting everybody's time with this post. Time to give Python
a go I think ...
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: 06 Nov 1997 09:53:39 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <8cd8keufos.fsf@gadget.cscaper.com>
>>>>> "Gary" == Gary Howland <ghowland@hotlava.com> writes:
Gary> Three of the following work as expected. A pint for anyone who can tell
Gary> my which three (without running the code):
(Five, actually...)
Gary> print join(", ", split('|', "hello|world")), "\n";
No.
Gary> print join(", ", split("|", "hello|world")), "\n";
No.
Gary> print join(", ", split(/|/, "hello|world")), "\n";
No.
Gary> print join(", ", split(/\|/, "hello|world")), "\n";
Yes.
Gary> print join(", ", split("\|", "hello|world")), "\n";
Yes, but you're scaring me.
Gary> print join(", ", split('\|', "hello|world")), "\n";
Yes, but I'm still scared.
Gary> my $sep = "|"; print join(", ", split($sep, "hello|world")), "\n";
No.
Gary> my $sep = "\|"; print join(", ", split($sep, "hello|world")), "\n";
Yes, but you're scaring me again.
Gary> my $sep = '|'; print join(", ", split($sep, "hello|world")), "\n";
No.
Gary> my $sep = '\|'; print join(", ", split($sep, "hello|world")), "\n";
Yes, but you're scaring me again.
Gary> And, yes, I am well aware that some smartarse will point out that this
Gary> is in the documentation, section 9.12.4.5.14.56a, and I should have read
Gary> it before wasting everybody's time with this post.
You just don't seem to realize two things:
1) the first arg to split is *always* a regex
2) the | char is special in a regex
Once you get that down, the yes/no above is easy. The scary parts for
me is when you write "\|", which is a two char string, even though the
backslash usually means "the following char is special" in a string.
And how do you plan on getting me my pints?
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 298 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 6 Nov 1997 17:25:40 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <63suik$rmc$2@vixen.cso.uiuc.edu>
Gary Howland (ghowland@hotlava.com) wrote:
: And, yes, I am well aware that some smartarse will point out that this
: is in the documentation, section 9.12.4.5.14.56a, and I should have read
: it before wasting everybody's time with this post. Time to give Python
: a go I think ...
With that attitude, I give Python 3 days before you condemn it...
--
Regards,
Mike Heins
This post reflects the
opinion of my employer.
------------------------------
Date: Thu, 6 Nov 1997 18:09:45 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <EJ8L49.D2x@world.std.com>
Gary Howland <ghowland@hotlava.com> writes:
>Three of the following work as expected. A pint for anyone who can tell
>my which three (without running the code):
[code examples deleted]
>And, yes, I am well aware that some smartarse will point out that this
>is in the documentation, section 9.12.4.5.14.56a, and I should have read
>it before wasting everybody's time with this post. Time to give Python
>a go I think ...
OK, I'll be (at least one of the) people who point out the
documentation. The perlfunc man page says split() can be called in the
following forms:
split /PATTERN/,EXPR,LIMIT
split /PATTERN/,EXPR
split /PATTERN/
So any of your examples without a pattern as the first argument to
split is WRONG. If someone taught you that split divides by a string
instead of a regular expression, they were WRONG.
The vertical bar symbol is one of the 11 regular expression
metacharacters (or 14, if you count pairs of characters as separate.)
If you are going to work with regular expressions, one of the first
things you need to know is that some characters are not treated
literally. 11 special symbols are not unreasonable to remember.
Of the examples you provided, the only ones that I would trust would
be:
>print join(", ", split(/\|/, "hello|world")), "\n";
and the only other variations I would find acceptable would be:
my $sep = '\|'; print join(", ", split(/$sep/, "hello|world")), "\n";
or
my $sep = '|'; print join(", ", split(/\Q$sep/, "hello|world")), "\n";
Maybe you are at a rather sophmoric phase in your knowledge of
perl. You think you know what split() does, and refuse to believe
otherwise.
--
Andrew Langmead
------------------------------
Date: Thu, 06 Nov 1997 11:55:58 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <346204AE.7936FA2F@gpu.srv.ualberta.ca>
Gary Howland wrote:
!
[snip]
! This example helps to show what a monster of a language perl
! really is, with unexpected (inconsistent?) behaviour not found
! anywhere else.
actually, the only 'inconsistent' thing about split() is that
it treats split(" ",$string) differently than split(/ /,$string)
...but the former is a useful special case for awk emulation.
! Three of the following work as expected. A pint for anyone who
! can tell my which three (without running the code):
no pint for me, they all work as expected, some just don't
make much sense :-)
split() takes a regular expression to split on...if you feed it
a string it treats it as a regular expression (after any string
interpretation is applied to double quoted strings). So only
three of your examples (using /\|/ or '\|') split on the |
character, the rest wind up splitting on /|/ which is 'null or
null' because | is the alternation metacharacter in a regex.
(a few others might have done as you wanted too...like "\\|",
but who'd want to do that? :-)
! And, yes, I am well aware that some smartarse will point out that
! this is in the documentation, section 9.12.4.5.14.56a, and I
! should have read it before wasting everybody's time with this
! post. Time to give Python a go I think ...
the string.splitfields() method in python may be more to your
liking to split on a string instead of a regex, but the
backslashing you wind up doing with python regular
expressions might make you appreciate Perl's integrated
regex syntax (and additional regex features).
regards
andrew
------------------------------
Date: 6 Nov 1997 18:34:55 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <63t2kf$363$1@agate.berkeley.edu>
In article <EJ8L49.D2x@world.std.com>,
Andrew M. Langmead <aml@world.std.com> wrote:
> Gary Howland <ghowland@hotlava.com> writes:
> split /PATTERN/,EXPR,LIMIT
>
> split /PATTERN/,EXPR
>
> split /PATTERN/
>
> So any of your examples without a pattern as the first argument to
> split is WRONG. If someone taught you that split divides by a string
> instead of a regular expression, they were WRONG.
Which should not imply that split would not take a string as a first
argument.
Ilya
------------------------------
Date: 6 Nov 1997 12:04:59 GMT
From: pelt@madcoyote.com (Pelt)
Subject: Another batch of some simple newbie questions. :)
Message-Id: <63sbpb$e8g@ss.netgate.net>
************************************************************************
Hello everyone. I'm kinda new to programming in perl, working on a Sparc
and several Sun Unix systems. I'm trying to write some code/scripts, but
am starting to run into some annoying, simple mistakes somewhere,
and was wondering if anyone can help me out?
For one, I'm trying get the 3 letter day out of the date command. I'm
using:
$day = `date | awk '{print $1}'`
But the output of print $day is always the entire date command. I'm
figuring the pipe isn't working, but I'm not sure why.
Thanks in advance. :)
Dave/Pelt
------------------------------
Date: Thu, 6 Nov 1997 09:40:40 -0600
From: "Rick" <rlluhman@netins.net>
Subject: Calling Subroutine using Perl 5.0 for IntraNetware (Webserver 3.1)
Message-Id: <63soeg$lso$1@news.iastate.edu>
I have a script that has the following structure:
form method=get action=$base_url$furtherdirstructur/subroutine
The script is supposed to look at the directory structure and realize that
there is a subroutine attached to the URL and than move down and execute the
subroutine. It doesn't work under NetWare Webserver 3.1. However, it does
work on a UNIX server.
Suggestions Please!!!
------------------------------
Date: Thu, 6 Nov 1997 09:46:23 -0600
From: "Rick" <rlluhman@netins.net>
Subject: Calling Subroutine using Perl 5.0 for IntraNetware (Webserver 3.1)
Message-Id: <63sooo$i08$1@news.iastate.edu>
I have a script that has the following structure:
form method=get action=$base_url$furtherdirstructur/subroutine
The script is supposed to look at the directory structure and realize that
there is a subroutine attached to the URL and than move down and execute the
subroutine. It doesn't work under NetWare Webserver 3.1. However, it does
work on a UNIX server.
Suggestions Please!!!
------------------------------
Date: Thu, 6 Nov 1997 09:59:38 -0600
From: "Rick" <rlluhman@netins.net>
Subject: Calling Subroutine using Perl 5.0 for IntraNetware (Webserver 3.1)
Message-Id: <63sphb$mpb$1@news.iastate.edu>
I have a script that has the following structure:
form method=get action=$base_url$furtherdirstructur/subroutine
The script is supposed to look at the directory structure and realize that
there is a subroutine attached to the URL and than move down and execute the
subroutine. It doesn't work under NetWare Webserver 3.1. However, it does
work on a UNIX server.
Suggestions Please!!!
------------------------------
Date: Thu, 6 Nov 1997 09:53:09 -0600
From: "Rick" <rlluhman@netins.net>
Subject: Calling Subroutine using Perl 5.0 for IntraNetware (Webserver 3.1)
Message-Id: <63sp5o$i9c$1@news.iastate.edu>
I have a script that has the following structure:
form method=get action=$base_url$furtherdirstructur/subroutine
The script is supposed to look at the directory structure and realize that
there is a subroutine attached to the URL and than move down and execute the
subroutine. It doesn't work under NetWare Webserver 3.1. However, it does
work on a UNIX server.
Suggestions Please!!!
------------------------------
Date: Thu, 6 Nov 1997 09:49:26 -0600
From: "Rick" <rlluhman@netins.net>
Subject: Calling Subroutine using Perl 5.0 for IntraNetware (Webserver 3.1)
Message-Id: <63sov6$k0p$1@news.iastate.edu>
I have a script that has the following structure:
form method=get action=$base_url$furtherdirstructur/subroutine
The script is supposed to look at the directory structure and realize that
there is a subroutine attached to the URL and than move down and execute the
subroutine. It doesn't work under NetWare Webserver 3.1. However, it does
work on a UNIX server.
Suggestions Please!!!
------------------------------
Date: Thu, 6 Nov 1997 08:23:47 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Rick <rlluhman@netins.net>
Subject: Re: Calling Subroutine using Perl 5.0 for IntraNetware (Webserver 3.1)
Message-Id: <Pine.GSO.3.96.971106082156.29771Q-100000@usertest.teleport.com>
On Thu, 6 Nov 1997, Rick wrote:
> I have a script that has the following structure:
> form method=get action=$base_url$furtherdirstructur/subroutine
That's not a script. It looks like a mixture of HTML and Perl. Maybe it's
from some Perl code intended to print an HTML page? But either way, it's
not enough to be sure what's going on.
> The script is supposed to look at the directory structure and realize
> that there is a subroutine attached to the URL and than move down and
> execute the subroutine. It doesn't work under NetWare Webserver 3.1.
> However, it does work on a UNIX server.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN. Hope this helps!
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 6 Nov 1997 11:58:08 -0000
From: "Yoz Grahame" <yozg@tdv.com>
Subject: Re: Declare hash of hashes in Perl4
Message-Id: <3461af7c.0@ispc-news.cableinet.net>
>: For some reason, I am still using Perl4. But I don't know how to declare
>: Hash of Hashes.
>
>Unfortunately for you, Perl 4 doesn't support references, which are
>essential for creating complex data structures ( {key1=>val1,key2=>val2}
>creates a reference to a hash with two keys. This reference can be stored
>anywhere a scalar can, particularly in the value of another hash). It
>*might* be possible to simulate an HOH in Perl 4 by means of some rather
>lengthy magical incantations involving typeglobs, but it would definitely
>not be pretty; remember that what you'd be doing is essentially casting
>spells that are supposed to resurrect a dead camel.
As someone who has attempted things like this in an earlier, more innocent
life, and who knows there *are* valid reasons to code Perl4 (such as, you're
running on DOS, or your server sysadmin is stuck in 1991), I can't help but
think, "Ah, what the hell, let's give it a go."
I've never been much cop with typeglobs so I'm just going to use the
stupidly-extended-hash-keys solution, which is:
$multihash{"tophash{secondhash}"}=$value;
to set up an identical set of keys in a list of subhashes:
@tophashes=("hash1","hash2","hash3");
@subhashkeys=("key1","key2","key3");
@subhashvals=("val1","val2","val3");
foreach $t (@tophashes) {
for ($i=$[;$i<=$#subhashkeys;$i++) {
$multihash{"$t{$subhashkeys[$i]}"}=$subhashvals[$i];
}
}
to pull out a subhash from the multihash, and copy it into %myhash:
$subhash="hash1";
foreach (keys(%multihash)) {
if (/^$subhash\{([^}]+)\}/) {
$myhash{$1}=$multihash{$_}
}
}
etc. etc.
Disclaimers:
It's probably terribly inefficient
It may be easier with typeglobs
There's More Than One Way To Do It
I haven't tested any of it so there's probably at least one typo in the code
I was born at an early age
Fight for your right to dereference
-- Yoz
Yoz Grahame - Web Technologist, Guide Researcher
yoz@yoz.com / www.yoz.com | The Digital Village: yoz@tdv.com / www.tdv.com
------------------------------
Date: Thu, 06 Nov 1997 10:59:31 -0500
From: Bob Maillet <bobm@tiac.net>
Subject: extracting values from localtime
Message-Id: <3461E963.B03D6486@tiac.net>
Hi,
I am working with the localtime function and am wondering what is a
good way to extract the elements of the localtime output string. It
seems that if I use substr I will eventually run into a problem because
month, day, year,etc are not preceeded by a zero when they contain a
single/double digit. Any help would be appreciated.
Bob
------------------------------
Date: Thu, 06 Nov 1997 12:04:57 -0500
From: Bob Maillet <bobm@tiac.net>
Subject: Re: extracting values from localtime
Message-Id: <3461F8B9.4B3E5314@tiac.net>
Bob Maillet wrote:
> Hi,
>
> I am working with the localtime function and am wondering what is a
> good way to extract the elements of the localtime output string. It
> seems that if I use substr I will eventually run into a problem because
> month, day, year,etc are not preceeded by a zero when they contain a
> single/double digit. Any help would be appreciated.
>
> Bob
I have found one but now would like to add minutes hours or days to the
current time..will post if Im stuck.
Thanks,
Bob
------------------------------
Date: Thu, 6 Nov 1997 17:53:20 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: extracting values from localtime
Message-Id: <adelton.878838800@aisa.fi.muni.cz>
Bob Maillet <bobm@tiac.net> writes:
> Hi,
>
> I am working with the localtime function and am wondering what is a
> good way to extract the elements of the localtime output string. It
> seems that if I use substr I will eventually run into a problem because
> month, day, year,etc are not preceeded by a zero when they contain a
> single/double digit. Any help would be appreciated.
Why don't you use it in array context?
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
says perlfunc man page and it really works.
Hope this helps,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: Thu, 06 Nov 1997 12:21:17 -0600
From: Patrick Timmins <ptimmins@netserv.unmc.edu>
Subject: Re: extracting values from localtime
Message-Id: <34620A9D.3EFE@netserv.unmc.edu>
Bob Maillet wrote:
>
> Hi,
>
> I am working with the localtime function and am wondering what is a
> good way to extract the elements of the localtime output string. It
> seems that if I use substr I will eventually run into a problem because
> month, day, year,etc are not preceeded by a zero when they contain a
> single/double digit. Any help would be appreciated.
>
> Bob
Regex it. On a win95 system localtime() gives: Thu Nov 6 12:15:14 1997
Do something like:
$mytime = localtime();
$mytime =~ m/(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)/;
$myweekday = $1;
$mymonth = $2;
$myday = $3;
$myhour = $4;
$myminute = $5;
$mysecond = $6;
$myyear = $7;
Hope this helps.
Patrick Timmins
U. Nebraska Medical Center
------------------------------
Date: 6 Nov 1997 17:58:27 GMT
From: muellb@rpi.edu (J. Robert Mueller)
Subject: inet_aton socket problem
Message-Id: <63t0g3$grf@usenet.rpi.edu>
Hello,
I'm trying to use inet_aton from the Socket library. My college account
and my ISP account give me this error:
Undefined subroutine &main::inet_aton called at file.pl line 26.
This same script works on another ISP that I used to use. Is there
something that I should request the system admins do to get this working?
I have :
use Socket;
at the top of the file and
my $sin = sockaddr_in($port, inet_aton($dest));
on line 26.
Any help would be appreciated.
I prefer to be contacted by email.
Thank you,
Bob
muellb@rpi.edu
------------------------------
Date: Thu, 06 Nov 1997 10:10:32 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: IRIX (5.3/6.2), PERL, APACHE problem!!!! HELP !!!!
Message-Id: <-0611971010320001@aggie.coaps.fsu.edu>
In article <3460FC7B.15FB@pdb.pdb.bnl.gov>, libeson
<libeson@pdb.pdb.bnl.gov> wrote:
+ The new web service is running on a 6.2 IRIX64 machine r8000, with
+ 4 90 mhz processors. Could the machine be to fast sometimes?
I would go ahead and get the INSTable version of perl from SGI.
<url:http://reality.sgi.com/scotth/info/perl5.html>
It would appear that SGI is getting a clue, and will be including perl5
as the default in future system software distributions. Yeah!
Out of curiousity, are you using the cgi-lib.pl CGI library? My feeling
is that it is...incoherently buggy. We had a CGI that would work and
not work intermittently. After I converted it from using the cgi-lib.pl
to CGI.pm, it works consistently.
James
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Thu, 6 Nov 1997 13:25:59 -0500
From: "Greg" <gshepard@remc7.k12.mi.us>
Subject: Perl 553 Malformed Header error
Message-Id: <63t1e3$avl$1@news.wmich.edu>
What is a 553: Malformed header error?
Greg Shepard
gshepard@remc7.k12.mi.us
------------------------------
Date: 6 Nov 1997 16:18:40 GMT
From: smedit@access5.digex.net (Richard Puckett)
Subject: PERL Teacher needed ASAP: DC Area
Message-Id: <63sql0$o9i$1@news2.digex.net>
George Washington University in Washington, DC, needs a PERL pro also able
to teach an intro class in PERL/CGI. This is time-sensitive
(probably by COB Friday 11/7) so please contact ASAP:
Steve Saft
202-973-1101
(or reply by return email and I will forward message to Mr. Saft).
------------------------------
Date: Thu, 06 Nov 1997 09:12:09 -0600
From: dg50@chrysler.com
Subject: Re: Perl->Java? Java->Perl? Gaaaaa!
Message-Id: <878828933.18050@dejanews.com>
In article <63nsk3$iqt$1@castor.dnai.com>,
"Scott Vachalek" <nospam_scottv@dnai.com> wrote:
>
> I hate to tell you this but I think Java and Perl are only dating and
> marriage is quite a ways in the future.
Heh, I love this quote. ;)
> Java is actually a much simpler language than Perl, in that there's not a lot
> of keywords and syntax and what little there is, is very consistent.
I beg to differ. I've been mucking about with Java's innards lately
(mostly with AWT) with some success, but I've come to the conclusion that
if perl is "There's More Then One Way To Do It" then Java is "Take Your
Medicine, It's Good For You"
While I admit to a certain elegance in the language, it sure does get in
the way of getting stuff done in a hurry.
For instance, what's the Java equivelent of:
open INFILE, "$filename" or die "$filename not found or unreadable!";
while(<INFILE>) {
($field[1][$x], $field[2][$x] $field[3][$x]) = split(/$separator/);
$x++;
}
> One final thing: applets are by default not allowed to access the file
> system. In order to do that you'll have to look into "signed" applets.
>
If the program is written as an application, can a web browser be used as
the JVM to run it, and can it then have access to the filesystem?
Does "Corel XXXX for Java" come with it's own JVM, or can it use
Netscape's?
> Good luck!
Thanks. For all my whining, the responses to my first post have been
helpful.
I will say this though. I understand fully that Java Is Not Perl, and
Perl Is Not Java. They are designed for different things, and they do
different jobs better than others, so I'm not out to get into a Perl vs
Java flamefest.
However, the sooner The Larry gets done writing the Java bytecode module
for the Perl compiler, and the sooner there is an API that maps the AWT
environment into Perl, the happier I'll be.
DG
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 6 Nov 1997 17:12:24 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Perl/NT file rights, how do I...
Message-Id: <3461FA78.1CBAD033@inlink.com>
I am trying to find a way, in Perl, to enter an arbitrary file or
directory name and retrieve the groups that have rights to it as well as
which rights the group has.
I have tried the command line CACSL program but it strips off the group
names if you pipe or redirect the output for some reason.
I am looking either for a library that will offer me this information or
if someone has done it already, how did you do it?
I have checked the FAQ's, that is how I found out about the CACSL
program, but it isn't working like it should...
Thanks,
Brent Michalski
------------------------------
Date: Thu, 06 Nov 1997 09:28:46 -0500
From: Lin Feng <s9ulzf@fnma.com>
Subject: Perlmenu shell escape
Message-Id: <3461D41E.503B@fnma.com>
Hi all,
I have one problem that causes me a lot of headache and that is Is there
way I can go to the shell (via menu_shell_command() or other means) in
Perlmenu
directly without hitting the '!'?
Thanks,
Lin
------------------------------
Date: 6 Nov 1997 17:14:15 GMT
From: henryg@ernie.WPI.EDU (Henry Gabryjelski)
Subject: Re: Q: locking and re-writing file
Message-Id: <63stt7$lf6$1@bigboote.WPI.EDU>
Tom Phoenix <rootbeer@teleport.com> wrote:
>You shouldn't explicitly unlock a file (unless you understand this rule
>completely).
Could you explain? I know there are potential issues with
fflush()'ing the output, but can I force that?
Would there ever be a problem unlocking a file if no write access
occurred? I cannot see the problem if one exists.
Henry
------------------------------
Date: Thu, 06 Nov 1997 09:02:01 -0600
From: surat@indiamart.com
Subject: record level locking in perl dbm
Message-Id: <878828022.16925@dejanews.com>
Members, I have a common problem regarding locking of a database having
large number of records. This database is accessed by CGI. At a time
large number of CGI process may want to access/update same database. I
am using Perl dbm file to store data. I may implement locking by
creating a .lock file. and provide access to CGI procees according to
there PID. This locking is the file level locking It means at a time
only single process may have access to the database , other have to wait,
altough these process may want to access/update different record. May we
can use record level locking for dbm file in perl, how can we implement
record level locking. Pl reply at surat@indiamart.com. TIA surat
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 06 Nov 1997 12:25:07 -0500
From: Scott Saddison <scotts@mdmgr.com>
Subject: simple problem
Message-Id: <3461FD72.C15CA455@mdmgr.com>
I'm having difficulties with comparing variables.
i.e.
#!/usr/bin/perl
$a = "this";
$b = "thisis";
if ( $a == "$b" ) {
print "$a equals $b\n";
} else {
print "huh\n";
};
will print "this equals thisis"
I know this is a simple problem, I searched thru my perl manual but did
not find a solution. I appreciate any responses sent.
Scott (scott@skyenet.net)
Thanks!
------------------------------
Date: Thu, 06 Nov 1997 18:09:45 -0800
From: Paul Plowman <paulp@jumper.mcc.ac.uk>
Subject: Re: simple problem
Message-Id: <34627869.5AAC@jumper.mcc.ac.uk>
> if ( $a == "$b" ) {
> print "$a equals $b\n";
> } else {
> print "huh\n";
> };
>
> will print "this equals thisis"
That should be:
if ($a eq $b) {
etc.
== is only used for numerical values
Paul.
------------------------------
Date: Thu, 06 Nov 1997 15:53:28 +0000
From: Nick Glencross <nick@glencros.demon.co.uk>
Subject: Re: sockets on win95
Message-Id: <3461E7F8.42A3@glencros.demon.co.uk>
Creede Lambard wrote:
>
> I think there's something about the way Windows 95 implements sockets that
> Perl doesn't like (or vice versa, or something).
I use the ActiveWare Internet Corp. (http://www.ActiveWare.com) version
of Perl, and sockets (any everything else) work like a dream under
Win95.
Nick Glencross
------------------------------
Date: 06 Nov 1997 09:12:19 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: abigail@fnx.com
Subject: Re: Sorting and Counting with PERL
Message-Id: <8cpvoeuhlo.fsf@gadget.cscaper.com>
>>>>> "Abigail" == Abigail <abigail@fnx.com> writes:
Abigail> No sense calling system.
Abigail> map {$hash {$_} ++;} @list;
Abigail> print map {"$_ occurs $hash{$_} times\n";} keys %hash;
No sense calling map in a void context and wasting CPU cycles building
up a monster return list just to throw it away:
for (@list) { $hash{$_}++ };
print map {"$_ occurs $hash{$_} times\n";} keys %hash;
(And yes, Abigail, I know you believe Perl should optimize this out,
but for *now*, it *doesn't*, so let's color within the lines for a
while, please?)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 298 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 6 Nov 1997 16:57:12 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Sorting and Counting with PERL
Message-Id: <63sst8$1c6@news-central.tiac.net>
In article <8cpvoeuhlo.fsf@gadget.cscaper.com>,
Randal Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Abigail" == Abigail <abigail@fnx.com> writes:
>
>Abigail> No sense calling system.
>
>Abigail> map {$hash {$_} ++;} @list;
>Abigail> print map {"$_ occurs $hash{$_} times\n";} keys %hash;
>
>No sense calling map in a void context and wasting CPU cycles building
>up a monster return list just to throw it away:
>
> for (@list) { $hash{$_}++ };
> print map {"$_ occurs $hash{$_} times\n";} keys %hash;
maybe you can even get rid of that map...
print "$key occurs $count times\n" while ($key, $count) = each %hash;
unless you want to order keys %hash in some way? Probably doesn't matter
that much for "reasonable" numbers of keys in %hash.
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@colltech.com | Collective Technologies (work)
------------------------------
Date: Thu, 06 Nov 1997 12:23:11 -0500
From: Henry Hartley <henry@DotRose.com>
Subject: Re: Stoopid Question ???
Message-Id: <3461FCFF.6DF8FDC1@DotRose.com>
Not sure about Windows 95 but in WinNT, instead of trying to use a unix
command in a non-unix environment, right-click on the file name (in
Windows Explorer for example) and select Properties. Then go to the
security tab and change the permissions for that file.
Sgt Friday wrote:
> I am trying to run a CGI script on WIN95. How do I use the "chmod"
> command? Forgive me if this is a really dumb question, but I have read
> the FAQ's to no avail. Any advice, or URL's to get me headed in the
> right direction would be appreciated greatly!
> SGT FRIDAY
> ziggy@2enid.com
------------------------------
Date: Thu, 06 Nov 1997 11:36:04 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: Stoopid Question ???
Message-Id: <3461ABA4.5C02@ptsc.slg.eds.com>
Sgt Friday wrote:
>
> I am trying to run a CGI script on WIN95. How do I use the "chmod"
> command? Forgive me if this is a really dumb question, but I have read
> the FAQ's to no avail. Any advice, or URL's to get me headed in the
> right direction would be appreciated greatly!
> SGT FRIDAY
> ziggy@2enid.com
chmod ($mode, $filename);
------------------------------
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 1280
**************************************