[8958] in Perl-Users-Digest
Perl-Users Digest, Issue: 2576 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 13 00:09:12 1998
Date: Tue, 12 May 98 21:00:36 -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 Tue, 12 May 1998 Volume: 8 Number: 2576
Today's topics:
[Help?] Expression not evaluating.. <tchin@bentery.com>
Re: [Help?] Expression not evaluating.. <metcher@spider.herston.uq.edu.au>
Re: [Help?] Expression not evaluating.. (Ronald J Kimball)
CGI: Page output during process <3.14@Math.MIT.edu>
Re: Does Perl have a IDE?I don't like command line. (Marek Jedlinski)
Re: function prototyping <mgregory@asc.sps.mot.com>
Re: function prototyping (Martien Verbruggen)
Re: glob() function leaves behind a child process? <mgregory@asc.sps.mot.com>
Re: Help! Can't Pipe Runaway Error Messages topmind@technologist.com
How do I have Perl connect to Sybase SQLanywhere 5.0? <phengl@ir-optima.com>
Re: html in perl (Martien Verbruggen)
Re: Nuclear bombing of NEW YORK! Small countries can ta (David M. Cook)
Problems with system command in perl <gangs@mit.edu>
Re: Problems with system command in perl (brian d foy)
Question: Finding which element of a list a string cori nick@hob.com
Re: Randomly sorting an array (Tom Rokicki)
Replacing characters with special meanings? (S. Vertigan)
Re: Replacing characters with special meanings? (brian d foy)
Re: Scanning Perl scripts for Y2K problems (Abigail)
Re: Significant digit? (Ronald J Kimball)
Re: Significant digit? <tchrist@mox.perl.com>
Where are pod translators? <dwarren@starnetinc.com>
XML Module <ion@aroma.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 May 1998 01:54:06 GMT
From: Terence Chin <tchin@bentery.com>
Subject: [Help?] Expression not evaluating..
Message-Id: <6jaufu$299$1@nntp1.ba.best.com>
Hi,
I have a PERL script which is not evaluating. Would someone please
give me a pointer to resolving the problem?
The output I would like to see is:
$a = 5
$b = 10
but i'm getting:
$a = 5
Use of uninitialized value at (eval 2) line 1, <IF> line 2.
$b = 5
Thanks for your help in advance!
Terence
---------------8<----------- "test" file -------8<---------------------
$a = 5;
$b = $a + 5;
---------------8<----------- PERL script ----------8<--------------
#!/usr/local/bin/perl -w
open (IF,"test");
while(<IF>)
{
chomp $_;
($key,$value)=split(/=/);
$keytext=$key;
$keyval = eval($value);
printf "%s = %s\n",$keytext,$keyval;
}
------------------------------
Date: Wed, 13 May 1998 13:41:10 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: [Help?] Expression not evaluating..
Message-Id: <35591656.28F0C4D9@spider.herston.uq.edu.au>
Hi Terence
Terence Chin wrote:
>
> Hi,
>
snip
> ---------------8<----------- "test" file -------8<---------------------
> $a = 5;
> $b = $a + 5;
>
> ---------------8<----------- PERL script ----------8<--------------
> #!/usr/local/bin/perl -w
>
> open (IF,"test");
> while(<IF>)
> {
> chomp $_;
> ($key,$value)=split(/=/);
> $keytext=$key;
^^^^^^^^^^^^^
What's this doing? s/text/val/?
>
> $keyval = eval($value);
The first time around, this line is setting $keyval to 5. At no
time is $a set. Hence the error the second time around. Look up
symbolic references in the documentation, but be aware that many perl
gurus don't like them. If you start to think about the implications for
sanity-checking of hard references, you might decide you don't like them
either.
Have you thought about feeding the whole line to eval? Or requiring the
whole file?
> printf "%s = %s\n",$keytext,$keyval;
> }
>
>
--
Jaime Metcher
------------------------------
Date: Tue, 12 May 1998 23:42:23 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: [Help?] Expression not evaluating..
Message-Id: <1d8xswa.c5iu2kn3rht8N@bay1-73.quincy.ziplink.net>
Terence Chin <tchin@bentery.com> wrote:
> but i'm getting:
> $a = 5
> Use of uninitialized value at (eval 2) line 1, <IF> line 2.
> $b = 5
> ---------------8<----------- "test" file ----------8<--------------
> $a = 5;
> $b = $a + 5;
>
> ---------------8<----------- PERL script ----------8<--------------
> #!/usr/local/bin/perl -w
>
> open (IF,"test");
> while(<IF>)
> {
> chomp $_;
> ($key,$value)=split(/=/);
> $keytext=$key;
>
> $keyval = eval($value);
> printf "%s = %s\n",$keytext,$keyval;
> }
You never actually assign a value to $a. Instead, you just assign it to
$keyval and pretend that that is the value of $a. So when you eval the
assignment for $b, $a is undefined.
Try this instead:
# ...
($var, $exp) = split(/\s*=\s*/);
$val = eval "$var = $exp";
print "$var = $val\n";
# ...
A little error checking might be in order, of course.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 12 May 1998 21:53:42 -0400
From: Boris 'pi' Piwinger <3.14@Math.MIT.edu>
Subject: CGI: Page output during process
Message-Id: <3558fb60.0@news.netway.com>
Hi!
I want to use a Perl script to do some work which results in some part
of the page once in a while. The CGI FAQ says:
>3.8: Can I launch a long process and return a page before it's finished?
>
>
>[UNIX]
>You have to fork/spawn the long-running process.
>The important thing to remember is to close all its file descriptors;
>otherwise nothing will be returned to the browser until it's finished.
>The standard trick to accomplish this is redirection to/from /dev/null:
>
> exec ("long_process < /dev/null > /dev/null 2>&1 &")
> print HTML page as usual
>
>(don't take "exec" as literal in anything but a shell script - in
>C, Perl, etc use fork+exec or system() :-)
I simple do not understand what this means:-( In my case there is no
"long process", there are *many* small ones. If someone can point to
example to look at, this would be helpful. TIA
pi
--=20
Yogi Berra said:
>It's like deja vu all over again!
------------------------------
Date: Wed, 13 May 1998 00:41:04 GMT
From: cicho@polbox.com (Marek Jedlinski)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <3558eb24.38542625@news.nask.org.pl>
Keywords: If you're happy and you know it, clunk your chains.
Uhm, just a minor, minor, minor point...
gbacon@cs.uah.edu (Greg Bacon) wrote:
>In article <6j7u8v$e29@mozo.cc.purdue.edu>,
> gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
>: gbacon@cs.uah.edu (Greg Bacon) writes:
>: }Please give us three good reasons why we should stroke even one key to
>: }help people who refuse to use man, perldoc, or grep? Perl requires at
>: }least that much of a clue.
>:
>: Three good reasons to make the FAQs ridiculously easy to find:
>:
>: 1) To save yourself the inevitable frustration of having to read
>: the same questions again and again from folks who don't "get"
>: perldoc, man, or grep.
>
>By ``get'', I'm assuming you mean software is unavailable. For one
>thing, perldoc comes with every standard Perl distribution.
I'm not sure what you call "standard", and I'll happily allow that the
ActiveState win95 port is not, but it so happens that the ActiveState
distribution does *not* include perldoc. Or any pod2anything tool. Now,
seeing as most of the reviled, recurrent FAQs come from win95 users...
ahem.
>Any
>installation without perldoc is a broken installation.
No contest.
>All ports have
>the capability to generate HTML versions of the docs. It's the
>responsibility of whoever installs perl to make sure that the docs are
>available.
But it's a vicious circle for a newbie, don't you see? You're saying a
newbie who just downloaded his first distribution is responsible for
installing the docs? The newbie, at this point, doesn't even know the
perlish *convention* for docs! (pods et al) Of course, if you're talking
about a sysadmin, then we agree just fine.
A reflection. I don't see myself as a newbie - at least not a newbie to
programming as such, after 6 years of playing with Pascal and a little C
(yes, a litle C *is* a dangerous thing :) I am only a hobbyist, though, I
don't program for money and whatever I do is either for plain fun or to
build a utility I need for some other current task, or just falls in the
"let's see if I can..." category. I don't complain about perl. I *love* to
be learning perl, and the "fun" quotient is much greater than for any other
programming I did before perl. But some tasks, and finding some
information, can be lamentably diffucult even for a fairly clued-in person
who doesn't give in to frustration easily.
(Pet peeve: modules, of course. Hint: telling a win95 user to use
Html::Parser for HTML jobs is potentially worse than no response at all,
unless you add "and before you use it, install perl on Linux". [In my case,
perl refuses to compile entities.pm; plus I find the documentation
somewhat, well, obscure.) Similarly, any module that depends on external C
libraries is useless for the ActiveState port, unless the module was
specifically made/ported for that OS (such as it is). Yes, I do re-invent
the wheels daily; it's either that or no wheels at all *much of the time*.)
>: One lesson I've taken away from Donald Norman (_The Design of Everyday
>: Things_) is that if you've got to keep telling people something over
>: and over again ("Push to Open") you're doing something wrong.
>
>Programming languages aren't and should never be everyday things.
One could say that nuclear power plants aren't, either, yet I bet they
color-code control switches there, too :)
(Okay, so it got to be more than a minor, minor point...)
.marek
--
After things go from bad to worse, the cycle will repeat itself.
http://come.to/fnord/
------------------------------
Date: 13 May 1998 09:04:19 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: function prototyping
Message-Id: <r8btt3kqro.fsf@asc.sps.mot.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> Martin Gregory <mgregory@asc.sps.mot.com> writes:
> :> Until you can immediately tell what length(@a) returns
> :> when @a = (1 .. 1), don't use prototypes.
> :
> :Why?
> :
> :In otherwords, I knew that length(@a) is 1, but I don't feel any more
> :confident about function prototypes...
>
> I mean @a = ( 1 .. 10 );
Ah. I see that length(@a) is 2. I have no idea why. I guess I better
leave function prototypes alone!
Martin.
------------------------------
Date: 13 May 1998 03:24:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: function prototyping
Message-Id: <6jb3pr$72e$1@comdyn.comdyn.com.au>
In article <r8btt3kqro.fsf@asc.sps.mot.com>,
Martin Gregory <mgregory@asc.sps.mot.com> writes:
> Tom Christiansen <tchrist@mox.perl.com> writes:
>> I mean @a = ( 1 .. 10 );
>
> Ah. I see that length(@a) is 2. I have no idea why. I guess I better
> leave function prototypes alone!
Think of the context that the @a is evaluated in, and consult the
perlfunc and perldata documentation.
when @a = (1..100)
length(@a) == 3
when @a = (100..103)
length(@a) == 1
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: 13 May 1998 09:06:06 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: glob() function leaves behind a child process?
Message-Id: <r8af8nkqop.fsf@asc.sps.mot.com>
Tom Christiansen writes:
> glob in scalar context is a very bad idea.
>
> $ man perlop
>
> A glob evaluates its (embedded) argument only when it is starting a
> new list. All values must be read before it will start over. In
> list context this isn't important, because you automatically get them
> all anyway. In scalar context, however, the operator returns the
> next value each time it is called, or a FALSE value if you've just
> run out. Again, FALSE is returned only once. So if you're expecting
> a single value from a glob, it is much better to say
>
> ($file) = <blurch*>;
>
> than
>
> $file = <blurch*>;
>
> because the latter will alternate between returning a filename
> and returning FALSE.
Thanks for this clarification. The Blue Camel (which I used rather
than man perlop) does not talk about this at all! I guess the moral
of the story is 'use the real documentation'!
Come to think of it, shouldn't the new, warn-about-everything version
of perl warn about this scalar usage of glob?
Martin.
------------------------------
Date: Wed, 13 May 1998 00:58:16 GMT
From: topmind@technologist.com
Subject: Re: Help! Can't Pipe Runaway Error Messages
Message-Id: <6jar78$o72$1@nnrp1.dejanews.com>
">" does *not* work. It still goes to the console for some reason. Anybody
else confirm this (in Windows 95)? Do they make Ultraedit for Windows?
Thanks, -Tmind-
In article <6j9q2k$36$0@206.165.146.175>,
"Allan M. Due" <due@murray.fordham.edu> wrote:
>
> Easy answer use: >. At the prompt type perl script.pl > filename.ext
> and your output will be written to the file.
> A less simple but, to my way of thinking, preferable answer: Some
> editors allow you to run commands internally. I use Ultraedit which allows
> you to run Perl from within the editor and then capture the output to either
> a new file or a listbox. I find it much easier to edit my scripts this way
> as I don't have to keep opening and closing files or move back and forth
> between windows. UE also lets you run your default browser from within the
> editor so you can check how your CGI scripts are working all from within the
> same environment. You can even add a run Perl button to your UE task bar so
> you just click the button and check the output. Either the listbox or new
> file option lets you scroll through the output from Perl very easily.
>
> HTH
>
> Allan M. Due
> Due@discovernet.net
> Admin@WhiteCrow.net
>
> The beginning of wisdom is the definitions of terms.
> - Socrates
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 13 May 1998 00:44:59 GMT
From: "Pheng Lay" <phengl@ir-optima.com>
Subject: How do I have Perl connect to Sybase SQLanywhere 5.0?
Message-Id: <01bd7e08$244b6180$1f90d9cf@pheng-lay>
My database is SQLanywhere 5.0 running on NT Server 4.0. I would like to
be able to open/update/close the SQL database from a perlscript. Any help
on how to do this would be really appreciated. Thank You.
phengl@ir-optima.com
------------------------------
Date: 13 May 1998 00:45:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: html in perl
Message-Id: <6jaqfu$6b5$1@comdyn.comdyn.com.au>
[added comp.lang.perl.misc to Newsgroups]
In article <3553ACCE.E1D@alaska.net>,
"Peter M. Lang" <langcons@alaska.net> writes:
> I am new to this perl area-can someone please tell me if this should be
> taken lightly or how should I couch my "newbie" questions to the perl
> community without getting royally slammed?
There are a few things most people here expect from posters:
- Post to the appropriate group, and don't post off topic material to
any of the perl groups.
comp.lang.perl.modules is for discussions about perl modules,
comp.lang.perl.announce for announcements about perl or perl
modules, comp.lang.perl.tk for the discussion of the tk extensions
to perl, and comp.lang.perl.misc for the rest. None of these groups
are about HTTP, HTML, CGI, Java, Unix, NT, or anything like that.
There are other groups for those issues.
- Try to find the answer yourself before posting.
Perl comes with an excellent set of documentation, most of which is
available with the perldoc command. You should at least read a few
of those documents before starting to program (perl, perlsyn,
perldata, perlop and perlfunc). When you run into a problem, you
should consult the faq (perlfaq) before posting to the group.
# perldoc perl
# perldoc perlsyn
You can also find many answers using a Usenet archive, like
dejanews. If you haven't used it before, have a try at
http://www.dejanews.com/
It is always a good idea to have a good book handy. Have a look at
http://language.perl.com/info/documentation.html for some good
titles.
Before you post, you should also spend some time reading the
articles in the relevant newsgroups. Chances are that you find an
answer there. You will also notice the regular posts of pointers to
the FAQ etc. If you don't find anything relating to your immediate
problem, at the least you might learn something.
- When you post, choose a good subject line, and be as precise as you
can in your post.
Have a look at
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post for an
excellent discussion on subject lines.
When you describe your problem, leave out irrelevant facts. Try to
be as concise about the problem as you can. Try to limit the amount
of code you post to a small snippet that illustrates the problem
you're seeing. But also: try to be precise, and to use the right
terminology. Try to describe what you're trying to do in a _few_
lines. Don't be too general, but also, don't digress too much.
If you have tried solutions yourself, and if you have read the
relevant FAQs, please state so, to avoid responses pointing you to
those resources.
Don't make assumptions about how hard your problem is. What seems
hard to you might in fact be a trivial issue. Don't include words
like 'Urgent' anywhere in your post. If it's urgent, then Usenet is
the wrong place to ask.
In general, try to follow the guidelines for Usenet as posted
regularly to news.announce.newusers.
There are a few things that will irritate a lot of people here:
- Questions about CGI, HTML, JavaScript, web servers etc.
They are off topic, and should be directed to the appropriate news
groups.
- The KLB (Known Lazy Bastard) syndrome
Some people seem to expect the people on these groups to be there
for them, and to read the documentation for them, and to write
scripts for them, and to hold their hand while doing it.
- Ask questions that are answered in the FAQ. Ask questions that show
that you haven't even read the basic set of documentation mentioned
above.
- Use excessive capitalisation.
- Post badly formatted posts. Post Multipart MIME posts.
Some news readers have very odd ideas of what a message to Usenet
should look like. HTML has no place on Usenet, MIME attachments have
no place here. Posts should be made in plain text, without whistles
and bells.
Things that most people really don't have a problem with, but that are
perceived like that:
- You're new to perl.
There is absolutely nothing wrong with that. If you show that you
have at least done the minimal amount of work, and have tried
finding solutions yourself, then no one will have a problem with you
not being a great wizard.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Wed, 13 May 1998 02:18:05 GMT
From: davecook@home.com (David M. Cook)
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <slrn6li0jm.k9f.davecook@mozart.escnd1.sdca.home.com>
On 12 May 1998 18:55:29 -0500, Jonathan Feinberg <jdf@pobox.com> wrote:
>Did this remind anyone else of the stuff that's printed on those
>wonderful Dr. Bronner's Essene soap bottles?
>
> 9th: More good is caused by evil than by good, do what's right!
> Enlarge the positive! Replace the negative with the Moral ABC of
> All-One-God-Faith that lightning-like unites the Human race! For we're
> All-One or none! As Mao found in Redbook '51, "Marxism once in power,
> is unworkable! Has less value than cow dung! Its power is the gun!"
> Khruschev added, "Without profits, farmers won't deliver food, we
> starve!"
Wow, that brings back memories. You forgot the part about half a lemon.
Dr. Bronner also made these fantastic cheese puff things that I was totally
addicted to.
Dave Cook
------------------------------
Date: Tue, 12 May 1998 23:12:46 -0400
From: Gangadhar Konduri <gangs@mit.edu>
Subject: Problems with system command in perl
Message-Id: <35590FAE.1FAA@mit.edu>
Hi,
I am running a java program where it posts to a CGI script written in
perl. The cgi script in turn fires another java program thro the system
command. All this workjed fine a few days ago. And i suddenly find it
not working.
I stripped the program downm to one which just calls a system command to
run a java program which prints a number to a file. This was working
fine if run directly in a shell. But if run from a browser, whatever is
there in the system command, it is not getting executed at all (Because
teh java program saves a number in a file, i clearly know that it is not
working).
Please, please help me!
Thanks in advance,
--Gangadhar.
The stripped down program.
#!/opt/local/bin/perl
use Socket;
require "../UTIL/soc-cgilib.pl";
require "../UTIL/wraputil.pl";
$|=1;
print &PrintHeader;
@args= ("java -classpath
.:/export/home0/deba/Java/JDK1.02/java/lib/classes.zip temp");
$rc = oxffff & system @args;
@args= ("echo" ,"general" );
system(@args);
print "output";
print " $rc";
------------------------------
Date: Tue, 12 May 1998 23:28:44 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problems with system command in perl
Message-Id: <comdog-ya02408000R1205982328440001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35590FAE.1FAA@mit.edu>, Gangadhar Konduri <gangs@mit.edu> posted:
>I am running a java program where it posts to a CGI script written in
>perl. The cgi script in turn fires another java program thro the system
>command. All this workjed fine a few days ago. And i suddenly find it
>not working.
>@args= ("java -classpath
are you sure that your CGI script knows where java is?
see the CGI Meta FAQ for references to documents which will help you
debug your problem.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Wed, 13 May 1998 02:53:40 GMT
From: nick@hob.com
Subject: Question: Finding which element of a list a string corilates to
Message-Id: <6jb1vl$2lb$1@nnrp1.dejanews.com>
This problem is really bothering me because I feel like I am forgeting an
obvious perl function in my rustiness. I think coding more than 4 languages
in a given month scrambles my brain. Any help would be greatly appreciated.
I'm trying to find out what position a given string holds in a list
If I have a list like this:
@Months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
I want to be able to find out what the value of a unknown variable will be
So that if I have:
$CurrentSelect = "Apr"; (note in the actual situation I the value of
CurrentSelect is unpredictable)
I could find out that it is the fourth element of @Months or @Months[3]
Ideally I would get -1 if the given value doesn't appear in the list.
I know how to do this with a loop that scans through the array but I could
have sworn that there was a more elegant way to accomplish it without loops
or using a hash.
Again, thanks for listening. Hope this was a clear explanation of my problem.
-Nick
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 12 May 1998 19:15:22 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: Randomly sorting an array
Message-Id: <6javnq$ccp@cello.hpl.hp.com>
> 128 bits of state lets you shuffle 34 elements. You would need
> 226 bits of state to shuffle a deck of cards and have a chance
> of all permutations coming up.
Next we need to consider what this is being used for. If it's a poker
game, 128 bits still gives you 2^128 (or thereabouts possibilities),
which is enough for one heck of a lot of games. If it is for
simulation, you have to consider the state space you are exploring
and whether the limited resources you have to explore that state space
are more of a problem.
The only `real' problem is if you suspect that the limited seed/limited
random number generator somehow bias the set of shuffles that are
possible. If so, this is a problem in your random number generator.
In general, I don't think 128 bits is a problem; 2^128 shuffles is a
*lot*.
- tom
------------------------------
Date: Wed, 13 May 1998 10:43:29 +0800
From: steve@inature.com.au (S. Vertigan)
Subject: Replacing characters with special meanings?
Message-Id: <199805130243.KAA00897@opera.iinet.net.au>
Hi. I'm trying to replace the '|' character with an exclamation mark and
attempted to use $variable =~ s/|/!/g; which gave strange results so I'm
guessing it's treating the pipe as a command syntax rather than as a
character. I've tried replacing it with a variable with is the pipe
character but that didn't bring any joy either, and I can't find any mention
of this problem in the faq or man pages. Is there a way to specify the |
character in operations like this?
Thanks,
--Steve
------------------------------
Date: Tue, 12 May 1998 23:05:56 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Replacing characters with special meanings?
Message-Id: <comdog-ya02408000R1205982305560001@news.panix.com>
Keywords: from just another new york perl hacker
In article <199805130243.KAA00897@opera.iinet.net.au>, steve@inature.com.au (S. Vertigan) posted:
>Hi. I'm trying to replace the '|' character with an exclamation mark and
>attempted to use $variable =~ s/|/!/g; which gave strange results so I'm
the | is a regex meta character. to get around that you can do many things:
m/\|/ #escape it
m/\Q|/ #use \Q to un-meta meta characters
m/[|]/ #character class
and so on.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 13 May 1998 01:36:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Scanning Perl scripts for Y2K problems
Message-Id: <6jatff$re8$1@client2.news.psi.net>
Randal Schwartz (merlyn@stonehenge.com) wrote on MDCCXVI September
MCMXCIII in <URL: news:8cra1z6lxu.fsf@gadget.cscaper.com>:
++ >>>>> "Bart" == Bart Lateur <bart.mediamind@tornado.be> writes:
++
++ Bart> localtime() Y2K compliant? Yeah, right. Calculating years since 1900 is
++ Bart> dubious, to say the least.
++
++ Uh? Huh? Maybe dubious to you. Not at all dubious to me.
++
++ Or are you saying that anything that references Unix Epoch (seconds
++ since jan 1, 1970) is *also* dubious because it has a basepointer
++ that's not the year 0?
++
++ I'm just not following.
I'd say dubious is a too strong term, but I guess Bart's point is that
if the system functions (and hence Perls localtime) had not returned
the number of years since 1900 but the number of years since 0, there
would have been less y2k problems.
Programmers are stupid. Give them some rope and entire flocks will
hang themselves. Returning years since 1900 gives more rope than
returning years since 0.
I don't see why that is so hard to follow.
Abigail
--
Who will be the first to accuse me of something I didn't say?
------------------------------
Date: Tue, 12 May 1998 23:42:29 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Significant digit?
Message-Id: <1d8xvhf.xi1sjggwkb9cN@bay1-73.quincy.ziplink.net>
Craig Berry <cberry@cinenet.net> wrote:
> : Use of * in printf format not supported at s2 line 25, <> chunk 1.
>
> Hrm. I thought Perl's s?printf formatting was handled via C's s?printf
> formatting (with some argument jiggering first, of course), and I'm
> fairly certain that width/precision indirection (the .* trick) is part of
> the ANSI C standard. Alas, my copy of same is elsewhere. Anybody have
> one handy to check?
Don't look at the ANSI C standard, look at Perl's documentation for the
sprintf function:
...The * character as a length specifier is not supported. But,
you can easily get around this by including the length expression
directly into FORMAT...
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 13 May 1998 03:51:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Significant digit?
Message-Id: <6jb5c2$6gi$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
: ...The * character as a length specifier is not supported. But,
: you can easily get around this by including the length expression
: directly into FORMAT...
This is no longer true.
--tom
--
If you want to program in C, program in C. It's a nice language. I
use it occasionally... :-)
--Larry Wall in <7577@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Tue, 12 May 1998 20:32:01 -0500
From: Daniel Warren <dwarren@starnetinc.com>
Subject: Where are pod translators?
Message-Id: <3558F811.9C13756D@starnetinc.com>
I've downloaded Perl 5.003 for Win32 binary (from ActiveState or maybe
one of the CPAN mirrors,) but I couldn't find the pod translators in the
distribution. I've been unable to find the translators anywhere else on
CPAN. I'm particularly interested in pod2LaTeX. Help?
------------------------------
Date: Tue, 12 May 1998 20:56:57 -0700
From: "Ion Chalmers Freeman" <ion@aroma.com>
Subject: XML Module
Message-Id: <35591ad9.0@news.prostar.com>
Hi!
I've got a DTD and I need to output valid XML from my perl script. Is
there a module that assists with this? I couldn't find one on CPAN.
Ion Chalmers Freeman, MCP
ion@aroma.com
http://www.foxinternet.net/web2/ion
"If you treat texts as ordered hierarchies of content objects many practical
advantages follow, but not otherwise.
Therefore texts are ordered hierarchies of content objects." -
Allen Renear, Brown University
Elli Mylonas, Harvard University
David Durand, Boston University
http://www.sil.org/sgml/ohco1.html
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2576
**************************************