[15779] in Perl-Users-Digest
Perl-Users Digest, Issue: 3192 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 29 00:05:25 2000
Date: Sun, 28 May 2000 21:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959573108-v9-i3192@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 28 May 2000 Volume: 9 Number: 3192
Today's topics:
Re: Advantages of Perl over Cold Fusion? <robert.sandgren@hotmail.com>
Re: can perl do expire page like asp <s0218327@unix1.cc.ysu.edu>
CGI for WHOIS queries - Advice please <paul.knighton@bigfoot.com>
Re: CHDIR - I can't get it to work (Gwyn Judd)
Compiling perl 5.60/Win 95/gcc; dmake test dies "Compi (Steve A. Taylor)
Re: Converting an alphanumeric string into an integer n <callgirl@la.znet.com>
Re: Couple of Newbie RegExp questions <lr@hpl.hp.com>
Re: Html translation <frank@french-connexion.com>
Re: newbie: random access to large lists <lr@hpl.hp.com>
Re: newbie: random access to large lists <jeff@vpservices.com>
Pattern Match this! <kamri@asiapacificm01.nt.com>
Re: Pattern Match this! <sturman@netdoor.com>
Re: Pattern Match this! (Gwyn Judd)
Re: Perl date formatting <lr@hpl.hp.com>
Re: Perl date formatting <godzilla@stomp.stomp.tokyo>
Re: Perl date formatting (Steven Smolinski)
Perl IDE for Win32? osiris@mindless.com
PGP in Perl? bing-du@tamu.edu
Re: RegEx <bwalton@rochester.rr.com>
Re: seeking method to encode email addresses in web pag <lr@hpl.hp.com>
Re: seeking method to encode email addresses in web pag <callgirl@la.znet.com>
spawning a win app from perl .... siddsoni@hotmail.com
Waxing Philosophical <ryanc@nci1.net>
Re: Waxing Philosophical (Craig Berry)
Re: Weird script behaviour called from a web page. (Thaddeus L. Olczyk)
Re: Weird script behaviour called from a web page. (Steven Smolinski)
Re: Windows/Linux Incompatibility <lr@hpl.hp.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 29 May 2000 01:54:57 +0200
From: "Robert Sandgren" <robert.sandgren@hotmail.com>
Subject: Re: Advantages of Perl over Cold Fusion?
Message-Id: <gniY4.2115$b55.5027@nntpserver.swip.net>
Wow!, somebody else that using Cold Fusion !!
I need a perl variable that have the same function as
Cold Fusion's Application variabels..
Is ther any ???
------------------------------
Date: Sun, 28 May 2000 22:10:59 -0400
From: NagaPutih <s0218327@unix1.cc.ysu.edu>
Subject: Re: can perl do expire page like asp
Message-Id: <Pine.A41.4.20.0005282203270.34490-100000@unix1.cc.ysu.edu>
On Sun, 28 May 2000, Chung Derek wrote:
> thanks, can you however give me a clearer definition on the
> variable $expiration_data_on_GMT
yep, perlfunc -f gmtime
------------------------------
Date: Mon, 29 May 2000 01:26:07 +0100
From: "Paul Knighton" <paul.knighton@bigfoot.com>
Subject: CGI for WHOIS queries - Advice please
Message-Id: <3931ba28@eeyore.callnetuk.com>
Hi All,
I am currently trying to write a WHOIS Domain search facility - both single
& multi-match searches. I have based this on an example I found which :
i) determines the correct WHOIS domain server from the search extension(s)
(e.g. .co.uk, .com etc.),
ii) runs the 'whois' command on our host against that WHOIS server, &
iii) parses the textual output, determining success from the ab-/pre-scence
of a line /No match found for /.
This works, but response is slow for multi-extension searches (e.g.
searching for .com, .co.uk, .org.uk all at once) as each one is currently
tested by a separate WHOIS call.
I believe, based on the rapid response from other commercial WHOIS search
sites I have found, there must be a faster alternative.
I'd like your help to point me at any online resources which describe an
interface to WHOIS which would improve on the above method.
Many Thanks in advance. Please Cc: copy to my email as this is checked more
often.
Paul Knighton
Email: paul.knighton@bigfoot.com
------------------------------
Date: Mon, 29 May 2000 03:11:38 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: CHDIR - I can't get it to work
Message-Id: <slrn8j3o3q.4jj.tjla@thislove.dyndns.org>
I was shocked! How could Kenny <kenny@kenny.co.uk>
say such a terrible thing:
>I have an odd problem. I am trying to use the CHDIR command to change to a
>directory on my server. However, when I use the command
>
>chdir('/web/guide/maindirectory/') ? print ("It worked\n") : print ("It did
>not work.\n");
Try this for better error reporting:
chdir('/web/guide/maindirectory') or die "Couldn't change directory: $!";
print "It worked!";
@all = <*.*>;
etc...
This will give you a better idea of what went wrong.
>I get the response "It worked", therefore indicating that the script has
>successfully changed to that directory. However, the very next line is
>
>@all = <*.*>;
>
>and when I print it, it does not bring the stuff back from the
>/web/guide/maindirectory/ directory, it gives me a list of the files from
>the root.
>
>Anyone know if I am doing something wrong, or if I am expecting CHDIR to do
>something that it can't do?
It doesn't look like you are doing anything wrong. Maybe you have a
permissions problem or the wrong directory name.
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
The shifts of Fortune test the reliability of friends.
-- Marcus Tullius Cicero
------------------------------
Date: Mon, 29 May 2000 03:32:30 GMT
From: an400@freenet.carleton.ca (Steve A. Taylor)
Subject: Compiling perl 5.60/Win 95/gcc; dmake test dies "Compilation failed"
Message-Id: <3931d9ab.52885862@news.ncf.carleton.ca>
This recursively less funny voice inside keeps saying...Learn how this
one works.. . . . . .
What is the configuration to build Perl 5.60 from source with gcc and
dmake on Win 95b?
The dmake test stage fails -- after about 16 of the socket.o, io.o and
similar files show this message (and more)
Error -- Ambiguous inference chains for target 'Socket.o'
Then dmake test dies, summarizing /repeating this message for them
Compilation failed in require at ../lib/IO/[modulename].pm line xxx.
Did I mention I found another one.. Patch.exe. Benjamin Stuhl sent a
patch to G. Sarathy Dec. 15/99(cc'd to perl-5 porters, subj: [PATCH
5.005_63] GCC/Mingw32 cleanup) , saying this : fixed it ~run this
patch and it works~
So. Try cygwin's patch. No. (but some humor)
E:\>patch -Np1 < patch.gcc --verbose --dry-run
Hmm... I can't seem to find a patch in there anywhere.
patch: **** Only garbage was found in the patch input.
So. Which patch utility is needed (a win 95 port) ?
------------------------------
Date: Sun, 28 May 2000 15:37:32 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: Converting an alphanumeric string into an integer number
Message-Id: <39319FAC.6BFF56D1@la.znet.com>
Diablito wrote:
> >What are your parameters, your rules, your
> >mathematical equation for doing this? I can't
> >find a math relationship between those two.
> Well,this part is clear enough;standing to the a=1,b=2,..
> I want a sentence like "I don't know what to write" to
> be converted in a single number in the range 1-100,
> not a number for each letter (cat=c(3)+a(1)+t(20)=24)
I believe nobody will be able to help
you unless you state your objective
clearly and concisely with detail.
Your currently stated objective would
be met by simply substituting in a
random number less than one-hundred-one
for anything in your string which lies
between two periods or is of a random
length.
Godzilla!
------------------------------
Date: Sun, 28 May 2000 16:15:24 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Couple of Newbie RegExp questions
Message-Id: <MPG.139b485bf3fd6798aafb@nntp.hpl.hp.com>
In article <8golmi$ob$1@nnrp1.deja.com>, billy@arnis-bsl.com says...
...
> If you simply need to replace repeated tabs with just one space:
>
> $string =~ s/\t+/ /g;
For almost all manipulations of characters without context (except, here,
repetition), the tr() operator is a far more efficient way than using a
regex.
$string =~ tr/\t/ /s;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 29 May 2000 01:24:05 +0200
From: frank <frank@french-connexion.com>
Subject: Re: Html translation
Message-Id: <3931AA95.830FFDDD@french-connexion.com>
Thanks a lot Christian,
You know I'm not very familiar with perl yet.
I was wondering how I could pass myfile.html in first paramater on the
command line when I'm calling the script ??
Thanks again for your job
Christian Winter a +iLI-it :
> frank <frank@french-connexion.com> schrob:
> > I'm looking for a script to help in tranlating html files :
>
> > it should look for >a string between two brackets in the original
> > language<, then print it, read the translation from input and write it
> > in the original file.
> > Maybe it should also check for end of lines to consider >this kind
> > of situation<
>
> > Any idea is welcome
>
> Well, if you can be sure there are only alphanumeric
> characters between the angle brackets, then it's a
> simple regexp, otherwise it will get complicated or
> hardly solvable.
>
> Here's a little quick-hack, only problem it looses
> the line-feeds (I simply put them back after every
> closed angle bracket):
>
> ------------------------------------------------
> #!/usr/bin/perl -w
>
> use strict;
>
> my $html;
> open(IN, "<myfile.html") or die $!;
> while(<IN>) {
> chomp;
> $html .= $_." ";
> }
> close IN;
> $html =+AH4- s/>(+AFw-w+AFw-s*)*</">".translate($1)."<"/eg;
>
> $html =+AH4- s/>/>+AFw-n/g;
>
> open(OUT, ">myfile.html") or die $!;
> print OUT $html;
> close OUT;
>
> exit 0;
>
> sub translate {
> my $string = shift;
> print $string;
> return <STDIN>;
> }
> ------------------------------------------------
>
> HTH
> Christian
------------------------------
Date: Sun, 28 May 2000 15:52:05 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbie: random access to large lists
Message-Id: <MPG.139b42e3ec30aee398aafa@nntp.hpl.hp.com>
In article <MPG.1398537ca74be92a989680@goliath2.newsfeeds.com>,
reemul@newsfeeds.com says...
> I'm working on a script that needs to randomly grab a line from a large
> list (tens of thousands of lines). I want the whole line, and the lines
> are not fixed length. What is the best way of going about this? I'm a
> book-in-my-lap level of coder, so there might be something obvious I'm
> missing. I want the lists to be manually editable, so DBM doesn't seem
> appropriate. The number of lines might change drastically from this
> editing, so I don't want to just randomly go to a line and have it be out
> of range.
>
> Any help would be appreciated.
perlfaq5: "How do I select a random line from a file?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 28 May 2000 20:07:39 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: newbie: random access to large lists
Message-Id: <3931DEFB.3CD474B5@vpservices.com>
Anonymous wrote:
>
> In article <3930246C.C04CCAFB@vpservices.com>, jeff@vpservices.com
> says...
> > Thomas Stewart wrote:
> > >
> > > All-
> > >
> > > I'm working on a script that needs to randomly grab a line from a large
> > > list (tens of thousands of lines). I want the whole line, and the lines
> > > are not fixed length. What is the best way of going about this?
> >
> > If you want to do this with simple file operations, there was an entire
> > thread on exactly this topic about two weeks ago. There were a number
> > of answers posted. Check the archives at www.deja-news.com searching
> > for "random".
> I'll look into that. I actually did try that search but a) Deja was
> acting wacky (as noted in the group archive discussion) and b) the
> thread started with the poster asking how to build random lists, rather
> than randomly access an existing list. Saw it and moved on, oops.
It was under the subject line "Faster Access Time to Random Element".
Don't bother reading my responses on the thread, but some of the other
posters had some interesting things to say. Larry's pointer to perlfaq5
is probably the best place to start anyway.
--
Jeff
------------------------------
Date: Mon, 29 May 2000 12:12:04 +1000
From: "Amri, Kuross [WOLL:4009-I:EXCH]" <kamri@asiapacificm01.nt.com>
Subject: Pattern Match this!
Message-Id: <8gsjlm$qv8$1@bcrkh13.ca.nortel.com>
G'day,
I have a string in a data file that isn't being picked up through pattern
matching. The strings look something like this
AV90300 && 34
or AT70546B&&145
There are between 7 or 8 letters that identify the string, then a separator
of a double ampersand and then up to 3 numbers. How would you do this. I am
currently doing something like...
/$identifier&&(\d{3})\n/
any thoughts?
------------------------------
Date: Sun, 28 May 2000 22:07:30 -0500
From: sturman <sturman@netdoor.com>
Subject: Re: Pattern Match this!
Message-Id: <3931DEF2.6898FDEB@netdoor.com>
"Amri, Kuross [WOLL:4009-I:EXCH]" wrote:
<snip>
> There are between 7 or 8 letters that identify the string, then a separator
> of a double ampersand and then up to 3 numbers. How would you do this. I am
> currently doing something like...
>
> /$identifier&&(\d{3})\n/
>
> any thoughts?
yep
you say "up to 3 numbers" but you make it match 3 and only 3 with
\d{3}
Try \d{0,3} or \d* for 0 or more or \d+ if you know there will be at
least 1 number. Also, putting a \n at the end isn't really needed if
you are trying to match specifically numbers as \n isn't a number and
won't match with \d. This pattern doesn't look like you planned to have
spaces round the && either. You'll need something extra for that but I
think you can figure it out.
st
------------------------------
Date: Mon, 29 May 2000 03:26:03 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Pattern Match this!
Message-Id: <slrn8j3ous.4jj.tjla@thislove.dyndns.org>
I was shocked! How could Amri, Kuross [WOLL:4009-I:EXCH] <kamri@asiapacificm01.nt.com>
say such a terrible thing:
>G'day,
>
>I have a string in a data file that isn't being picked up through pattern
>matching. The strings look something like this
>
>AV90300 && 34
>or AT70546B&&145
>
>There are between 7 or 8 letters that identify the string, then a separator
>of a double ampersand and then up to 3 numbers. How would you do this. I am
>currently doing something like...
>
> /$identifier&&(\d{3})\n/
>
>any thoughts?
Well it looks like you have some space (possibly) between the identifier
and the ampersands and the numbers. Also \d{3} will match exactly 3
digits (not up to three). so:
/$identifier\s+(\d{0,3})\n/
That is assuming your strings end with a newline. You might be better
off with:
/$identifier\s+(\d{0,3})\z/
or:
/$identifier\s+(\d{0,3})$/
depending on whether or not you want the newline matched (the first
does, the second doesn't).
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Man is the best computer we can put aboard a spacecraft ... and the
only one that can be mass produced with unskilled labor.
-- Wernher von Braun
------------------------------
Date: Sun, 28 May 2000 15:34:29 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Perl date formatting
Message-Id: <MPG.139b3ece365c805e98aaf9@nntp.hpl.hp.com>
In article <8gnon5$ec3$1@nnrp1.deja.com>, stone@enetis.net says...
...
> I'm just a newbie been programming for about 4 months.
> Formating the date string is actualy one of the first programs I ever
> wrote. It's a whollup of a date formating program! I made it as
> complex as you would ever need it to be with several "built-in"
> formated date strings. Feel free to use this as your own....
I wouldn't recommend that. Your code is a reasonable beginner's
exercise, but except for this frill:
> ## Append "st", "nd", "rd" or "th" to the numerical day.
it provides nothing that isn't available more cleanly, compactly, and
flexibly from the function POSIX::strftime .
As for the ordinal suffixing, I'm sure there is a module for that (in the
Lingua set?), but I won't bother to look now.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 28 May 2000 17:43:26 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl date formatting
Message-Id: <3931BD2E.2522AC9F@stomp.stomp.tokyo>
Larry Rosler wrote:
> stone@enetis.net says...
> > I'm just a newbie been programming for about 4 months.
> > Formating the date string is actualy one of the first
> > programs I ever wrote. It's a whollup of a date
> > formating program! I made it as complex as you would
> > ever need it to be with several "built-in" formated
> > date strings. Feel free to use this as your own....
> I wouldn't recommend that. Your code is a reasonable beginner's
> exercise, but except for this frill:
> > ## Append "st", "nd", "rd" or "th" to the numerical day.
> it provides nothing that isn't available more cleanly,
> compactly, and flexibly from the function POSIX::strftime .
> As for the ordinal suffixing, I'm sure there is a module
> for that (in the Lingua set?), but I won't bother to look now.
This code of Mr. Stone's produces the same results
and even more than posix. His code is roughly two
to two point two kilobytes and appears to be free
of bugs inherent to posix.
What would be the relative percentage bloat
factor of using buggy posix over Mr. Stone's
sleek and slim code?
Godzilla!
------------------------------
Date: Mon, 29 May 2000 03:24:06 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Perl date formatting
Message-Id: <slrn8j3omq.r39.sjs@john.sympatico.ca>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Larry Rosler wrote:
>> [The OP's code] provides nothing that isn't available more cleanly,
>> compactly, and flexibly from the function POSIX::strftime .
[...]
>What would be the relative percentage bloat
>factor of using buggy posix over Mr. Stone's
>sleek and slim code?
"Buggy" POSIX? As in buggy POSIX::strftime? If you know of any bugs
I'd like to hear them. Being a user of the module, I'd be sure to
email the maintainer with a patch if I knew of such bugs.
Could you please post them/email them so that we can fix them, or
is this just more trolling?
Steve
------------------------------
Date: Mon, 29 May 2000 02:08:47 GMT
From: osiris@mindless.com
Subject: Perl IDE for Win32?
Message-Id: <8gsjf7$iab$1@nnrp1.deja.com>
Hi All,
I know this must have hashed over more times than *replace with
something well hashed over* but has anyone got any recommendations for
a solid Perl IDE under Win32? Preferably it would have syntax coloring
and integrated FTP support (with symlink support). TIA.
Matt.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 02:16:44 GMT
From: bing-du@tamu.edu
Subject: PGP in Perl?
Message-Id: <8gsju3$if4$1@nnrp1.deja.com>
Greetings...
I'm wondering how to do encryption using PGP in Perl? Any functions,
modules, libraries or...? It would be great if there is online
documents on this.
Any help would be greatly appreciated.
Bing
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 28 May 2000 23:48:36 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: RegEx
Message-Id: <3931AF56.10641A06@rochester.rr.com>
newbie@db-networks.com wrote:
...
> What am I missing?
You're missing lots. I recommend you run your program with the -d
switch, as in:
perl -d programname.pl
Then single-step through it with the "s" command, and look at variables
with the "x $variablename" (or "x @arrayname" or "x %hashname") command
after each statement as you step through. Many reasons why you are
getting the output you get instead of what you think you should get will
become apparent in the first few minutes of that process.
--
Bob Walton
------------------------------
Date: Sun, 28 May 2000 15:15:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <MPG.139b3a70edc4523098aaf8@nntp.hpl.hp.com>
In article <rhovisonr75lbfoanqgdgt2c9pa5agok20@4ax.com>, dave@dave.org.uk
says...
...
> Maybe I wasn't clear in my last message. I'll try to be clearer...
>
> Perl comes with it's own built-in method for comparing the performance
> of different pieces of code. It's called Benchmark.pm and all Perl
> programmers should be proficient in its use.
>
> Larry Rosler poseted some code using Benchmark.pm to compare your
> sprintf idea with my unpack idea. He claims that it shows that unpack
> is substantially faster than your code.
>
> Rather than just complaining that his test was bogus, what I am asking
> is for you to post Benchmark code which demonstrates that it's
> possible to get a different answer if you don't make the changes to
> your code that Larry did.
>
> Is that clearer?
That won't help at all. Godzilla!'s idea of measuring performance is to
observe subjectively the wall-clock time required to execute a program
comprising nothing but a single instance of the code being measured. It
has no concept of the difficulty of measuring that time, in the face of
of the load-and-compile overhead of perl (or any other program, for that
matter). It also has no concept that that measurement doesn't relate to
the reality of useful data-processing programs, where algorithms are
applied repeatedly in loops. So the Benchmark module, which enables
realistic measurement under such circumstances, doesn't interest it.
But, Deo volente, others will have learned from all these exchanges.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 28 May 2000 15:57:02 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <3931A43E.9952ECB2@la.znet.com>
Larry Rosler wrote:
> ... It has no concept
> ... It also has no concept
> ... doesn't interest it.
I am not an "it" as you suggest.
Remarkably, I am a person.
Tell me, why would a man of your
age and social status fall upon
such childish trolling? This
leaves you with zero credibility
and brands you an outright troll.
Godzilla!
------------------------------
Date: Mon, 29 May 2000 03:24:30 GMT
From: siddsoni@hotmail.com
Subject: spawning a win app from perl ....
Message-Id: <8gsnt4$l4c$1@nnrp1.deja.com>
The following didn't work:
fileparse_set_fstype('MSWin32');
my $dir = dirname($0);
my $app = Win32::OLE->new('InternetExplorer.Application') or die "Oops,
Cannot start IE";
$app->Navigate($dir . $results);
$app->Show;
Any ideas?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 28 May 2000 20:42:03 -0400
From: "Ryan & Treena Carrier" <ryanc@nci1.net>
Subject: Waxing Philosophical
Message-Id: <3931bcc1_2@news.cybertours.com>
Being a beginning programmer, please entertain my ignorance:
What is the difference between
while(<INFILE>) {
}
and
until(!<INFILE>) {
}
and
unless(!<INFILE>) {
}
Are they all the same?
------------------------------
Date: Mon, 29 May 2000 02:39:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Waxing Philosophical
Message-Id: <sj3m2lm65pj110@corp.supernews.com>
Ryan & Treena Carrier (ryanc@nci1.net) wrote:
: Being a beginning programmer, please entertain my ignorance:
Nope, I'll chase it out and replace it with knowledge. :)
: What is the difference between
:
: while(<INFILE>) {
: }
:
: and
:
: until(!<INFILE>) {
: }
:
: and
:
: unless(!<INFILE>) {
: }
:
: Are they all the same?
Not at all. The first two are loops, and the last one a simple
conditional block; that is, it would only get executed at most on the
first line of the input file.
Between the first two, there is a more subtle difference. In the
pathological case of the final line of the file ending in a '0' with no
newline, the symple boolean sense of a while() or until() test will go
awry, ending the loop with data yet to be processed (that final hanging
'0'. while() has magic that makes the test really be 'defined <>' when
the argument is a single diamond operator; until() with a negated
condition lacks this magic. Admittedly, it's a very minor and usually
irrelevant difference.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "The road of Excess leads to the Palace
of Wisdom" - William Blake
------------------------------
Date: Sun, 28 May 2000 22:26:49 GMT
From: olczyk@interaccess.com (Thaddeus L. Olczyk)
Subject: Re: Weird script behaviour called from a web page.
Message-Id: <39319b24.233927562@nntp.interaccess.com>
On Sun, 28 May 2000 16:31:06 +0100, Dave Cross <dave@dave.org.uk>
wrote:
>This is a Linux question rather than a Perl one and would be more
>appropriate in a Linux or Unix newsgroup, but here goes anyway!
>
>An error like that doesn't always mean that the shell can't find the
>script file. You'll also get that message if the shell can't find the
>interpreter given by the #! line at the top of the script.
>
>You should check the first lines of both of these scripts and ensure
>that they both point to a Perl interpreter.
>
>This theroy is backed up by the evidence that script2 works when
>invoked as 'perl script2.pl' but not as simply 'script2.pl' as in the
>first case the shell doesn't need the #! line to find the sripts
>interpreter.
>
>Hope you don't think that I answered without thinking.
Yeah you did.
I told you I cut and paste the first line from script1 to script2.
Since script1 works fine, I would presume that the line works.
As for whether this a a Perl problem or a UNIX problem.
Maybe it is maybe it isn't. Maybe it's apache.
Once I solve the problem I will know. The fact that another similar
script does run, would tend to indicate that it is not the general
UNIX or Apache enviroment.
------------------------------
Date: Mon, 29 May 2000 03:32:13 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Weird script behaviour called from a web page.
Message-Id: <slrn8j3p61.r39.sjs@john.sympatico.ca>
Thaddeus L. Olczyk <olczyk@interaccess.com> wrote:
>On Sun, 28 May 2000 16:31:06 +0100, Dave Cross <dave@dave.org.uk>
>wrote:
>>Hope you don't think that I answered without thinking.
> Yeah you did.
Maybe you'd get informed answers if you posted more details, or
were less of a prick.
If you post the smallest relevant piece of code that you can have
in script2 while still getting your error, then people can
help you rule out perl as the problem, rather than the
environment. (For ex., does the script run if the second line
is exit;? If not, then your problem isn't perl.)
Steve
------------------------------
Date: Sun, 28 May 2000 15:05:59 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Windows/Linux Incompatibility
Message-Id: <MPG.139b3816f921dce498aaf7@nntp.hpl.hp.com>
In article <slrn8ivo4a.1oc.tadmc@magna.metronet.com>, tadmc@metronet.com
says...
> On Mon, 22 May 2000 03:27:04 GMT, Blair Heuer <ab@cd.com> wrote:
...
> > if ($threadnewcolor == "") { $threadnewcolor = 0; }
>
> == does numeric tests
>
> eq does string tests
>
>
> So you should use one of:
>
> if ($threadnewcolor eq "")
>
> if ($threadnewcolor == 0)
>
> depending on which it is that you really want there.
This locution appears several times in the original post. He should use
the standard or-default assignment, which is compact and expressive:
$threadnewcolor ||= 0;
with diffefernt default values for some of the other variables.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3192
**************************************