[16976] in Perl-Users-Digest
Perl-Users Digest, Issue: 4388 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 20 18:05:40 2000
Date: Wed, 20 Sep 2000 15:05:23 -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: <969487523-v9-i4388@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Sep 2000 Volume: 9 Number: 4388
Today's topics:
Re: 2 Questions <bobmay@nethere.com>
Re: [help] Large datasets in Perl (anyone implemented b <sb@muccpu1.muc.sdm.de>
Re: Anonymous lists (Craig Berry)
Re: Candidate for the top ten perl mistakes list (Chris Fedde)
Re: Candidate for the top ten perl mistakes list <lr@hpl.hp.com>
Re: Candidate for the top ten perl mistakes list <elijah@workspot.net>
Re: Candidate for the top ten perl mistakes list <anmcguire@ce.mediaone.net>
Re: Candidate for the top ten perl mistakes list <uri@sysarch.com>
Re: Candidate for the top ten perl mistakes list (Gwyn Judd)
Re: Candidate for the top ten perl mistakes list <russ_jones@rac.ray.com>
Re: Candidate for the top ten perl mistakes list <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Re: Candidate for the top ten perl mistakes list <hartleh1@westat.com>
Re: Candidate for the top ten perl mistakes list (Logan Shaw)
Re: Candidate for the top ten perl mistakes list <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Re: Content-type <flavell@mail.cern.ch>
Re: fcntl <tim@ipac.caltech.edu>
Re: File Parsing, Skipping lines <lr@hpl.hp.com>
Re: Hash jelp for Newbie <lr@hpl.hp.com>
Help with complex regexp <news@jeroen.org>
Re: Help with complex regexp <yanick@babyl.sympatico.ca>
Re: Help with complex regexp <news@jeroen.org>
Re: Help with complex regexp <yanick@babyl.sympatico.ca>
Re: Help with complex regexp <news@jeroen.org>
Re: Help with Date ktracho@my-deja.com
Re: HELP! Problem returning info from shell call <lullaby25@my-deja.com>
Re: How do I shut down an oracle database from perl scr <randy_734@my-deja.com>
how to accept unknown # of parameters in cgi? nickysantoro@my-deja.com
Re: how to accept unknown # of parameters in cgi? <russ_jones@rac.ray.com>
Re: how to accept unknown # of parameters in cgi? <dmeyers@panix.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 Sep 2000 14:34:54 -0700
From: "Bob May" <bobmay@nethere.com>
Subject: Re: 2 Questions
Message-Id: <ssibd1d48rkd99@corp.supernews.com>
Seeing programs written in either Delphi or Perl reinforces my desire
not to dig into those languages. Both are huge files for simple
things and very slow executing them. Bloatware at it's best.
I like to do things fast and usually program in assembly when
circumstances allow and if not, BASIC for quickly assembled programs
that do simple things with a short development time. I've gotten
servoloop control temp systems working in a day without any further
work on the program necessary and that's quick enough, especially when
the hardware took 2 days to make and the testing was another 3 days.
--
Bob May
Access1 has gone Chapter 7 so I don't know how long my website is
going to last.
Bob May
------------------------------
Date: 20 Sep 2000 19:58:27 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: [help] Large datasets in Perl (anyone implemented bit fields?)
Message-Id: <8qb4t3$fcl$1@solti3.sdm.de>
In article <Cp5y5.15$bx3.596@client>, David Christopher Asher <asher@zedxinc.com> wrote:
> I need to work with some large 2D arrays at pretty high resolution, and I am
> having trouble because of memory issues. (like wanting to allocate 4GB of
> memory). It's only a boolean value, but Perl's typeless data makes it hard
> to economize.
> Has anyone written a class or something that handles boolean arrays?
It is called "Bit::Vector" and can be found at either
http://www.perl.com/CPAN/modules/by-module/Bit/Bit-Vector-5.8.tar.gz
or http://www.engelschall.com/u/sb/download/pkg/Bit-Vector-5.8.tar.gz
> Any
> advice on how I can get around this problem? I am considering rewriting it
> in C, but I don't want to do that until I've exhausted the possibilities
> with Perl.
The Bit::Vector module is written in C, internally.
> Thanks!
> David Christopher Asher
Good luck!
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/whoami/ (Who am I)
http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)
------------------------------
Date: Wed, 20 Sep 2000 19:14:44 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Anonymous lists
Message-Id: <ssi354qmi4k1e9@corp.supernews.com>
akhnaten88@my-deja.com wrote:
: Ok guys, here's my situation... I'm not too good with references and
: anonymous datatypes, so what I've done is ugly. What I needed was a
: function that returns 3 lists, so here (in a nutshell) is what I've
: done:
:
: sub func() {
: my @a = (1, 2, 3);
: my @b = (2, 3, 4);
: my @c = ('foo', 'bar', 'baz');
: return [\@a, \@b, \@c];
: }
:
: First off.. is that the best way to return 3 lists worth of data?
Rather than returning a reference to a list, I would tend to return the
list itself (that is, replace the square brackets with parens on the
return line).
: To make the problem more interesting, I had 2 functions that do this, and
: I had to take the return data from both and merge them into single
: lists. TO avoid writing out the second function, I'll just call then
: above function, func() twice and merge that data. Here is what I ended
: up doing:
:
: my $refs = func();
: (my ($l1ref, $l2ref, l3ref)) = @{$refs};
: my @list1 = @{$l1ref};
: my @list2 = @{$l2ref};
: my @list3 = @{$l3ref};
: # now we call it again, and merge the data
: my $refs = func();
: (my ($l1ref, $l2ref, $l3ref)) = @{$refs};
: my @list1 = (@list1, @{$l1ref});
: my @list2 = (@list2, @{$l2ref});
: my @list3 = (@list3, @{$l3ref});
my $ar1 = func();
my $ar2 = func();
my @res = ();
push @res, [ @{$ar1->[$_]}, @{$ar2->[$_]} ] foreach (0..2);
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Every force evolves a form."
| - Shriekback
------------------------------
Date: Wed, 20 Sep 2000 18:16:34 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <6a7y5.289$W3.190000128@news.frii.net>
In article <39C8EFF3.F5FE3BA4@rac.ray.com>,
Russ Jones <russ_jones@rac.ray.com> wrote:
>Abigail wrote:
>>
>> || Seldomly?
>>
>
>How often have you seen the word "seldomly?"
>--
At least 6 times on this thread....
Oh, that was rhetorical... (oops 8-)
...
..
c
--
A Java monkey, a C monkey and a Perl monkey met at a golf pro shop...
--
This space intentionally left blank
------------------------------
Date: Wed, 20 Sep 2000 11:21:05 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <MPG.14329fe8471ca36198ad9d@nntp.hpl.hp.com>
In article <Pine.GSO.4.21.0009201131470.15465-100000@crusoe.crusoe.net>
on Wed, 20 Sep 2000 11:32:33 -0400, Jeff Pinyan <jeffp@crusoe.net>
says...
> >> 1: didn't use -w
> >> 2: didn't use strict
> >> 3: didn't test the results of an "open"
> >> 4: listened to anything godzilla said
> > 5: didn't read perldoc -f localtime
> 6: uses @array[$index] where $array[$index] should be used
1: uses split '|' or (less likely by far) /|/
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 20 Sep 2000 18:36:21 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <eli$0009201435@qz.little-neck.ny.us>
In comp.lang.perl.misc, Jeff Pinyan <japhy@pobox.com> wrote:
> >> 1: didn't use -w
> >> 2: didn't use strict
> >> 3: didn't test the results of an "open"
> >> 4: listened to anything godzilla said
> > 5: didn't read perldoc -f localtime
> 6: uses @array[$index] where $array[$index] should be used
#6 is not so good as Abigail pointed out, so how about:
6: Verifying email addresses
7: Parsing HTML with regexps
A personal nitpick of mine:
8: Misuse of non-greedy regexps.
See my post from early August <eli$0008032005@qz.little-neck.ny.us>
for an example of non-greediness leading to a broken regexp.
Elijah
------
seldom finds it useful to use non-greedy regexps given their drawbacks
------------------------------
Date: Wed, 20 Sep 2000 14:02:56 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <Pine.LNX.4.21.0009201359140.3145-100000@hawk.ce.mediaone.net>
On Wed, 20 Sep 2000, Larry Rosler quoth:
LR> In article <Pine.GSO.4.21.0009201131470.15465-100000@crusoe.crusoe.net>
LR> on Wed, 20 Sep 2000 11:32:33 -0400, Jeff Pinyan <jeffp@crusoe.net>
LR> says...
LR> > >> 1: didn't use -w
LR> > >> 2: didn't use strict
LR> > >> 3: didn't test the results of an "open"
LR> > >> 4: listened to anything godzilla said
LR> > > 5: didn't read perldoc -f localtime
LR> > 6: uses @array[$index] where $array[$index] should be used
LR>
LR> 1: uses split '|' or (less likely by far) /|/
A couple more to potentially add:
7: Needlessly quotes ~EVERYTHING~.
8: Uses s/// where tr/// would be better.
Regards,
anm
--
<(@)> ; $/ = q;;; for $" ( map $_ && chr() => split m~[\D+ <(@)>
<(@)> ]~ => <DATA> ) { print "@{ [ '' => '' ] }" } __END__ <(@)>
<(@)> 74 117 115 116 32 97 110 111 116 104 101 114 32 <(@)>
<(@)> 80 101 114 108 32 72 97 99 107 101 114 10 <(@)>
------------------------------
Date: Wed, 20 Sep 2000 20:30:11 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <x7n1h2dcx8.fsf@home.sysarch.com>
>>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
G> Being a Perl 5 Cargo Cultist Copy & Paste Specialist
G> and believing yourself to be a programmer.
1. being morozilla.
2. listening to moronzilla.
3. following up to moronzilla (i am guilty)
4. some dumbass school that claims moronzilla went there
5. comp.lang.perl.moderated for not being popular enough that we could
filter out moronzilla
6. the web as that is what moronzilla thinks it the net and all perl is
good for
7. repeat ad nauseum
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 20 Sep 2000 20:39:27 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <slrn8si83s.1tk.tjla@thislove.dyndns.org>
I was shocked! How could Andrew N. McGuire <anmcguire@ce.mediaone.net>
say such a terrible thing:
>On Wed, 20 Sep 2000, Larry Rosler quoth:
>
>LR> In article <Pine.GSO.4.21.0009201131470.15465-100000@crusoe.crusoe.net>
>LR> on Wed, 20 Sep 2000 11:32:33 -0400, Jeff Pinyan <jeffp@crusoe.net>
>LR> says...
>LR> > >> 1: didn't use -w
>LR> > >> 2: didn't use strict
>LR> > >> 3: didn't test the results of an "open"
>LR> > >> 4: listened to anything godzilla said
>LR> > > 5: didn't read perldoc -f localtime
>LR> > 6: uses @array[$index] where $array[$index] should be used
>LR>
>LR> 1: uses split '|' or (less likely by far) /|/
>
>
>A couple more to potentially add:
>
> 7: Needlessly quotes ~EVERYTHING~.
> 8: Uses s/// where tr/// would be better.
8a. Uses tr/// when s/// is needed
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"Imitation is the sincerest form of television."
-- The New Mighty Mouse
------------------------------
Date: Wed, 20 Sep 2000 15:57:05 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <39C924A1.AA61CF7B@rac.ray.com>
Uri Guttman wrote:
>
> 1. being morozilla.
>
> 2. listening to moronzilla.
>
> 3. following up to moronzilla (i am guilty)
>
> 4. some dumbass school that claims moronzilla went there
>
> 5. comp.lang.perl.moderated for not being popular enough that we could
> filter out moronzilla
>
> 6. the web as that is what moronzilla thinks it the net and all perl is
> good for
>
> 7. repeat ad nauseum
>
So Uri, when is the wedding?
(Russ goes into the rope-a-dope defense)
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Wed, 20 Sep 2000 22:24:12 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <3U9y5.2124$Rk1.35465@news2-win.server.ntlworld.com>
"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn8si83s.1tk.tjla@thislove.dyndns.org...
> >LR> > >> 1: didn't use -w
> >LR> > >> 2: didn't use strict
> >LR> > >> 3: didn't test the results of an "open"
> >LR> > >> 4: listened to anything godzilla said
> >LR> > > 5: didn't read perldoc -f localtime
> >LR> > 6: uses @array[$index] where $array[$index] should be used
> >LR> 1: uses split '|' or (less likely by far) /|/
> > 7: Needlessly quotes ~EVERYTHING~.
> > 8: Uses s/// where tr/// would be better.
> 8a. Uses tr/// when s/// is needed
Drifting slightly off topic, I always - without fail - get the operands for
join(@foo, ",")[*] around the wrong way. Same problem with ln under *Nix.
Total mental block.
[*] see?
--
-=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Wed, 20 Sep 2000 17:34:27 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <39C92D63.DE30C8B2@westat.com>
Russ Jones wrote:
>
> How often have you seen the word "seldomly?"
Seldomly.
:)
--
Henry Hartley
------------------------------
Date: 20 Sep 2000 16:46:05 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <8qbb6t$ibl$1@cheddar.cs.utexas.edu>
In article <3U9y5.2124$Rk1.35465@news2-win.server.ntlworld.com>,
Glyndwr <glynFOOdwr@FSCKdeleteEmeD.co.uk> wrote:
>Drifting slightly off topic, I always - without fail - get the operands for
>join(@foo, ",")[*] around the wrong way. Same problem with ln under *Nix.
>Total mental block.
A mnemonic for the arguments to "ln" is that they work just like the
ones for "cp" and "mv". The thing on the left already exists, and the
thing on the right is what the command is going to create.
join() is a bit trickier, but it makes sense if you try to imagine
implementing join() yourself. Is this
sub join
{
my (@things, $separator) = @_;
# . . .
}
going to work out very well? Nope -- the arguments will all get sucked
into @things and $separator will be undef.
- Logan
------------------------------
Date: Wed, 20 Sep 2000 22:59:23 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <3pay5.2224$Rk1.35749@news2-win.server.ntlworld.com>
"Logan Shaw" <logan@cs.utexas.edu> wrote in message
news:8qbb6t$ibl$1@cheddar.cs.utexas.edu...
> In article <3U9y5.2124$Rk1.35465@news2-win.server.ntlworld.com>,
> Glyndwr <glynFOOdwr@FSCKdeleteEmeD.co.uk> wrote:
> >Drifting slightly off topic, I always - without fail - get the operands
for
> >join(@foo, ",")[*] around the wrong way. Same problem with ln under *Nix.
> >Total mental block.
>
> A mnemonic for the arguments to "ln" is that they work just like the
> ones for "cp" and "mv". The thing on the left already exists, and the
> thing on the right is what the command is going to create.
Yeah, I know, but I still manage to muck it up. In fact (drifting further
off topic) I did something weird today, which was this:
bash [~] ln -s Foo /usr/local/lib/site_perl/Foo
bash [~] cd /usr/local/lib/site_perl/Foo
bash [/usr/local/lib/site_perl/Foo] ls -la
(loads of files)
lrwxrwxrwx 1 rgaywood staff 8 Sep 20 14:34 Foo -> Foo
"Oopsie," I said, "I've done it the wrong way around. Best get rid of that
then."
bash [/usr/local/lib/site_perl/Foo] rm Foo
bash [/usr/local/lib/site_perl/Foo] ls -la
total 0
Somehow, the rm command blew away everything in the directory, not just the
bogus symlink. Thank heavens for sharp sysadmins with undelete programs
(thanks, Dafydd, if you're reading this :o))
I'm still puzzled as to why that happened.
> snippage
> going to work out very well? Nope -- the arguments will all get sucked
> into @things and $separator will be undef.
Hey, good call. Thanks.
--
-=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Wed, 20 Sep 2000 20:53:39 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Content-type
Message-Id: <Pine.GHP.4.21.0009202046570.15649-100000@hpplus03.cern.ch>
On Wed, 20 Sep 2000 willyboyweb@my-deja.com wrote:
> I am curious what the proper way to change or have two different
> content-types outputted from one script,
Same way as you would in any language. If you think this is a
Perl-specific question, then you're even more confused than most.
> namely image/jpeg and
> text/html.
Don't.
> I am assigning the jpeg as a scaler taken from a database
> and am not sure how to embed it in my normal text/html output.
Don't. Put IMG SRC= into the HTML and leave the client to retrieve
that. When they do so, return the image.
> Is there some way to switch between or combine these two statements.
No.[1]
Review how the WWW works. If it still isn't obvious, try some CGI
FAQs or tutorials.
[1]Trying to package several different kinds of content in the same
transaction isn't useful when the client is expecting just one
content-type per transaction. So: it's actually easy for the server
to return a MIME multipart body, but it isn't going to be of any use
in a WWW context because clients in general have no idea what to do
with it.
f'ups set
------------------------------
Date: Wed, 20 Sep 2000 12:21:22 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: fcntl
Message-Id: <39C90E32.83B087A3@ipac.caltech.edu>
Justin Wills wrote:
>
> I'm using fcntl to implement file locking for reasons which are beyond
> my control.
>
> I can happily set locks with perl, and a C program can see that the file
> is locked using the fcntl() functions as would be expected.
>
> The C prog can also detect (der) a lock created by a C fcntl() routine.
>
> the problem I am facing is that under x86 solaris (so far), I cannot get
> the return values for fcntl() when I test for the lock. all the values
> seem to come back as zeros. funilly enough, it works on a linux box
> with no dramas.
> ... [snip] ...
> $fcntl=pack("sslli");
>
> if((fcntl(LOCKFILE, &F_GETLK, $fcntl)) < 0)
You're not packing anything. Since you said the code worked under Linux that
this must be a transcription error. Please send working code.
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Wed, 20 Sep 2000 11:16:44 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: File Parsing, Skipping lines
Message-Id: <MPG.14329ee7be09e8c98ad9c@nntp.hpl.hp.com>
In article <39c8dd16.428058205@news.itn.is> on Wed, 20 Sep 2000 16:01:23
GMT, Helgi Briem <helgi@NOSPAMdecode.is> says...
...
> close BIG,$bigfile or die "Cannot close $bigfile:$!\n";
...
> close BIG,$bigfile or die "Cannot close $bigfile:$!\n";
Interesting. No warning about the superfluous second argument to
close(). Perhaps this is because the first argument is optional (which
I wasn't really aware of until I checked it).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 20 Sep 2000 12:32:48 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Hash jelp for Newbie
Message-Id: <MPG.1432b0ba68bc4cb898ada0@nntp.hpl.hp.com>
In article <mbudash-21CDE0.06325220092000@news.pacbell.net> on Wed, 20
Sep 2000 06:32:52 -0700, Michael Budash <mbudash@sonic.net> says...
> In article <39F04521.72C94A0@home.com>, Shawn and Francine
> <flsq@home.com> wrote:
...
> > print "\n\nPlease Enter Student Number: ";
> > $Number = <STDIN>;
> > print "\n\nPlease Enter Student Name: ";
> > $Name = <STDIN>;
> > %Info = (
> > $Number => $Name, #Am I missing
> > something here?
> > );
>
> this line should read:
>
> $Info{$Number} = $Name;
After chomps on $Number and $Name. Some verification might be nice, in
a real program.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 20 Sep 2000 21:49:29 +0200
From: "Jeroen Konijn" <news@jeroen.org>
Subject: Help with complex regexp
Message-Id: <8qb4ku$t8v$1@news.tudelft.nl>
Hi,
I want to replace the ; with a #, but only when it's not between two "
quotes. For example:
xxx;xxx;xxx;xxx --> xxx#xxx#xxx#xxx
xxx;"xxx;xxx";xxx --> xxx#"xxx;xxx"#xxx
I cannot figure out the right regexp to do this. A solution would be
_really_ appreciated.
Jeroen Konijn
The Netherlands
---
Operations & Developement - Remotion BV
Delftechpark 26, 2628 XH Delft, The Netherlands
(m) +31 6 20360158 (e) jeroen@remotion.nl
(t) +31 15 2600966 (w) http://www.remotion.nl
(f) +31 15 2600965
------------------------------
Date: Wed, 20 Sep 2000 20:10:23 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: Help with complex regexp
Message-Id: <PQ8y5.275776$1h3.5917897@news20.bellglobal.com>
In comp.lang.perl.misc Jeroen Konijn <news@jeroen.org> wrote:
: Hi,
Howdy,
: I want to replace the ; with a #, but only when it's not between two "
: quotes. For example:
: xxx;xxx;xxx;xxx --> xxx#xxx#xxx#xxx
: xxx;"xxx;xxx";xxx --> xxx#"xxx;xxx"#xxx
: I cannot figure out the right regexp to do this. A solution would be
: _really_ appreciated.
The solution is no more than 17 keystrokes away:
perldoc -q split
Alternatively, you could search for the article I posted not
ten minutes ago describing another way to do what you want. But
I suspect you may prefer the solution given in the FAQ. 8)
Joy,
Yanick
--
eval" use 'that poor Yanick' ";
print map{ (sort keys %{{ map({$_=>1}split'',$@) }})[hex] }
qw/8 b 15 1 9 10 11 15 c b 13 1 12 b 13 f 1 c 9 a e b 13 0/;
------------------------------
Date: Wed, 20 Sep 2000 22:28:36 +0200
From: "Jeroen Konijn" <news@jeroen.org>
Subject: Re: Help with complex regexp
Message-Id: <8qb6tq$124$1@news.tudelft.nl>
> The solution is no more than 17 keystrokes away:
>
> perldoc -q split
@new = ();
push(@new, $+) while $text =~ m{
"([^\"\\]*(?:\\.[^\"\\]*)*)",? # groups the phrase inside the
quotes
| ([^,]+),?
| ,
}gx;
push(@new, undef) if substr($text,-1,1) eq ',';
Yeah, I already noticed it. But I have to put in somewhere in a PHP script.
Like:
$dummy = ereg_replace($ereg_string, $text);
The question remains how, since I know almost nothing about perl.
Jeroen Konijn
The Netherlands
------------------------------
Date: Wed, 20 Sep 2000 20:46:14 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: Help with complex regexp
Message-Id: <qm9y5.275792$1h3.5917897@news20.bellglobal.com>
In comp.lang.perl.misc Jeroen Konijn <news@jeroen.org> wrote:
:> The solution is no more than 17 keystrokes away:
:>
:> perldoc -q split
<snip output of perldoc -q split>
: Yeah, I already noticed it. But I have to put in somewhere in a PHP script.
: Like:
: $dummy = ereg_replace($ereg_string, $text);
: The question remains how, since I know almost nothing about perl.
I will probably ask something very stupid here, and you have my
permission to laugh at my naivete, but in a PHP script shouldn't you
program in, well, PHP?
Joy,
Yanick
--
eval" use 'that poor Yanick' ";
print map{ (sort keys %{{ map({$_=>1}split'',$@) }})[hex] }
qw/8 b 15 1 9 10 11 15 c b 13 1 12 b 13 f 1 c 9 a e b 13 0/;
------------------------------
Date: Wed, 20 Sep 2000 23:48:44 +0200
From: "Jeroen Konijn" <news@jeroen.org>
Subject: Re: Help with complex regexp
Message-Id: <8qbbl2$3bu$1@news.tudelft.nl>
> : Yeah, I already noticed it. But I have to put in somewhere in a PHP
script.
> : Like:
>
> : $dummy = ereg_replace($ereg_string, $text);
>
> : The question remains how, since I know almost nothing about perl.
>
> I will probably ask something very stupid here, and you have my
> permission to laugh at my naivete, but in a PHP script shouldn't you
> program in, well, PHP?
Sure. As I said, I'm now how it can be done in Perl. But since I have to use
a regexp-string because of PHP, I'm looking for a way to do this. How do I
transform the Perl-snippet into a nice regexp string that will do the same
thing - if this is possible.
Jeroen
------------------------------
Date: Wed, 20 Sep 2000 19:45:20 GMT
From: ktracho@my-deja.com
Subject: Re: Help with Date
Message-Id: <8qb449$eb9$1@nnrp1.deja.com>
In article <8q783u$f06$1@gxsn.com>,
"Keat" <Keat@beal.org.uk> wrote:
> I am having problems with links.pl. I am trying to get it to display
the
> correct date, but no matter what I try it still thinks this year is
year
> 19100, Does anyone have any Ideas. Below is the section I believe
controls
> the date.
>
> if ($line =~ /<!--time-->/) {
> @months = ('January','February','March','April','May','June',
> 'July','August','September','October','November','December');
>
> @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday',
> 'Friday','Saturday');
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday) =
> (localtime(time))[0,1,2,3,4,5,6];
> if ($sec < 10) { $sec = "0$sec"; }
> if ($min < 10) { $min = "0$min"; }
> if ($hour < 10) { $hour = "0$hour"; }
> if ($mday < 10) { $mday = "0$mday"; }
> $date = "on $days[$wday], $months[$mon] $mday, 19$year at
> $hour:$min:$sec";
> print FILE "<!--time--><b>Last use was added $date</b><hr>\n";
>
> Ive tried adding $year = -100; but this just displays 19100-100, Ive
also
> tried adding a line
> if ($year< 99) { $year= "20$year"; -100}, but this doesnt work either.
>
> As accomplished perl scripters will have noticed, I know nothing about
Perl,
> any info would be greatly appreciated.
>
> Keaton Roebuck
> please reply via email
>
> Keat@beal.org.uk
>
>
Keaton,
Maybe you could use a module named "Date::Manip" from www.cpan.org.
I also had many problems manipulating dates and believe me, this module
makes it a lot easier.
BR,
GReyes
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 20 Sep 2000 20:50:01 GMT
From: lullaby25 <lullaby25@my-deja.com>
Subject: Re: HELP! Problem returning info from shell call
Message-Id: <8qb7tg$j1p$1@nnrp1.deja.com>
I should have been a little more specific. The program that i am tryign
to run from the shell call is running, and I have information that is
supposed to be returning to the calling program using standard out (ex.
I call a batch file from my main script and it uses an echo line to
return some variable). My problem is that that information is not
getting back to my main program. I don't know how to configure the
standard out, and I don't believe that it is buffering anywhere. I
haven't worked too much with environmental variables, so I am not sure
if this is the problem. Thanks for your input. :)
Melissa
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 20 Sep 2000 18:50:30 GMT
From: Randy <randy_734@my-deja.com>
Subject: Re: How do I shut down an oracle database from perl script
Message-Id: <39c90678.17104890@207.126.101.100>
If you are using Oracle 8, you can safely bring down the database by
stopping the OracleServiceSID service. I am using StopService with
good results.
"orassilv" <ssilv@rochester.rr.com> wrote:
>I am trying to shutdown an Oracle database.
>In unix I would have in my bourne shell script the following:
>
>ORACLE_SID=abcd; export ORACLE_SID
>svrmgrl <<EOF
>connect internal
>@some_sql_script
>shutdown immediate
>exit
>
>I have tried this in perl - no good - any ideas how to do this for
>perl/nt4.0?
>
>
>Thanks,
>orassilv
>
>
------------------------------
Date: Wed, 20 Sep 2000 19:07:46 GMT
From: nickysantoro@my-deja.com
Subject: how to accept unknown # of parameters in cgi?
Message-Id: <8qb1tf$bai$1@nnrp1.deja.com>
I am creating a web ordering form that has many rows of input,
although the user may only submit one, or they could submit 20
items. How do i be efficient in the perl script to process these
parameters only if they are submitted, given that I need to declare
the variables for each one?
Thanks
NS
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 20 Sep 2000 14:54:49 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: how to accept unknown # of parameters in cgi?
Message-Id: <39C91609.2643E595@rac.ray.com>
nickysantoro@my-deja.com wrote:
>
> I am creating a web ordering form that has many rows of input,
> although the user may only submit one, or they could submit 20
> items. How do i be efficient in the perl script to process these
> parameters only if they are submitted, given that I need to declare
> the variables for each one?
>
CGI.pm can tell you the names of all the parms submitted to your
script. See "perldoc CGI" and look for @names = $query->param
hth hand so long it's been good to know you.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: 20 Sep 2000 17:46:46 -0400
From: Dave <dmeyers@panix.com>
Subject: Re: how to accept unknown # of parameters in cgi?
Message-Id: <yobwvg6ka7t.fsf@panix3.panix.com>
Russ Jones <russ_jones@rac.ray.com> writes:
> nickysantoro@my-deja.com wrote:
> > I am creating a web ordering form that has many rows of input,
> > although the user may only submit one, or they could submit 20
> > items. How do i be efficient in the perl script to process these
> > parameters only if they are submitted, given that I need to declare
> > the variables for each one?
> CGI.pm can tell you the names of all the parms submitted to your
> script. See "perldoc CGI" and look for @names = $query->param
It seems that the OP means that all the fields (20 x however
many fields go with each potential order line) will be passed
as one form.
If the params are all named something sensible
(perhaps item_01 .. item_20), you can easily loop
through them and ignore the empties, though by
default they will all be passed in.
Now why you'd actually declare each one an individual
variable, though, is an entirely different question,
when you have such convenient tools as lists, loops,
hashes, etc. at your disposal.
--d
--
dmeyers@panix.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 4388
**************************************