[15876] in Perl-Users-Digest
Perl-Users Digest, Issue: 3289 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 8 11:10:28 2000
Date: Thu, 8 Jun 2000 08:10:17 -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: <960477016-v9-i3289@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Jun 2000 Volume: 9 Number: 3289
Today's topics:
perl or with system <mike.solomon@eps.ltd.uk>
Re: perl or with system (Simon Cozens)
Re: perl or with system <mike.solomon@eps.ltd.uk>
Re: Perl Shortcut? (M.J.T. Guy)
perl tutorial site (Bart Lateur)
Re: perl tutorial site <mihail.temelkov@gs.com>
Re: Perl vs Python for Numerical Analysis <REMOVEHeiko.KleinTHIS@ikp.uni-koeln.de>
Re: Perl's evaluation order for a logical expression (M.J.T. Guy)
Re: Perl-5.6.0 on SGI's IRIX geoff_gunner@my-deja.com
Re: pnggraph/gifgraph and logarithmic axes <cybertoast@mindless.com>
Possible Unicode problem with perl 5.6.0 <svc@kb.dk>
Problem with Perl + CPAN... <cyklus@hotmail.com>
Re: Pseudo-hashes/OOP (M.J.T. Guy)
Re: Read/write in socketpair with forked Childs nobull@mail.com
simultaneuos write to file mwangu@my-deja.com
Re: simultaneuos write to file (Simon Cozens)
Socket problems on Windows 95/98 <billhess2000@home.com>
Re: Solution needed for 'simple' task. <care227@attglobal.net>
Re: Solution needed for 'simple' task. <sweeheng@usa.net>
Re: Solution needed for 'simple' task. <sweeheng@usa.net>
Re: Solution needed for 'simple' task. (David Wall)
Re: Solution needed for 'simple' task. <aqumsieh@hyperchip.com>
Re: Solution needed for 'simple' task. <ra_jones@my-deja.com>
Re: System() & PID (Bart Lateur)
Re: Text Sorting Question <sariq@texas.net>
Re: Tr vs. tr !@#@!#$@#% <rick.delaney@home.com>
Re: Using "system" <care227@attglobal.net>
Re: Using "system" <andersen+@rchland.ibm.com>
Re: Why won't this interpolate please? (M.J.T. Guy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 8 Jun 2000 15:01:22 +0100
From: "Mike Solomon" <mike.solomon@eps.ltd.uk>
Subject: perl or with system
Message-Id: <8ho93v$qao$1@newsg4.svr.pol.co.uk>
Can any one help me:
if I do :
chdir("/usrk") or die "no such directory";
if /usrk does not exist I get an error message as expected
if on the other hand I use
system("cd /usrk") or die "no such directory";
it does not pick up the error but if I then use :
system("cd /usrk") && "die no such directory";
I then get the behaviour I want which makes no sense to me
my question is why does 'or' with system give me exactly the opposite result
that I was expecting
I am running per 5.005_3 under AIX 4.3.2
Regards
Mike Solomon
IT Support Manager
email mike.solomon@hayslogistics.co.uk
Phone 01295 660621
Mobile 07802390696
Fax 01295 660189
------------------------------
Date: 8 Jun 2000 14:15:06 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: perl or with system
Message-Id: <slrn8jvaja.bh3.simon@justanother.perlhacker.org>
Mike Solomon (comp.lang.perl.misc):
>my question is why does 'or' with system give me exactly the opposite result
>that I was expecting
The return value from system() isn't what you think it is.
From perldoc -f system:
The return value is the exit status of the program as returned by the
`wait' call. To get the actual exit value divide by 256.
--
>Almost any animal is capable learning a stimulus/response association,
>given enough repetition.
Experimental observation suggests that this isn't true if double-clicking
is involved. - Lionel, Malcolm Ray, asr.
------------------------------
Date: Thu, 8 Jun 2000 15:56:31 +0100
From: "Mike Solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: perl or with system
Message-Id: <8hocb9$lr0$1@news7.svr.pol.co.uk>
Simon,
as I understand it that would explain why I would get a different return
value from system but for a success I still get 0
Simon Cozens <simon@brecon.co.uk> wrote in message
news:slrn8jvaja.bh3.simon@justanother.perlhacker.org...
> Mike Solomon (comp.lang.perl.misc):
> >my question is why does 'or' with system give me exactly the opposite
result
> >that I was expecting
>
> The return value from system() isn't what you think it is.
>
> From perldoc -f system:
>
> The return value is the exit status of the program as returned by the
> `wait' call. To get the actual exit value divide by 256.
>
> --
> >Almost any animal is capable learning a stimulus/response association,
> >given enough repetition.
> Experimental observation suggests that this isn't true if double-clicking
> is involved. - Lionel, Malcolm Ray, asr.
------------------------------
Date: 8 Jun 2000 14:59:16 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl Shortcut?
Message-Id: <8hocc4$ih7$1@pegasus.csx.cam.ac.uk>
Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
>
>If this is all you want then:
>
> @stats{@teams} = ({wins => 0}) x @teams;
>
>should do what you want.
That's almost certainly *not* what the OP wants. Do you really want
all the values in %stats to be the *same* anonymous array?
Mike Guy
------------------------------
Date: Thu, 08 Jun 2000 10:13:39 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: perl tutorial site
Message-Id: <39466f73.12190823@news.skynet.be>
I stumbled across this Perl introduction course. It's not mentioned on
the "tutorials" list on <www.perl.com>, so maybe not too many people
know about it yet.
It looks to me like it's the text for a Perl programming course on a
university somewhere in the UK (Cardiff).
I haven't taken a really close look at it, but it looks to me like it
will be a lot better, for newbies, than any "Perl for Dummies" book.
Somebody ought to check it out.
Practical Perl Programming
A. D. Marshall 1999
http://www.cm.cf.ac.uk/Dave/PERL/
--
Bart.
------------------------------
Date: Thu, 08 Jun 2000 09:57:18 -0400
From: Mihail Temelkov <mihail.temelkov@gs.com>
Subject: Re: perl tutorial site
Message-Id: <393FA63E.3D72F253@gs.com>
I just checked the site out and loved it - there are plenty of examples
(as opposed to
the as-concise-as-it-gets style of the O'Reily books)..
Bart Lateur wrote:
> I stumbled across this Perl introduction course. It's not mentioned on
> the "tutorials" list on <www.perl.com>, so maybe not too many people
> know about it yet.
>
> It looks to me like it's the text for a Perl programming course on a
> university somewhere in the UK (Cardiff).
>
> I haven't taken a really close look at it, but it looks to me like it
> will be a lot better, for newbies, than any "Perl for Dummies" book.
>
> Somebody ought to check it out.
>
> Practical Perl Programming
> A. D. Marshall 1999
> http://www.cm.cf.ac.uk/Dave/PERL/
>
> --
> Bart.
------------------------------
Date: 08 Jun 2000 13:11:28 +0200
From: Heiko Klein <REMOVEHeiko.KleinTHIS@ikp.uni-koeln.de>
Subject: Re: Perl vs Python for Numerical Analysis
Message-Id: <3pzoow4ecf.fsf@hydra.ikp.Uni-Koeln.DE>
Hi,
I consider myself as a perl programmer, and I'm a physicist, too.
And, to tell the truth, I'm of your employers opinion. Use Python! I
checked it out recently and it was quite nice to programm with. I'm
sure, everything you can do with Python, you can do with Perl,
too. But the code is better readable in python. (Not your own, sure
not! But there are always some guys working on the same project not
using a good syntax and clean indentation ;-) )
Perl is better optimized, but you will do most time-consuming stuff in
C. Tk is much faster in Perl (where it is compiled in, and not wrapped
around as in Python).
'There's more than one way to do it' is the problem in huge projects
with several people. Everyone will do it in another way.
IMHO, try to convince your employer to use SWIG, then it will be
easier in the future to switch from one language to another. (I'm just
struggling with a Package written for tcl. Tcl sucks! (Just for the
counters)).
Heiko
------------------------------
Date: 8 Jun 2000 14:47:02 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl's evaluation order for a logical expression
Message-Id: <8hobl6$hma$1@pegasus.csx.cam.ac.uk>
Eric Bohlman <ebohlman@netcom.com> wrote:
>T. Alex Beamish (talexb@tabsoft.on.ca) wrote:
>: I'm having fits with a script that has code like
>:
>: if ( ( $Col > 1 ) &&
>: ( defined ( $Table[ $Col - 1 ][ $Row ] ) ) &&
>: ( $Table[ $Col - 1 ][ $Row ] eq $TableHash->{ 'stmt_date' } ) )
>:
>: Apache is complaining that there is the "Use of uninitialized value"
>: somewhere in the line. I'm damned if I can find it .. however it may
>: depend on the order that perl evaluates the logical expression.
>
>That order is quite well defined, as a glance at perlop would have told
>you; the three "&&" clauses are evaluated strictly left-to-right, each
>successive one being evaluated only if the previous one succeeded.
>
>The only thing that could cause that message (which is coming from
>perl, not apache) would be an uninitialized $Row. Try printing out its
>value.
No. There are two things which it could be:
It could be $Row undefined or $TableHash->{ 'stmt_date' } undefined.
You'll need to check both of them.
Mike Guy
------------------------------
Date: Thu, 08 Jun 2000 10:04:06 GMT
From: geoff_gunner@my-deja.com
Subject: Re: Perl-5.6.0 on SGI's IRIX
Message-Id: <8hnr2g$kik$1@nnrp1.deja.com>
Bruno Joho <bjoho@centralnet.ch> wrote about Perl 5.6.0 compile
problems on SGI's IRIX.
I've been through these hoops as well. I couldn't get a working gcc-
compiled perl. I ended up using the IRIX native compiler using the -
mips1 directive (because I wanted DBI::Sybase, and the Sybase libraries
were pretty ancient. My cc defaulted to a different model) and -02.
Does your machine have different memory models (32 bit and 64 bit)? You
might find that you're linking a library from a different model to the
one you're compiling under. Define everything when you run Configure to
make sure!
Geoff
btw: I ended up abandoning perl 5.6 because one of the modules wouldn't
work under it (I think it was Storable). A module upgrade may be
available now, but you may like to check.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 08 Jun 2000 08:54:20 -0500
From: Sundar Raman <cybertoast@mindless.com>
Subject: Re: pnggraph/gifgraph and logarithmic axes
Message-Id: <393FA58C.F8332EB@mindless.com>
Problem is that the axis values will be incorrect. The end user needs
to be able to see the "true" values. It's easy enough for me to graph
the log(y), but there's no option in PNGgraph to specify a different set
of axis-markers than the data-set :-(
Michael Schlueter wrote:
>
> I think there is an option for log-scales. What you can always do is to
> calculate the log(y) separately and display this on a linear y'-scale.
------------------------------
Date: Thu, 08 Jun 2000 16:33:51 +0200
From: =?iso-8859-1?Q?S=F8ren?= Vejrup Carlsen <svc@kb.dk>
Subject: Possible Unicode problem with perl 5.6.0
Message-Id: <393FAECF.3411ABA2@kb.dk>
Dear all.
I ¨recently got the following error-message while parsing a HTML
document with perl (using HTML::Parser v. 2.22)
Can't find unicode character property definition via main->d or d.pl at
unicode/Is/d.pl line 0
Has any one got a clue, to what the problem really is?
Regards
Søren V. Carlsen, The Royal Library, Copenhagen, Denmark
------------------------------
Date: Thu, 8 Jun 2000 14:36:25 +0200
From: "news.sektornet.dk" <cyklus@hotmail.com>
Subject: Problem with Perl + CPAN...
Message-Id: <8hob1b$tea$1@news.net.uni-c.dk>
When trying to get the bundled module package from cpan i get the following
error. If I go to the dir where its trying to read from I find the file
"01mailrc.txt" identical to the one on cpan... so kinda wierd that it cant
read it?
Drawback:/home# perl -MCPAN -e 'install Bundle::CPAN'
Trying with "/usr/bin/lynx -source" to get
http://www.cpan.dk/CPAN/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Error reading from /root/.cpan/sources/authors/01mailrc.txt:
Btw. first time i used perl -MCPAN... it created some sort of configuration
file from answers i typed in like what cpan archieve to use etc.. any idea
where i can find the config file and how i can reconfigure it?
- Jx
------------------------------
Date: 8 Jun 2000 14:40:09 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Pseudo-hashes/OOP
Message-Id: <8hob89$hf1$1@pegasus.csx.cam.ac.uk>
Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
>
>Yes. Did you try it?
I can see that you didn't. :-)
>Basically, you do something like:
>
> BEGIN {
> open F, 'config' or die $!;
> chomp(my @array = <F>);
> close F;
> use fields @array;
> }
Yet again: you must put that "use" *outside* the BEGIN{}.
And therefore also the declaration "my @array;".
Mike Guy
------------------------------
Date: 08 Jun 2000 12:12:49 +0100
From: nobull@mail.com
Subject: Re: Read/write in socketpair with forked Childs
Message-Id: <u9n1kwl93i.fsf@wcl-l.bham.ac.uk>
Running your script with -w the bug was obvious.
Please, never ask for help in comp.lang.perl.misc without trying -w
first!
Joerg Kammerer <jk@sinatra.inka.de> writes:
> $pid_hash{$child}=$fh_parent; #Zuordnung childpid =>fh_child
^^^^^^ ^^^^^
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 08 Jun 2000 10:00:02 GMT
From: mwangu@my-deja.com
Subject: simultaneuos write to file
Message-Id: <8hnqqs$k99$1@nnrp1.deja.com>
Dear all,
I have a multi-user perl application I am working on and need to know if
there is a way to safely achieve multiple simultaneous writes to a
file from different instances of a script i.e. different users. I will
eventually have a database instead of a file, but for the time being, I
need to test in this manner.
Appreciatively,
Mike W.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Jun 2000 10:11:57 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: simultaneuos write to file
Message-Id: <slrn8jusbd.bh3.simon@justanother.perlhacker.org>
mwangu@my-deja.com (comp.lang.perl.misc):
>I have a multi-user perl application I am working on and need to know if
>there is a way to safely achieve multiple simultaneous writes to a
>file from different instances of a script i.e. different users. I will
>eventually have a database instead of a file, but for the time being, I
>need to test in this manner.
perldoc -q lock:
Found in /usr/local/lib/perl5/5.6.0/pod/perlfaq5.pod
How can I lock a file?
Perl's builtin flock() function (see the perlfunc manpage
for details) will call flock(2) if that exists, fcntl(2)
if it doesn't (on perl version 5.004 and later), and
lockf(3) if neither of the two previous system calls
exists...
--
I cannot and will not cut my conscience to fit this year's fashions.
-- Lillian Hellman
------------------------------
Date: Thu, 08 Jun 2000 12:03:11 GMT
From: "Bill Hess" <billhess2000@home.com>
Subject: Socket problems on Windows 95/98
Message-Id: <3YL%4.102791$h01.813574@news1.rdc1.mi.home.com>
I have a program which uses sockets which gives me errors on Win 95/98 but
not on Windows NT 4.0
The error is something like "invalid arguments" on the socket function. I
am using the tcp protocol
Is there something I have to do special for Windows 95/98 networking?
Bill Hess
------------------------------
Date: Thu, 08 Jun 2000 08:05:31 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <393F8C0B.F91667F9@attglobal.net>
ra jones wrote:
>
> I have a list of terms, which in practice can vary in length between 1
> and a lot. Here is 4:
>
> @list = ("A","B","C","D");
> $N = @list
>
> I want the script to print 'A, B, C and D'. If there were 1 item, print
> 'A', if 2 then print 'A and B'. If twenty, then 'A, B, C, D ... and T'.
>
From perlfaq4, "How do I process/modify each element of an array?"
for (@list) {
print;
}
HTH
------------------------------
Date: Thu, 8 Jun 2000 20:18:59 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <8ho2kr$c51$1@violet.singnet.com.sg>
ra jones <ra_jones@my-deja.com> wrote in message
news:8hnoal$imj$1@nnrp1.deja.com...
> I have a list of terms, which in practice can vary in length between 1
> and a lot. Here is 4:
>
> @list = ("A","B","C","D");
> $N = @list
>
> I want the script to print 'A, B, C and D'. If there were 1 item, print
> 'A', if 2 then print 'A and B'. If twenty, then 'A, B, C, D ... and T'.
Try this:
sub pretty { ($l = pop @_ and @_) ? (join (', ', @_) . " and $l") : $l }
for ($c = 'A'; $c ne 'U'; ++$c) { print pretty('A' .. $c) . "\n" };
------------------------------
Date: Thu, 8 Jun 2000 20:57:18 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <8ho58c$cn7$1@coco.singnet.com.sg>
> > I have a list of terms, which in practice can vary in length between 1
> > and a lot. Here is 4:
> >
> > @list = ("A","B","C","D");
> > $N = @list
> >
> > I want the script to print 'A, B, C and D'. If there were 1 item, print
> > 'A', if 2 then print 'A and B'. If twenty, then 'A, B, C, D ... and T'.
>
> Try this:
>
> sub pretty { ($l = pop @_ and @_) ? (join (', ', @_) . " and $l") : $l }
> for ($c = 'A'; $c ne 'U'; ++$c) { print pretty('A' .. $c) . "\n" };
Subtle bug:
print pretty(3,2,1,0);
gives:
0
because 0 (zero) is FALSE.
A safer pretty one-liner is:
sub pretty { ($c = pop @_, @_)[1] ? (join (', ', @_) . " and $c") : $c }
------------------------------
Date: 8 Jun 2000 10:44:26 -0400
From: darkon@one.net (David Wall)
Subject: Re: Solution needed for 'simple' task.
Message-Id: <8F4D62EF7darkononenet@206.112.192.118>
ra_jones@my-deja.com (ra jones) wrote in <8hnoal$imj$1@nnrp1.deja.com>:
>I have a list of terms, which in practice can vary in length between 1
>and a lot. Here is 4:
>
>@list = ("A","B","C","D");
>$N = @list
>
>I want the script to print 'A, B, C and D'. If there were 1 item, print
>'A', if 2 then print 'A and B'. If twenty, then 'A, B, C, D ... and T'.
There's an example in the Perl Cookbook of exactly what you want. 4.2,
"Printing a list with commas". It has the following function, which
returns a string with the "commified" list. (Not commiefied, which would
round up the elements of the list, offer them a chance to confess, and then
either send them to a gulag or have them shot.)
sub commify_series {
(@_ == 0) ? '' :
(@_ == 1) ? $_[0] :
(@_ == 2) ? join(" and ", @_) :
join(", ", @_[0 .. ($#_-1)], "and $_[-1]");
}
As you can see, this looks at the cases where the list has 0, 1, 2, or 3 or
more elements.
HTH.
--
David Wall
darkon@one.net
------------------------------
Date: Thu, 08 Jun 2000 14:47:40 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <7ahfb4qlf7.fsf@merlin.hyperchip.com>
ra jones <ra_jones@my-deja.com> writes:
> I have a list of terms, which in practice can vary in length between 1
> and a lot. Here is 4:
>
> @list = ("A","B","C","D");
> $N = @list
>
> I want the script to print 'A, B, C and D'. If there were 1 item, print
> 'A', if 2 then print 'A and B'. If twenty, then 'A, B, C, D ... and T'.
My first thought came in two lines:
@x = qw/a b c d/;
print shift @x;
print @x ? ", $_" : " and $_" while defined($_=shift @x);
But here's a one-liner (provided you didn't play with $[):
print @x == 1 ? $x[0] : join (' and ' =>
join (', ' => @x[0 .. $#x-1]),
$x[-1]);
Golf, anyone?
--Ala
------------------------------
Date: Thu, 08 Jun 2000 14:41:14 GMT
From: ra jones <ra_jones@my-deja.com>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <8hoba6$fc$1@nnrp1.deja.com>
In article <8ho58c$cn7$1@coco.singnet.com.sg>,
"Swee Heng" <sweeheng@usa.net> wrote:
> > > I have a list of terms, which in practice can vary in length
between 1
> > > and a lot. Here is 4:
> > >
> > > @list = ("A","B","C","D");
> > > $N = @list
> > >
> > > I want the script to print 'A, B, C and D'. If there were 1 item,
print
> > > 'A', if 2 then print 'A and B'. If twenty, then 'A, B, C, D ...
and T'.
> >
> > Try this:
> >
> > sub pretty { ($l = pop @_ and @_) ? (join (', ', @_) . " and $l") :
$l }
> > for ($c = 'A'; $c ne 'U'; ++$c) { print pretty('A' .. $c) . "\n" };
>
> Subtle bug:
> print pretty(3,2,1,0);
> gives:
> 0
> because 0 (zero) is FALSE.
>
> A safer pretty one-liner is:
> sub pretty { ($c = pop @_, @_)[1] ? (join (', ', @_) . " and $c") :
$c }
>
>
Swee Heng,
This works perfectly for the example you gave. Unfortunately in trying
to simplify the details of the task I think I must have misled you
regards the terms. The contents of the list are actually words, not
letters, and so the code doesn't work - it returns the terms with
incremented last-letters. Can you suggest an appropriate modification?
--
ra jones (posted via deja.com)
address for e-mail reply:
rajones(at)mail(dot)com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 08 Jun 2000 14:53:58 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: System() & PID
Message-Id: <3940b2ae.2276860@news.skynet.be>
J. Lundell wrote:
>Is there a way on NT to create a new process and capture the Process ID
>of this new process via Perl?
Look at the docs for the module Win32::Process. These are on my system,
even though I didn't download the module, so they must be on you system
too.
At the very bottom of the page:
$ProcessObj->GetProcessID()
--
Bart.
------------------------------
Date: Thu, 08 Jun 2000 09:57:25 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Text Sorting Question
Message-Id: <393FB455.9A05153@texas.net>
Larry Rosler wrote:
>
> In article <s8ftjsgu8nns8jppavechqke610l9r8th2@4ax.com> on Wed, 07 Jun
> 2000 23:58:27 +0200, Abe Timmerman <abe@ztreet.demon.nl> says...
>
> ...
>
> > If sorting this thing is the main objective, use Schwartzian-Transform
> > or Rosler/Guttman-Transform.
>
> That's Guttman-Rosler Transform, as in GReaT!
Hmmm...I've always thought of it as Guttman-Rosler Transform, as in
GaRroTe. ;)
- Tom
------------------------------
Date: Thu, 08 Jun 2000 12:20:18 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Tr vs. tr !@#@!#$@#%
Message-Id: <393F9101.6AF7B6F2@home.com>
Tzadik Vanderhoof wrote:
>
> Yes, I agree with you that the documentation tells you that you need to
> use "Tr" not "tr" because of a conflict with a built-in Perl function.
> Yes, I'd read that documentation and I knew about that. Are you
> implying that this solves the problem I was complaining about?
Obviously it does not, but "complaining" is not a problem description.
Produce some (brief) code that produces the "misleading" error that
points to the wrong line so we can see where and what the problem is.
As for a solution, I have two.
1. Stop using Tr and produce the HTML yourself (which is easy).
2. Make an alias for Tr and use that.
*tr_for_the_shift_impaired = \&CGI::Tr;
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Thu, 08 Jun 2000 08:42:03 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Using "system"
Message-Id: <393F949B.3609A82C@attglobal.net>
Dave Woods wrote:
>
> Hi
>
> I've just read http://www.perlfaq.com and can't seem to find what I'm
> looking for...
>
Did you check perlfaq5? You can open a named pipe (FIFO) to a
command like so:
open( PRTCONF, "/usr/sbin/prtconf |" );
That would make the output of the prtconf command available
via the PRTCONF filehandle. If thats not what you need, (I think
it would block too) then you may want to simply replace system()
with exec(). Exec does the same thing as system, but does not
return! This is an important idea. You'll never know if the
program you are exec()ing worked or not. using system() or
fork() allows you to know how things turned out. You should
also check out
$ perldoc perlipc
$ perldoc -f fork
$ perldoc -f exec
$ perldoc -f system
------------------------------
Date: Thu, 08 Jun 2000 07:51:18 -0500
From: "Paul R. Andersen" <andersen+@rchland.ibm.com>
Subject: Re: Using "system"
Message-Id: <393F96C6.E0A1FA47@rchland.ibm.com>
Dave Woods wrote:
>
> Hi
>
> I've just read http://www.perlfaq.com and can't seem to find what I'm
> looking for...
>
> I need to run another program from my script, now I thought I would use the
> system command. However, when reading about this on the FAQ it says my
> script will wait for this program to end before continuing. But I wish to
> start severeal instances of this program, I had planned to used screen to
> run them in the background, but according to the FAQ system isn't the right
> thing to use.
>
> Maybe I've misunderstood it, could someone explain whether this is the case
> and offer me a solution to my problem?
>
> Thanks
> Dave
I beleive you've understood correctly. The only solution I can suggest
is to fork off however many processes you need.
--
Paul Andersen
-- I can please only ONE person per day.
-- Today is NOT your day.
-- Tomorrow isn't looking good either.
------------------------------
Date: 8 Jun 2000 14:13:26 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Why won't this interpolate please?
Message-Id: <8ho9m6$frg$1@pegasus.csx.cam.ac.uk>
Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
>
>The 'use lib ...' command is seen at compile-time, i.e before your
>script starts to run. You seem to set $main::client at run-time, which
>is too late. Try this:
>
> BEGIN {
> $main::client = 'fish';
> use lib qq(../$main::client);
> }
Wrong! That "use" needs to be outside the BEGIN{}, or needs to be
a require.
Mike Guy
------------------------------
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 3289
**************************************