[12295] in Perl-Users-Digest
Perl-Users Digest, Issue: 5895 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 5 01:07:15 1999
Date: Fri, 4 Jun 99 22:00:19 -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 Fri, 4 Jun 1999 Volume: 8 Number: 5895
Today's topics:
Re: automatic html form response (was: Can Perl do this (Martin Vorlaender)
Re: Copying any files (Abigail)
Re: Could someone quickly tell me the syntax for the SS <kperrier@blkbox.com>
Re: Dating service script needed -matchmaker script (Jamie Jackson)
Does $' return the previous regexp's $' ? <laurens@bsqaure.com>
Re: Does $' return the previous regexp's $' ? <laurens@bsqaure.com>
Re: Does $' return the previous regexp's $' ? <rootbeer@redcat.com>
Re: Efficient way to extract form tags from an HTML p (Jamie Jackson)
Re: Efficient way to extract form tags from an HTML pag (Jamie Jackson)
Re: FAQ 5.20: How do I randomly update a binary file? (Larry Rosler)
Re: I pass an array to a subroutine, but that array is (Abigail)
Re: know Perl to maintain Perl (was: Re: I pass an arra (Ronald J Kimball)
Re: Lynx and Perl <rootbeer@redcat.com>
Re: Need help to File Upload in perl ! (David Efflandt)
Re: Password Generator <bill@fccj.org>
Re: Perl and Scheduling Tasks <bill@fccj.org>
Re: Please -> Binary Files - Thanks (Larry Rosler)
Re: Please -> Binary Files - Thanks (Matthew Bafford)
Re: sendmail doesn't work (DarStec)
Re: sendmail doesn't work (DarStec)
Re: sendmail doesn't work <rootbeer@redcat.com>
Re: Simple newbie question... <uri@sysarch.com>
Re: Simple newbie question... <uri@sysarch.com>
Re: Simple newbie question... <rootbeer@redcat.com>
Re: Simple newbie question... <uri@sysarch.com>
Re: Sorting Multidimensional Lists <rootbeer@redcat.com>
Re: The artistic license and perl: (Abigail)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 05 Jun 1999 03:48:25 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: automatic html form response (was: Can Perl do this?)
Message-Id: <375881e9.524144494f47414741@radiogaga.harz.de>
mda@discerning.com wrote:
: do you have a suggestion for how to go further
: and parse the html form, examine all the INPUT
: fields for defaults, make sure you've got a value
: for all of the non-defaulted ones, etc.?
I've got a form mailer that could be used as a basis for that.
See my web site for (how else could it be named ;-) formmail.pl.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
VMS is today what | work: mv@pdv-systeme.de
Microsoft wants | http://www.pdv-systeme.de/users/martinv/
Windows NT 8.0 to be! | home: martin@radiogaga.harz.de
------------------------------
Date: 4 Jun 1999 22:29:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Copying any files
Message-Id: <slrn7lh6qf.jgo.abigail@alexandra.delanet.com>
Alar Pandis (Alar@mtk.ut.ee) wrote on MMCIII September MCMXCIII in
<URL:news:7j8j2v$gr6$1@kadri.ut.ee>:
^^ Hi!
^^ I am new one in this programming area. I would like ask You to help me - I
^^ need just copy files via Perl (5.x) from one location into another location
^^ (no matter what is a file type; with only text-files no problem). How can I
^^ do that?
use File::Copy;
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 04 Jun 1999 22:57:53 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Could someone quickly tell me the syntax for the SSI include? (nt)
Message-Id: <ysiu2snti2m.fsf@blkbox.com>
"Oliver Brown" <oliver@admiralq.free-online.net> writes:
No.
------------------------------
Date: Sat, 05 Jun 1999 06:48:54 GMT
From: wasteNOSPAMbasket@bigfoot.com (Jamie Jackson)
Subject: Re: Dating service script needed -matchmaker script
Message-Id: <3758c5f9.3557992@news.erols.com>
On Fri, 04 Jun 1999 23:35:48 +0200, Mateo Byler <mto@render.es> wrote:
>I need something that would work as a dating service script.
I would suggest using the Romance::Matchmaker Perl module in
conjunction with the DBD:His&HerSQL driver, along with the His&HerSQL
DB engine.
;-)
Jamie
------------------------------
Date: Fri, 4 Jun 1999 19:09:09 -0700
From: "Lauren Smith" <laurens@bsqaure.com>
Subject: Does $' return the previous regexp's $' ?
Message-Id: <7ja0s6$b3g$1@brokaw.wa.com>
Hi all,
I have a script that I am working out that I seem to have gotten stuck on.
I'd like to take a string, put the stuff before a pattern into an array,
find the end of the pattern, and put everything that trails it into the
array.
Here's what i've got:
$_ = "This is XX something something YY my broken english.";
if (/XX/) {
# Found pattern, pushing stuff onto the array
push (@array, $`);
# Set $_ to trailing string
$_ = $';
# Look for ending pattern, if not on this line, then on other lines
until (/YY/) {
$_ = <HEADER>;
}
# Now put the string trailing the "YY" into the array
push (@array, $');
}
print @array;
Result: $array[0] = "This is "
$array[1] = " something something YY my broken english."
I've talked my way through this routine several times, and can't figure out
where my logic is wrong. It seems that $' is not getting updated by the
second regexp.
Can someone point out what I am doing wrong?
thanks,
Lauren
------------------------------
Date: Fri, 4 Jun 1999 19:26:55 -0700
From: "Lauren Smith" <laurens@bsqaure.com>
Subject: Re: Does $' return the previous regexp's $' ?
Message-Id: <7ja1tf$cmm$1@brokaw.wa.com>
>I have a script that I am working out that I seem to have gotten stuck on.
>I'd like to take a string, put the stuff before a pattern into an array,
>find the end of the pattern, and put everything that trails it into the
>array.
>Result: $array[0] = "This is "
> $array[1] = " something something YY my broken english."
>It seems that $' is not getting updated by the
>second regexp.
Actually, the print out is "This is something something YY my broken
english."
I am running Activestate Perl on NT.
Sorry for the double post
------------------------------
Date: Fri, 4 Jun 1999 20:15:40 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Does $' return the previous regexp's $' ?
Message-Id: <Pine.GSO.4.02A.9906042005490.5411-100000@user2.teleport.com>
On Fri, 4 Jun 1999, Lauren Smith wrote:
> # Look for ending pattern, if not on this line, then on other lines
> until (/YY/) {
> $_ = <HEADER>;
> }
>
> # Now put the string trailing the "YY" into the array
> push (@array, $');
It's not obvious, but that 'until' block has its own scope for match
variables. That is, they're automatically saved and restored for you. So,
when you've left that block, the value of $' is the same one you had going
in. (Trust me on this: For wonderful and subtle reasons, this is a feature
and not a bug.)
You may want to rewrite that code something like this.
while (1) {
if (/YY/) {
push @array, $';
last;
} else {
last if not defined($_ = <HEADER>);
}
}
Or you may want to use m//g in a scalar context to make a parser. Good
luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 05 Jun 1999 06:35:40 GMT
From: wasteNOSPAMbasket@bigfoot.com (Jamie Jackson)
Subject: Re: Efficient way to extract form tags from an HTML page.--Suggestions?
Message-Id: <3758c47d.3177818@news.erols.com>
On Fri, 4 Jun 1999 17:05:05 -0700, Tom Phoenix <rootbeer@redcat.com>
wrote:
>Okay.... But, just so you know, modules are standard Perl.
I've come to realize that.
>Honestly, you can't properly parse HTML with any simple regular
>expression. Even if all you want to do is remove all tags (and only tags)
>from a document, you'll need something pretty complex. Unless you don't
>care about doing it correctly. :-)
Alrighty then, you and David Cassell have whipped me into shape.
Thanks for the restraint you've shown ;-)
Jamie Jackson
------------------------------
Date: Sat, 05 Jun 1999 06:26:54 GMT
From: wasteNOSPAMbasket@bigfoot.com (Jamie Jackson)
Subject: Re: Efficient way to extract form tags from an HTML page.--Suggestions?
Message-Id: <3758bc6d.1114125@news.erols.com>
On Fri, 04 Jun 1999 17:06:08 -0700, David Cassell
<cassell@mail.cor.epa.gov> wrote:
>Well, if you really don't want to *use* the HTML::Parser
>module, you could still download it as example code.
Good suggestion, I just did. I didn't realize that the modules were
such well documented bits of "regular" Perl code -- stupid me.
>Take a look in the FAQ [perlfaq9], and you'll find several
>good reasons why the simple solutions like
>
>s/<.*?>//g;
You are right, I hadn't foreseen this type of possibility:
<IMG SRC = "foo.gif" ALT = "A > B">
Thank you very much for your input: Points well taken.
Jamie Jackson
------------------------------
Date: Fri, 4 Jun 1999 17:54:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 5.20: How do I randomly update a binary file?
Message-Id: <MPG.11c2153c45c2b3b1989b72@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37586de3@cs.colorado.edu> on 4 Jun 1999 18:22:59 -0700, Tom
Christiansen <perlfaq-suggestions@perl.com> says...
...
> open(FH, "+<somewhere") || die "can't update somewhere: $!";
binmode FH;
> seek(FH, $recno * $RECSIZE, 0);
...
What a wonderful opportunity you have to Do Good by updating this FAQ!
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 Jun 1999 18:55:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: I pass an array to a subroutine, but that array is broken up by @_.
Message-Id: <slrn7lgq7u.jgo.abigail@alexandra.delanet.com>
jwmoser@aragorn.sandia.gov (jwmoser@aragorn.sandia.gov) wrote on MMCI
September MCMXCIII in <URL:news:37556e42.526737874@news.sandia.gov>:
\\
\\
\\ # How can I prevent my array from being broken up into seperate
\\ # scalars and just get the whole array out of @_ with one shift?
By not using shift. shift() specifically shifts out *ONE* element of @_.
If you want a copy of @_, then do the same as when you want a copy
of any other array:
sub foo {
my @bar = @_;
foreach my $foo (@bar) {
print $foo, "\n";
}
}
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 5 Jun 1999 00:34:32 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: know Perl to maintain Perl (was: Re: I pass an array...)
Message-Id: <1dswgef.rev4b7pjhby8N@p43.tc17.metro.ma.tiac.com>
Greg Bacon <gbacon@itsc.uah.edu> wrote:
> In article <1dsumz2.iorgs510fsvd7N@[207.60.170.185]>,
> rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
> : Greg Bacon <gbacon@itsc.uah.edu> wrote:
> : > Would you write software documentation in a certain way because it
> : > would make maintenance easier for someone who doesn't know English?
> :
> : If I were planning to distribute my software to people who don't know
> : English, yes, of course I would.
>
> How are you possibly going to write documentation in English in such a
> way that it will be of any use to someone who doesn't speak (or at least
> read) English?
I assumed you were being facetious, so I humored you.
Assume someone has a rudimentary knowledge of English. Is it it then
okay to write the documentation so they can make use of it?
> : What is wrong with making Perl code accessible?
>
> Perl is plenty accessible to people who know Perl.
How much Perl does someone have to know before they're allowed to use
it?
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 4 Jun 1999 19:32:58 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Lynx and Perl
Message-Id: <Pine.GSO.4.02A.9906041928520.5411-100000@user2.teleport.com>
On Sat, 5 Jun 1999, CWK wrote:
> I would like to write a perl program to make use of Lynx to get files
> from another site. How can I redirect the output from the Lynx
> program, but not by writing to a file at first, to achieve this?
> 'lynx http://www.abc.def/~xyz/file'
You're very close. It looks as if your machine doesn't clearly show you
the difference between 'single quotes' and `backticks`.
> Actually, I've also tried to redirect the output to a file inside
> Perl. But it does not work. Why?
Can't say without seeing the code. Boil it down to two or three lines that
aren't doing what you expect, though, and you'll likely be able to
determine the problem quickly.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 04 Jun 1999 22:01:44 -0400
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Need help to File Upload in perl !
Message-Id: <slrn7lh1er.v0.efflandt@efflandt.xnet.com>
On Fri, 04 Jun 1999 12:10:45 +0530, rangagv <rangagv@compucomtech.com> wrote:
>Hi!
>
>I am trying to provide a facility for uploading doc files from my
>website using perl!
>i have a fair knowledge about perl.Can anyone help me and guide me how
>to do it!
perldoc CGI
CGI.pm can help you generate the form and process the file upload.
>Thanks in advance!
>
>GVR
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Fri, 04 Jun 1999 22:42:24 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Password Generator
Message-Id: <37588e46.0@usenet.fccj.cc.fl.us>
In article <slrn7lgove.jgo.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) wrote:
> Bill Jones (bill@fccj.org) wrote on MMCIII September MCMXCIII in
> <URL:news:37571f74.0@usenet.fccj.cc.fl.us>:
> **
> ** Easy to remember and secure do not
> ** really go together :)
>
>
> Neither does hard to remember and secure.
>
People aren't perfect - why expect a computer to be?
-Sneex- :]
__________________________________________________________________
Bill Jones | FCCJ DSS | Life is a 'Do it yourself' thing...
http://www.fccj.org/cgi/mail?dss
Jacksonville Perl Mongers
http://jacksonville.pm.org
jax@jacksonville.pm.org
'Be not the first by whom the new are tried,
nor yet the last to lay the old aside...'
------------------------------
Date: Fri, 04 Jun 1999 22:44:28 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Perl and Scheduling Tasks
Message-Id: <37588ebe.0@usenet.fccj.cc.fl.us>
In article <375864F1.8495148F@mail.cor.epa.gov>, David Cassell
<cassell@mail.cor.epa.gov> wrote:
> Tom Christiansen wrote:
>>
>> Win32 has tasks?
>
> Hey, of course it does!
>
> Why here's a partial list right here under the C:\Windows\Tasks
> directory:
> [172] Frustrate Tom Christiansen and drive him to the brink
> of madness.
I think Tom's approaching that even now...
-Sneex- :]
__________________________________________________________________
Bill Jones | FCCJ DSS | Life is a 'Do it yourself' thing...
------------------------------
Date: Fri, 4 Jun 1999 17:57:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Please -> Binary Files - Thanks
Message-Id: <MPG.11c215bf30b8199d989b73@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37586e9d@cs.colorado.edu> on 4 Jun 1999 18:26:05 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> "Nuno Felicio" <Nuno.Felicio@bigfoot.com> writes:
> :Imagine a file with this binary content:
> :(each byte is represented by its HEX format)
> :
> :A2 2D C3 4F 2F FF
> :
> :How can I open this file and check each byte with perl?
>
> Step 1: Install an operating system.
> Step 2: Read some data.
> Step 3: Compare its ordinal value with what you are about.
>
> If something doesn't work, you forgot step 1.
Alternatively he forgot step 1a:
Step 1a: After opening the file, use binmode on it.
See my comment to FAQ 5.20, coincidentally just posted.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 05 Jun 1999 04:07:31 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Please -> Binary Files - Thanks
Message-Id: <slrn7lh41i.30j.dragons@dragons.duesouth.net>
On Fri, 4 Jun 1999 17:57:04 -0700, Larry Rosler <lr@hpl.hp.com>
held some poor sysadmin at gun point while typing in the following:
: Tom Christiansen wrote:
: > Step 1: Install an operating system.
: >
: > If something doesn't work, you forgot step 1.
:
: Alternatively he forgot step 1a:
:
: Step 1a: After opening the file, use binmode on it.
:
: See my comment to FAQ 5.20, coincidentally just posted.
Not by tchrist's definition of Operating System.
--Matthew
------------------------------
Date: 05 Jun 1999 04:08:40 GMT
From: darstec@aol.com (DarStec)
Subject: Re: sendmail doesn't work
Message-Id: <19990605000840.25594.00000386@ngol06.aol.com>
In article <928349037.26114@proxy1.bigplanet.com>, "Sherry"
<vision4@bigplanet.com> writes:
>Thank you for having a look. I think the bottom line says it all. Do you
>know of a place I can download a script that will make a Free For All Links
>page with autoresponces sent back to the e-mail address of the poster?
>
>I am quite impressed at the help I've gotten in this newsgroup. Thank you
>so much.
>
>
>Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
>news:3755515b@newsread3.dircon.co.uk...
>>Sherry <vision4@bigplanet.com> wrote:
>>> http://easyhomebiz.virtualave.net
>>>
>>> I'm having trouble with a pre-written perl script. It functions
>beautifully
>>> in accepting links, collecting e-mail addresses and posting links. It
>does
>>> not send an automatic e-mail after a link is posted like it should.
>>>
>>
>>
>>
>>>
>>> # Server path of sendmail or equivalent.
>>> $mailprog = "/usr/sbin/sendmail";
>>>
>>
>>You will almost certainly find that your sendmail is somewhere else
>>you will need to confirm with your service provider but it is more
>>often to be found at /usr/lib/sendmail.
>>
For Virtual Avenue $mailprog = "/usr/sbin/sendmail"; is correct. They do have
some problems with their sendmail program though. One noted problem is that
their sendmail program will not send a notification to an AOL Email Address.
Perhaps there are other domains that they will not send to also.
Later,
Darrell Stec E-Mail: DarStec@aol.com
Webpage Sorcery
http://webpagesorcery.com
We Put the Magic in Your Webpages
------------------------------
Date: 05 Jun 1999 04:08:42 GMT
From: darstec@aol.com (DarStec)
Subject: Re: sendmail doesn't work
Message-Id: <19990605000842.25594.00000387@ngol06.aol.com>
In article <375616E1.E5C2BFD1@chatbase.com>, TRG Software : Tim Greer
<webmaster@chatbase.com> writes:
>Bill Jones wrote:
>>
>> In article <928336338.638375@proxy1.bigplanet.com>, "Sherry"
>> <vision4@bigplanet.com> wrote:
>>
>> > http://easyhomebiz.virtualave.net
>
>Free web server offering CGI... And you bring those troubles here? :-)
>
Let me get this right. Those that can't afford $100 or more a month for a
"real" web host are not suppose to learn Perl, and should be excluded from
asking questions and learning in this newsgroup?
>I think I'm late on this thread, so excuse my reply post to you Bill.
>:-)
>
>> > My permissions are set at chmod666 for all files except my links.cgi
>which
>> > is set for 777
>
>777 on a CGI script? You need to do some reading, and if you have
>further problems, then post it to the "CGI" NG.
Actually it doesn't matter what the cgi program's chmod is set to when it is
uploaded to the personal cgi-bin directory on Virtual Avenue, as the correct
permissions for files are set automatically by Virtual Avenue for that
directory only.
>
>> >
>> > The cgi script is:
>> >
>> <snip>
>> > # FFA Blaster requries that you are running Windows 95\/98.
>> > #
>> > # Copyright 1998-99 SPCK Software - All rights reserved
> ^^^^^^^^^^^^^
>How embarrassing for them. (Based on the code, let's hope for their
>sake, it isn't *their* code. :-)
>
>> <snip>
>> > # Server path of sendmail or equivalent.
>> > $mailprog = "/usr/sbin/sendmail";
>
>What? A Unix path to sendmail on a Windows system? Like I said, I am
>late in this thread, that just seemed odd. :-)
Virtual Avenue uses Unix, it does not use Windows.
>--
>Regards,
>Tim Greer: chatmaster@chatbase.com / software@linkworm.com
>Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
>TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
>Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
>Freelance Programming & Consulting, Musician, Martial Arts, Sciences.
>
>
>
Later,
Darrell Stec E-Mail: DarStec@aol.com
Webpage Sorcery
http://webpagesorcery.com
We Put the Magic in Your Webpages
------------------------------
Date: Fri, 4 Jun 1999 21:26:44 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: sendmail doesn't work
Message-Id: <Pine.GSO.4.02A.9906042113150.5411-100000@user2.teleport.com>
On 5 Jun 1999, DarStec wrote:
> >Free web server offering CGI... And you bring those troubles here? :-)
> Let me get this right. Those that can't afford $100 or more a month
> for a "real" web host are not suppose to learn Perl, and should be
> excluded from asking questions and learning in this newsgroup?
I'm not trying to be sarcastic here, but I sincerely think that you may
not realize that those last three punctuation marks on the quoted line are
not line noise but a "smiley". These are intended to show that the poster
doesn't mean the comment sarcastically, but humorously. Of course, that
can't excuse out-and-out maliciousness, but I see no evidence of that. No
one is attacking you.
OTOH, whether you can afford something related to the web has no relevance
to whether you're welcome to ask questions and learn here. We ask
primarily that you make sure that your question is truly about Perl and
not easily answered in the docs and FAQs and similar resources. If you do
that much and are polite, you should be treated always with respect. And
perhaps a little harmless teasing. :-)
I may be mistaken, but it seems that the poster was suggesting that the
services of a "free web server offering CGI" programming might not be
worth the price. In my experience, that's been the case, but you're (as
always) welcome to make up your own mind.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 04 Jun 1999 22:59:51 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Simple newbie question...
Message-Id: <x73e079wt4.fsf@home.sysarch.com>
>>>>> "MM" == Mark Morley <mark@islandnet.com> writes:
MM> Uri Guttman (uri@sysarch.com) wrote:
MM> : a more important question is, is it useful to know? since they are
MM> : converted to each other when needed, why should you care which form it
MM> : is in? as someone in p5p pointed out that the act of printing a variable
MM> : with a number in it does an implicit conversion to a string. so you
MM> : don't even have much control over what format a variable has.
MM> Ok, here's the scenario... There is a function that is provided by
MM> someone else that takes a string value and performs a lookup. It returns
MM> a string result or a 0 if it couldn't find anything. Consider this code:
MM> if( ($value = lookup( $key )) == 0 ) {
MM> print "No value found for $key!";
MM> } else {
MM> print "Value = $value";
MM> }
MM> This works as expected EXCEPT when the lookup function returns the string
MM> "0", in which case it acts exactly as though it returned 0 (the number).
MM> It doesn't make any difference if I use "eq" instead of "==".
MM> Seems to me the only real solution is to change the lookup function to
MM> indicate a failure via some other result code.
that is a horribly designed function. and that is a great reason why you
should use undef for errors and not some value. then you test the retunr
with defined and have no issues (unless undef is a legitimate value
too.)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 04 Jun 1999 23:22:20 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Simple newbie question...
Message-Id: <x7yahz8h77.fsf@home.sysarch.com>
>>>>> "TP" == Tom Phoenix <rootbeer@redcat.com> writes:
>> I thought that one really couldn't distinguish between them, because
>> each is converted into the other in relevant contexts.
TP> Nearly always. Almost any program which relies on their difference should
TP> be recoded. But in a few very rare cases you may need to know the
TP> difference - such as in a parameter to syscall, or a bitmask. Here's the
TP> (aesthetically pleasing!) way I use to distinguish a number from its
TP> numeral in those rare cases.
why not just force a conversion as needed:
$value + 0 # force numeric
"$value" # force string
$value . '' # force string (many other possibilities)
so you never have to detect the format, you create it.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 4 Jun 1999 21:10:19 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Simple newbie question...
Message-Id: <Pine.GSO.4.02A.9906042035120.5411-100000@user2.teleport.com>
On 4 Jun 1999, Uri Guttman wrote:
> why not just force a conversion as needed:
>
> $value + 0 # force numeric
> "$value" # force string
> $value . '' # force string (many other possibilities)
>
> so you never have to detect the format, you create it.
I must have been unclear. Here's a somewhat contrived example of this
admittedly very rare case. Let's say that you're making a utility function
intended to work with bit vectors produced by Perl's four bitwise vector
operators ( | & ^ and ~ ). Let's say the function should return the number
of one bits in the bit vector. Because of hysterical raisins, the bitwise
operators can work with both numbers and strings, so this function could
be called with a number as its parameter, or with a string:
my $from_number = &one_bits( 6 & 9 ); # parameter is 0
my $from_string = &one_bits( "6" & "9" ); # parameter is "0"
In the first case, the parameter is zero so the answer is zero. But in the
second the parameter is "0" and so the answer is two, which is the number
of one bits in 0x30. This subroutine can't work without knowing whether
its parameter is a string or a number, as you see.
To be sure, I'm recommending that you observe this distinction _only_ in
those rare cases in which Perl also observes this distinction. And even
then, we should consider whether it can be avoided.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 05 Jun 1999 00:16:06 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Simple newbie question...
Message-Id: <x7so878epl.fsf@home.sysarch.com>
>>>>> "TP" == Tom Phoenix <rootbeer@redcat.com> writes:
TP> On 4 Jun 1999, Uri Guttman wrote:
>> why not just force a conversion as needed:
>>
>> $value + 0 # force numeric
>> "$value" # force string
>> $value . '' # force string (many other possibilities)
>>
>> so you never have to detect the format, you create it.
TP> my $from_number = &one_bits( 6 & 9 ); # parameter is 0
TP> my $from_string = &one_bits( "6" & "9" ); # parameter is "0"
TP> In the first case, the parameter is zero so the answer is
TP> zero. But in the second the parameter is "0" and so the answer is
TP> two, which is the number of one bits in 0x30. This subroutine
TP> can't work without knowing whether its parameter is a string or a
TP> number, as you see.
TP> To be sure, I'm recommending that you observe this distinction
TP> _only_ in those rare cases in which Perl also observes this
TP> distinction. And even then, we should consider whether it can be
TP> avoided.
i understand what you are saying, but that is a poor api as we wouldbith
agree. if it is specified to take only numbers the caller should be
responsible to convert a string to a number. hence my comment on forcing
conversion. otherwise garbage in, garbage out. so IMO there should never
be a design which allows either numbers or strings and where it makes a
difference which one you pass in.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 4 Jun 1999 19:36:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Sorting Multidimensional Lists
Message-Id: <Pine.GSO.4.02A.9906041934470.5411-100000@user2.teleport.com>
On Fri, 4 Jun 1999 follansb@real.com wrote:
> I'm trying to sort an array of arrays,
Have you seen what Section 4 of the faq and the perlfunc manpage have on
this topic? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 4 Jun 1999 18:16:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: The artistic license and perl:
Message-Id: <slrn7lgnvn.jgo.abigail@alexandra.delanet.com>
Chris Nandor (pudge@pobox.com) wrote on MMCII September MCMXCIII in
<URL:news:pudge-0306991605040001@192.168.0.77>:
""
""
"" That might (or might not) be an interesting question to ask people: which
"" license do you or your organization use when you use perl?
I think that in most cases it doesn't matter. There will be only a
relatively few organizations that actually do more with perl than just
using it. And as long as you don't modify perl, both the AL and GPL give
you the same.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5895
**************************************