[11892] in Perl-Users-Digest
Perl-Users Digest, Issue: 5492 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 26 22:17:04 1999
Date: Mon, 26 Apr 99 19:00:17 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 26 Apr 1999 Volume: 8 Number: 5492
Today's topics:
Re: "learning perl" does not seem to be written well <propart@mediaone.net>
Re: "learning perl" does not seem to be written well (Tad McClellan)
Re: autoincrement magic a..z (Tad McClellan)
Re: autoincrement magic a..z <uri@sysarch.com>
Re: Counting files in a dir. <cassell@mail.cor.epa.gov>
Re: Country of a visitor <crn@itga.com.au>
Re: Eliminate elements from array with second array? (Andrew Allen)
Re: Extracting emails from array <upsetter@ziplink.net>
Re: FAQ 7.19: Why doesn't "my($foo) = E<lt>FILEE<gt>;" (John Stanley)
Re: Insert "\n" (Tad McClellan)
Re: Multiline comments in perl <cassell@mail.cor.epa.gov>
Re: Multiline comments in perl (Tad McClellan)
Re: Perl newbie, please don't send me to ascii purgator <cassell@mail.cor.epa.gov>
Re: Perl newbie, please don't send me to ascii purgator kyle_programmer@my-dejanews.com
Re: Perl sources compiled using mingw32 <metcher@spider.herston.uq.edu.au>
Perl virus scanner? (Karl J. Runge)
problem with single quotes or abuse by programmer fire@dataflo.net
Re: problem with single quotes or abuse by programmer <aperrin@mcmahon.qal.berkeley.edu>
Re: problem with single quotes or abuse by programmer (Larry Rosler)
Re: where do I look for a free lance script writers? kyle_programmer@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Apr 1999 20:12:29 -0400
From: PropART <propart@mediaone.net>
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <372500ED.5CA1AADE@mediaone.net>
>
At the risk of increasing an already humongous thread, here's the opinion of
somebody who recently read the Llama book for the first time. Understand 90%
of the book and do the exercises (which are definitely beginner level) and
you'll be able to write useful Perl programs for the rest of your programming
life. That's worth the $25, or whatever....
What's probably throwing you is Unix, the command line environment, STDIN
etc... Embarassing to admit, I had a similiar reaction to yours when I tried
to start with the Camel book. I started reading the first chapter and thought
that LW was trying to be too clever rather than clear. I remember ranting in
a very similar vein to your first post...
But, after reading Randal's book (which is where I should have started in the
first place) and then going back to the Camel, everything seemed very clear
and elegant. Yes, the overview chapter in the Llama might seem overwhelming
if you try to retain it all, but it's just supposed to show you what Perl can
do.
Don't have too many expectations of how long a chapter *should* take. I spent
a lot of time on that overview chapter writing my own little programs, even
though I didn't really know what I was doing. Not to worry, the later
chapters scalars, arrays, hashes etc... are very clear and straight ahead.
You might spend a lot of time on regular expressions, too, but it'll be worth
it. You'll soon be able to write useful programs, and learning a bit about
Unix is one of the most valuable side effects of learning Perl.
-William C.
------------------------------
Date: Mon, 26 Apr 1999 15:42:14 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <mif2g7.p94.ln@magna.metronet.com>
Jonathan Stowe (gellyfish@gellyfish.com) wrote:
: On Mon, 26 Apr 1999 12:20:39 -0400 Tad McClellan wrote:
: > ralawrence@my-dejanews.com wrote:
: > : In article <0lk1g7.t73.ln@magna.metronet.com>,
: > : tadmc@metronet.com (Tad McClellan) wrote:
: > : > ralawrence@my-dejanews.com wrote:
: > : >
: > : > : Here is how I see it (and I *am* a newbie so bear with me).
: > : >
: > : > But you don't have it quite right.
: >
: > : Thanks to all of you that pointed out how hopelessly wrong I was.
: >
: > : I've now made a total tit out of myself infront of 16 million odd people.
: >
: >
: > It may be painful, but public humiliation pretty much ensures
: > that you don't forget the "lesson".
: Another recruit for the Perl Spartacist Party ....
Say, are there any certification programs for that?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 26 Apr 1999 15:45:14 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: autoincrement magic a..z
Message-Id: <aof2g7.p94.ln@magna.metronet.com>
Yeoh Yiu (squid@panix.com) wrote:
: Uri Guttman <uri@sysarch.com> writes:
: > YY> for ($i="a"; $i le "z"; $i++) {print "$i";}
: >
: > YY> doesn't print ouit a to z.
: >
: > because when $i eq z, it passes the test, prints and then increments to
: > 'aa'. and that fails the le test since 'aa' IS le 'z'. perl does a
: > lexigraphical compare and length doesn't come into the picture.
: >
: > as you have seen it works fine with $i ne 'aa'.
: >
: > you could also check the length with
: >
: > length( $i ) == 1 && $i le 'z'
: Thank you.
: Why does autoincrement magic applied to "z" return a value
: which is lexigraphically less that "z" ? Does (autoincrement
: magic applied to characters) not live in legigraphical space ?
Apparently not.
I think it lives in the "base 26 number system" space.
Incrementing 'z' generates a carry.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Apr 1999 21:20:15 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: autoincrement magic a..z
Message-Id: <x7btgaamgg.fsf@home.sysarch.com>
>>>>> "TM" == Tad McClellan <tadmc@metronet.com> writes:
TM> Yeoh Yiu (squid@panix.com) wrote:
TM> : Why does autoincrement magic applied to "z" return a value
TM> : which is lexigraphically less that "z" ? Does (autoincrement
TM> : magic applied to characters) not live in legigraphical space ?
TM> Apparently not.
TM> I think it lives in the "base 26 number system" space.
not exactly, for then 'aa' would be gt 'z'. if it were a number system
then the strings would be compared left to right with longer strings
always gt shorter ones. there is no 'signifigant char concept with
powers of the base being used in the compare. it is a pure left to right
lexical compare.
TM> Incrementing 'z' generates a carry.
but in lexical space.
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: Mon, 26 Apr 1999 17:12:03 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Counting files in a dir.
Message-Id: <372500D2.6DEBD1BC@mail.cor.epa.gov>
stevenabell wrote:
>
> Dear All,
>
> If the answers to some of my questions are in the FAQs then I'm
> afraid that you'll have to forgive me. I did look through them a
> week or so ago, but since then I don't seem to have been able to get
> back in, and a few rather urgent problems have come up since.
> So, any help on any of the following would be *terrific* :)
I take it this means you're reading them off www.perl.com instead
of your own hard disk. That's the slow and painful way. If your
sysadmin did a decent job, you should be able to read the Perl
manpages using `man'. And if you have a reasonably up-to-date
Perl, you should be able to use `perldoc' too. Type
perldoc perldoc
And you *should* get a help page for perldoc. Otherwise,
complain that you're being held back in your work because the
version of Perl hasn't been kept up-to-date.
> 1. Is it possible in Perl to count the number of files in a directory
> and assign that to a variable? Because the files are situated in a
> UNIX directory, I did think of doing something like:
In the docs on your hard disk, you'll find a lot of material on
opendir() and readdir(). Look at the exmaples there.
> `ls testdir/*.* > list`
> and then count the number of lines in "list", but surely there's
> another way? (I don't even know the correct syntax for the above to
> work)
And this doesn't get the right answer anyway. Don't you want to
count files that start with `.'? Do you want to count symlinks?
directories? Look at the filetest functions in the perlfunc manpage.
[look for -X No, really!]
> 2. I have a number of files which I must perform a UNIX function on.
> Well, in fact it's a Shell application, called "stoplist". What I need
> to do is apply "stoplist" to each document and then place the treated
> documents in another directory. The original number of files to be
> treated will always vary, but will always be grouped together in the
> same directory. So for example, if we have the following files:
> [example snipped]
You might want to look at the File::Find module, and check out
its example code. Write it up, and if you get stuck you can show us
your code and ask for some more advice.
> 3. [another snip]
> what I need to do is rename each file according to the length of its
> path, so that they are renamed as follows:
Your paths #1 and #3 are the same length. How do you get differences
there? I don't follow this at all.
> 4. I have a Perl script [another snip]
> . Simplified, the script looks something like:
>
> if {$var eq "red"}
> &return;
> exit;
> else {$var eq "blue"}
> exit;
>
> sub return
> {
> print "<HTML>......"
> }
I don't think so. This won't even compile. What does your
*real* code look like? You might want to look at the perlsyn page
and see what if statements look like in Perl. And the section on
`switch' in Perl. And don't you think it's a bad idea to name your
subroutine `return' when it just prints?
> Even though I have the "exit"s in the script, when it generates the
> results it still doesn't bomb out.
I think it does `bomb out', in at least one sense of the word.
But Perl won't even run what you have so far.
> Like I said, if the answers to any of these are in the FAQs, then
> please accept my apologies. Any replies / solutions would make it a
> [one more snip]
Please, if you don't know Perl, either code this in a language you
do know, or else get some expert consulting help. You won't be
able to get all your coding done here. In fact, most people in this
newsgroup expect posters to have `done their homework first', so to
speak.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: 27 Apr 1999 11:34:44 +1000
From: Clive Newall <crn@itga.com.au>
Subject: Re: Country of a visitor
Message-Id: <v57lqydex7.fsf@lightning.itga.com.au>
Pierre-Luc <selectthree@gsig-net.qc.ca> writes:
> OK. I wasn't enough clear, I guest.
>
> I want to program a counter for my site and for the others that will
> want it and I want to be able to track the country of origin of a
> visitor (like Nedstat counter (http://usa.nedstat.net), for example,
> does).
So you don't really want to track "country of origin" but
"Top level of domain name as supplied by user".
Clarity of specification is needed if data is to have any quality.
>
> Does somebody know the code to
> first, detect the server's adress (like when I post on MSNBC, it is
> written that I come from modem37.gsig-net.qc.ca, as example)
>
> and then, to isolate the extension (note that I'm able to do it, so I
> mostly want help for #1.)
>
> Thank you very much,
>
> Pierre-Luc Soucy
>
> Note : for those who think it's useless to have the country of a
> visitor, I think that it is usefull to see if your site interests people
> away from your own country, and in wich proportion.
>
> Tony Curtis wrote:
>
> > Re: Country of a visitor, selectthree
> > <selectthree@gsig-net.qc.ca> said:
> >
> > selectthree> Does anyone know the code to determine
> > selectthree> the origin country of a visitor (or
> > selectthree> only it's code, like .com, .ca, .uk,
> > selectthree> .fr...)?
> >
> > selectthree> Please help me.
> >
> > Try asking for their passport.
> >
> > Your question is far too vague and doesn't have
> > anything to do with perl does it?
> >
> > tony
>
--
Clive Newall <crn@itga.com.au> / ITG Australia Ltd, Melbourne Australia
"I think Casper is the ghost of Richie Rich. I wonder how Richie died?"
"Perhaps he realized how hollow the pursuit of money is and took his own life"
--Bart and Lisa Simpson
------------------------------
Date: 27 Apr 1999 00:11:58 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Eliminate elements from array with second array?
Message-Id: <7g2vce$dte$1@fcnews.fc.hp.com>
Andrew Allen (ada@fc.hp.com) wrote:
: @found=grep(!/(cgi-bin|messages|oldstuff|ppd|test|archives)/,@found);
whoops-- change that to !{/(...)/}
On the other hand, I'd like to chastise Tad and Larry for pointing her
to a rather inapplicable FAQ-- a quick perusal of her code shows that
she wanted to do regexp checking to a list, not set
difference. Perhaps before being so curt about FAQ's on the newsgroup,
you could make sure they actually _are_ FAQ's. Perhaps her initial
question wasn't phrased 100% accurately (but she did post her source,
and it's a difficult problem to accurately capture in a couple of
sentences), but your answers were _way_ off.
Andrew
------------------------------
Date: Tue, 27 Apr 1999 01:17:01 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Extracting emails from array
Message-Id: <he8V2.528$7j4.233082@news.shore.net>
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
:>>>>> "Scratchie" == Scratchie <upsetter@ziplink.net> writes:
: Scratchie> Although in real life, of course, excluding email addresses like the two
: Scratchie> above is unlikely to exclude that many users.
: Do you dare exclude the CTO of a company that hasn't got a "nice clean
: c-symbol@foo.bar.com" email address wanting to buy a bunch of your
: stuff, but his email address is "pager:fred"@bob.big.com? Why do
: people always go back to the "but it wouldn't exclude THAT MANY
: people" argument?
Because in many real life situations, you have to strike a balance between
excluding some valid email addresses and keeping joeblow@aol.com from
entering his email address as "Joe Blow@aol.com" causing joe@localhost and
blow@aol.com to get spurious emails. I can't guarantee that the
Email::Valid module (or whatever it's called) is going to be available on
every client's host, but I can guarantee that all of them who share
virtual hosts with other ISP customers want to have their email addresses
pre-screened to keep their sysadmins from getting mad at them.
And, furthermore, it really wouldn't exclude that many people. That's just
the state of the internet (or the WWW anyway) in 1999. I've processed tens
of thousands of email addresses (people who signed up on clients'
websites; not spam) using regexes that don't match every single possible
valid email address (and sometimes even using -- shudder -- vbscript!) and
I've never seen a single example of the sort of contrived counter-examples
you trot out every time this issue comes up. It seems that most people who
really want to buy something have at least one email address they can
supply that is matched by a fairly simple regex.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 27 Apr 1999 00:44:39 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: FAQ 7.19: Why doesn't "my($foo) = E<lt>FILEE<gt>;" work right?
Message-Id: <7g319n$2iu$1@news.NERO.NET>
In article <3724F23F.EFEDE2AA@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
>> Since the Subject is the question being answered, please repost this
>> article with the correct subject.
>
>I believe that *is* the correct subject line. The entities just
>haven't been translated.
This is USENET. There are no "entities", just text. There was no MIME
Content-Type to specify that it was anything but text. The text is
wrong. The reason that it doesn't "work right" is that it is a syntax
error.
All I'm asking is, politely, that it be corrected and reposted. Yes,
can edit it in the copy I have, but what happens the next time it is
posted? And when the author fixes his copy and reposts it, then
everyone has a correct copy.
------------------------------
Date: Mon, 26 Apr 1999 15:39:52 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Insert "\n"
Message-Id: <8ef2g7.p94.ln@magna.metronet.com>
Andy Lee (andylee@prodigy.net) wrote:
: How can
: I insert the "\n" on the 60th character?
s/(.{1,60})/$1\n/g;
But,
use Text::Wrap;
(or similar module) would avoid wheel reinvention.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 26 Apr 1999 17:18:57 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Multiline comments in perl
Message-Id: <37250271.90035775@mail.cor.epa.gov>
Jerome O'Neil wrote:
>
> Eric Smith wrote:
> >
> > /* possible? */
>
> It's in the FAQ. It will tell you to use POD markup to accomplish the
> same thing. I find it a very unsatisfactory solution.
>
> Ye Gods! Why has thou forsaken C-style comments?!!!
It's fine by me. But then when I write C code, I do it in an
analogous way to my Perl code...
############################################################
# I put stuff in boxes anyway, so readers can see it. #
############################################################
:-)
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Mon, 26 Apr 1999 14:30:31 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Multiline comments in perl
Message-Id: <7cb2g7.k64.ln@magna.metronet.com>
Eric Smith (eric@fruitcom.com) wrote:
: /* possible? */
=pod
Kinda.
=cut
perldoc perlpod
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 26 Apr 1999 17:33:27 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl newbie, please don't send me to ascii purgatory
Message-Id: <372505D7.E9305933@mail.cor.epa.gov>
James Lovette wrote:
>
> i just started programming in Perl (specifically for CGI on a SunOS 5.6
> UNIX system) and am still trying to figure my way through it. I looked
> through the newsgroup for information first, but unfortunately only saw
> allusions to the FAQ without a posted URL.
You should be in luck. Every decent install of Perl comes with a copy
of the FAQ. If you have a modern Perl, you can use the perldoc
program to read stuff. Try these commands:
perldoc perldoc
perldoc perl
Did you get lots of useful stuff?
If not, try this:
perl -v
If it's not at least 5.004, complain to the sysadmin that the version
of Perl is not up-to-date and may contain bugs or security holes fixed
by later versions. And look worried when you do it. :-)
> My question this time is simple:
> I am writing a script that searches through a database of alumni from
> my high school. The search engine can be found at
> http://www.sinc.sunysb.edu/stu/jlovette/cgi-bin/rckbook.htm, and the
> source code can be found at
> http://www.sinc.sunysb.edu/stu/jlovette/cgi-bin/rck03.pl, although my
> server (at SUNY Stony Brook on Long Island, NY) uses cgiwrap to run
> scripts.
> I am getting tired of having to continually download, manually adjust,
> then re-upload corrections to the main data file anytime somebody enters
> data incorrectly. Is there a way I can replace only one line in the
> database. I don't want to append, I just want to change that one part.
Start with the FAQ covering how to change one line in a file...
It's in perlfaq5. Then you might want to start thinking in terms of
database management, which might simplify your task enormously.
Look at the DBD::* modules available at CPAN. Start at
www.perl.com/CPAN/ and you should get tossed into the multiplexer
so you get sent to a `close' archive site. There's even a DBD::*
module for working with text files.
> Thank you for your time. I also want to say I think it is great that the
> others of the Camel book follow and respond to this newsgroup, that is
> such an invaluable reward. I own _Programming Perl_ and _Advanced Perl
> Programming_ but unfortunately didn't have enough room to bring them
> (they don't give college students a lot of room in dorms these days).
Hey! Just throw out those heavy old textbooks, so you have enough room
for your O'Reilly library. After all, what's really important? And
you wren't going to read those texts until the night before the test
anyway... :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Tue, 27 Apr 1999 00:50:53 GMT
From: kyle_programmer@my-dejanews.com
Subject: Re: Perl newbie, please don't send me to ascii purgatory
Message-Id: <7g31lc$gvg$1@nnrp1.dejanews.com>
In article <3724F7CE.4FC5@ic.sunysb.edu>,
jlovette@ic.sunysb.edu wrote:
> i just started programming in Perl (specifically for CGI on a SunOS 5.6
> UNIX system) and am still trying to figure my way through it. I looked
> through the newsgroup for information first, but unfortunately only saw
> allusions to the FAQ without a posted URL.
>
> My question this time is simple:
> I am writing a script that searches through a database of alumni from
> my high school. The search engine can be found at
> http://www.sinc.sunysb.edu/stu/jlovette/cgi-bin/rckbook.htm, and the
> source code can be found at
> http://www.sinc.sunysb.edu/stu/jlovette/cgi-bin/rck03.pl, although my
> server (at SUNY Stony Brook on Long Island, NY) uses cgiwrap to run
> scripts.
> I am getting tired of having to continually download, manually adjust,
> then re-upload corrections to the main data file anytime somebody enters
> data incorrectly. Is there a way I can replace only one line in the
> database. I don't want to append, I just want to change that one part.
>
> Thank you for your time. I also want to say I think it is great that the
> others of the Camel book follow and respond to this newsgroup, that is
> such an invaluable reward. I own _Programming Perl_ and _Advanced Perl
> Programming_ but unfortunately didn't have enough room to bring them
> (they don't give college students a lot of room in dorms these days).
>
> Thanks - James L
>
Perl Tips:
1) If you have'nt already buy "programming perl" by Larry Wall, Tom
Christansen and Randal L. Schwartz.
2) use strict; is good programming practice as it generates compile time
errors if you have'nt pre-declared variables. eg.
use strict;
# correct pre-declaration of a variable :
my $variable = "hello world";
print $variable;
#wrong this will generate compile time error
$otherVariable = "goodbye world";
3) use CGI; check the docs at
http://www.activestate.com/ActivePerl/docs/lib\CGI.html
it will make your life a hell of lot simpler.
4) use some data verification statements in your code if the user entered in
incorrect data give them a error page telling what they did wrong.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 27 Apr 1999 10:29:12 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Perl sources compiled using mingw32
Message-Id: <372504D8.75C9480C@spider.herston.uq.edu.au>
Works for me - NT 4, perl 5.005_02, egcs 1.1, mingw32. More details?
--
Jaime Metcher
dalekh@hotmail.com wrote:
>
> Oh, my problem is when it tries to compile /ext/Sockets.
> The error is /lib/CORE/config.h
> CORE should be the gcc-lib/egcs... directory. I think it is
> supposed to COREDIR so there might be a bug.
> Anty help appreciated.
------------------------------
Date: Tue, 27 Apr 1999 01:24:44 GMT
From: runge@crl.com (Karl J. Runge)
Subject: Perl virus scanner?
Message-Id: <wl8V2.22839$tY1.14205@wbnws01.ne.mediaone.net>
Keywords: perl virus
Hi, this is an odd request. Is there a perl script (or even sh/grep script)
that utilizes some PC virus string database and checks MSDOS/Windows files
for occurrences of those strings?
Basically I want a perl script I could run from Unix/Linux and check a
Windows partition (or even run inside Windows if need be). I've written a
trivial one that checks for a handful of virus strings, but wondered if
someone had written something to parse a virus string database. Today's
CIH virus reminded me about wanting such a tool.
Best regards,
Karl
--
----------------------------------------------------------------------------
Karl J. Runge -- Linux: it's the Real thing -- runge@crl.com
-- http://www.crl.com/~runge
------------------------------
Date: Mon, 26 Apr 1999 19:55:17 -0500
From: fire@dataflo.net
Subject: problem with single quotes or abuse by programmer
Message-Id: <37250AF5.5DA010B6@dataflo.net>
We are using perl version 5.00502 on an NT box
This version of code fails......???
BEGIN {
push(@INC, 'C:\inetpub\wwwroot\mck-shared\');
push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi\');
}
This version of code works....
BEGIN {
push(@INC, 'C:\inetpub\wwwroot\mck-shared');
push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi');
}
Aren't single quotes supposed to be SACRED?
The error messages make it very clear to me that the \ before the '
causes it to not be interpreted as a single quote paired with previous one.
Is this because it is in pre compile stage?
I just tested this theory on a unix box and it fails there too...
Bradley Slavik
fire@dataflo.net
------------------------------
Date: Mon, 26 Apr 1999 18:13:38 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: problem with single quotes or abuse by programmer
Message-Id: <37250F41.D01DC1BA@mcmahon.qal.berkeley.edu>
As documented.... backslashes in single quotes escape other backslashes and
single quotes, nothing else.
ap
fire@dataflo.net wrote:
> We are using perl version 5.00502 on an NT box
>
> This version of code fails......???
> BEGIN {
> push(@INC, 'C:\inetpub\wwwroot\mck-shared\');
> push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi\');
> }
>
> This version of code works....
>
> BEGIN {
> push(@INC, 'C:\inetpub\wwwroot\mck-shared');
> push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi');
> }
>
> Aren't single quotes supposed to be SACRED?
>
> The error messages make it very clear to me that the \ before the '
> causes it to not be interpreted as a single quote paired with previous one.
> Is this because it is in pre compile stage?
>
> I just tested this theory on a unix box and it fails there too...
>
> Bradley Slavik
> fire@dataflo.net
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Mon, 26 Apr 1999 18:30:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problem with single quotes or abuse by programmer
Message-Id: <MPG.118eb309dd380069989949@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37250AF5.5DA010B6@dataflo.net> on Mon, 26 Apr 1999 19:55:17
-0500, fire@dataflo.net <fire@dataflo.net> says...
> This version of code fails......???
> BEGIN {
> push(@INC, 'C:\inetpub\wwwroot\mck-shared\');
> push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi\');
> }
>
> This version of code works....
>
> BEGIN {
> push(@INC, 'C:\inetpub\wwwroot\mck-shared');
> push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi');
> }
>
> Aren't single quotes supposed to be SACRED?
>
> The error messages make it very clear to me that the \ before the '
> causes it to not be interpreted as a single quote paired with previous one.
> Is this because it is in pre compile stage?
No. I don't know what you mean by 'pre compile stage".
It is because \' is how one writes a single-quote inside a single-quoted
string. Read the following from perldata:
"String literals are usually delimited by either single or double
quotes. They work much like shell quotes: double-quoted string literals
are subject to backslash and variable substitution; single-quoted
strings are not (except for \' and \\ )."
So if you want to end your string with a backslash, use two of them.
But why not just use forward slashes in the first place? It seems to be
one of the best-kept of the many secrets of PoBdom that except for the
dain-bread so-called command interpreters, forward slashes work fine.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 27 Apr 1999 00:54:04 GMT
From: kyle_programmer@my-dejanews.com
Subject: Re: where do I look for a free lance script writers?
Message-Id: <7g31ra$h18$1@nnrp1.dejanews.com>
In article <7g2t4b$iof@dfw-ixnews6.ix.netcom.com>,
"Jason" <Jason_nynyNOSPAM@hotmail.com> wrote:
> Hello,
>
> Excuse me if this is not the right place for this post:
>
> Where do I look for free lancer cgi script writers for simple scripts from
> time
> to time. You know stuff I can't find from the ready made scripts off of the
> web. Any help is appreciated.
>
> --
> Jason
>
> --
> Jason
>
>
I am a free lance CGI script writer. I am looking for short term
telecommuniting type of work. I have references and code examples available
upon request. You can contact me at cst98062@camosun.bc.ca. Thank - You. Kyle
Wuolle.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 5492
**************************************