[6805] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 430 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 5 06:07:21 1997

Date: Mon, 5 May 97 03:00:20 -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, 5 May 1997     Volume: 8 Number: 430

Today's topics:
     Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-p <B.P.Fowler@rack.demon.co.uk>
     Re: a question on striping characters (Chipmunk)
     Compiling curseperl and oraperl questions!! (Keleen Kuo)
     Re: File Descriptors (Jordyn A. Buchanan)
     Re: How to use perl to fill up a web form and save resu (Brian Lavender)
     Re: Loosing clpm regulars (was Re: Perl auto-replier) <merlyn@stonehenge.com>
     MANCGI: a centralized multi hosts unix MAN cgi utility <lele@mantegna.casaccia.enea.it>
     Re: need help w/forms and Perl (Abigail)
     Re: Newbie confused by all those slashes (Tad McClellan)
     Perl 5.003 ELF and Linux <jroemer@spiderpub.com>
     Re: Perl auto-replier (Chipmunk)
     Re: Perl-Books. (arnie sherman)
     Re: PERL::ODBC (Brian Jepson)
     Re: Pointing a Filehandle _AT_ a Subroutine <chaim@nlk.nlk.com>
     Re: space efficiency of arrays? (Jonathan C. Willeke)
     Re: space efficiency of arrays? (Steffen Beyer)
     Re: Substituting multiple lines <stephen+usenet@farrell.org>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 04 May 1997 06:01:23 +0000
From: "B.P.Fowler" <B.P.Fowler@rack.demon.co.uk>
Subject: Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-process,programmer,regex}
Message-Id: <336C25C3.7AE5@rack.demon.co.uk>


> clpm will still be there for:
> 
> 1) re-asking of Frequently Asked Questions, ensuring that the 'F'
>    in FAQ is accurate ;-)
> 
> 2) philosophical debates not at all related to Perl.
> 
> 3) asking of off-topic CGI questions.
> 
> 4) advertisements
> 
> 5) flaming of regulars by first time posters
> 
> Which would seem to cover 80-90% of the postings recently...

Most, if not all of this may have been intended tongue in cheek,
but I think we should accept that the .misc in the title is a magnet
for miscellania of this kind!

We must have some change unless c.l.p really want this situation
to continue. Possible solutions include the creation of groups that
encourage correct posting of questions that we want, such as
c.l.p.programmer [in due course people may ask for c.l.p.p.info, 
c.l.p.p.help, c.l.p.p.tools, c.l.p.p.misc], the creation of groups
for the diversion of posts that we do not want such as 
c.l.p.cgi, c.l.p.jobs, comp.lang.perl.d; and the moderation of
existing groups. If there were a c.l.p.m.moderated there could be no
question of censorship if there were also an alt.lang.perl.* hierarchy
and c.l.p.m were retained.

I am in favour of the current proposals.

Ben


------------------------------

Date: 5 May 1997 04:57:03 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: a question on striping characters
Message-Id: <5kjpav$btb$2@dartvax.dartmouth.edu>

In article <dwwpixaw0.fsf@s3i.com>
Clark Dorman <dorman@s3i.com> writes:

> #!/home/dorman/bin/perl -w
> 
> $bar = $foo = "I_LIKE_THE_NUMBER_9_AND_THE_NUMBER_12";
> $bar =~ s/[^\d]+/ /g;
> @baz = split(' ',$bar);
> print " ($foo) ($bar) (@baz) ($#baz)\n";
> 
> Note the space in the substitution for split to work on.  I'm still
> learning this stuff so feel free to correct it.  

Clever idea with the space there.  One problem I see is that @baz will
contain a null value if $bar begins or ends with non-digits.  That
won't matter for the print statement, but could be significant if other
things are being done to the array.
One way to solve that problem would be to add:
$bar =~ s/^ | $//g;
after the original substitution.

BTW, the first argument to split should be a regexp: split(/ /, $bar);

Chipmunk


------------------------------

Date: Mon, 05 May 1997 07:56:38 GMT
From: uckuo@king.mcs.drexel.edu (Keleen Kuo)
Subject: Compiling curseperl and oraperl questions!!
Message-Id: <336d8a5a.12759196@king.mcs.drexel.edu>

Hello Folks :-)

If you have compile curseperl or oraperl in a HP-UX machine or know
the following problems, please give me some advices for the following
problems.

Thank you in advance for your help!!! :->



Keleen


-----------------------------------------------------------------------------------------------------
Platform:
babbage 100: uname -a
HP-UX babbage A.09.01 A 9000/715 2010402183 two-user license

-----------------------------------------------------------------------------------------------------
Compiling Problem 1:
In a HP-UX machine, when I tried to compile curseperl under usub
directory, I got following output.

babbage 156: make
        cc -c -I..  -DDEBUGGING -g usersub.c
        mus curses.mus >curses.c
        cc -c -I..  -DDEBUGGING -g curses.c
        cc ../uperl.o usersub.o curses.o -lcurses -ltermlib `.
 ./config.sh; echo $libs` -o curseperl
/bin/ld: Unsatisfied symbols:
   touchline (code)
*** Error code 1

Stop.


However, I had no problem for compiling perl4.036!!

-----------------------------------------------------------------------------------------------------
Compiling Problem 2:
when I tried to compile oraperl version 2.24, I got following output.

babbage 168: make
        /tmp/mah/perl/usub/mus oracle.mus >oracle.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c oracle.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c orafns.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c
getcursor.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c colons.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c debug.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c strtoul.c
        cc -Idbug -I/tmp/mah/perl      -DPERL_DEBUGGING   -c usersub.c
        cc -o oraperl /tmp/mah/perl/uperl.o oracle.o orafns.o
getcursor.o colons.o debug.o strtoul.o usersub.o dbug/dbug.o
\
              -lm `cat /users/oracle/rdbms/lib/sysliblist`
/users/oracle/lib/libocic.a /users/oracle/lib/osntab.o
/users/oracle/lib/libsqlnet.a  /users/oracle/lib/libora.a `.
/tmp/mah/perl/config.sh; echo $libs`
/bin/ld: Unsatisfied symbols:
   limopen (code)
   lmemup (code)
   ligncc (code)
   licbas (data)
   ligraw (data)
   lmsrtrm (code)
   liclas (data)
   lmemlcmp (code)
   limpuc (code)
   osnqig1 (code)
   liwalpx (code)
   lmsrcbn (code)
   lmsrip (code)
   ldtsto (code)
   osnqrn (code)
   ligstm (code)
   limc2wx (code)
   lintrn (code)
   sslsleep (code)
   liwdigx (code)
   sltbev (code)
   limr2w (code)
   lihcsn (code)
   ligratio (code)
   lstrlcomp (code)
   lihcrenv (code)
   liwlowx (code)
   sldtgd (code)
   lihci2h (code)
   lmemlcomp (code)
   lihlinfo (code)
   limfwdx (code)
   lmsrcin (code)
   liwc2mx (code)
   ligpth (code)
   ldtini (code)
   lihcurrlangid (code)
   btoi (code)
   liiskip (code)
   lircop (code)
   lmsrgbf (code)
   limalpx (code)
   limnceq (code)
   lnmscn (code)
   ldtdts (code)
   liwctex (code)
   lmemlo (code)
   liwc2ux (code)
   lircpu (code)
   limspax (code)
   lnmren (code)
   limdigx (code)
   lnmnur (code)
   limcpcx (code)
   debug (data)
   sslsig (code)
*** Error code 1

Stop.
-----------------------------------------------------------------------------------------------------



------------------------------

Date: Sun, 04 May 1997 12:33:37 -0400
From: jordyn@bestweb.net (Jordyn A. Buchanan)
Subject: Re: File Descriptors
Message-Id: <jordyn-ya02408000R0405971233370001@nntp.bestweb.net>

"A. Mishra" <mishra.aditya@emeryworld.com> wrote:

> Why can I open only 251 file descriptors with perl when the
> system limit is 1024/process.Actually these descriptors happen
> to be sockets.
> 
> I running perl on Sun Solaris 2.5.1
> 
> Any suggestion will be appreciated.

Just a thought:

Your shell usually puts limits on these things.  Have you used something
like ulimit (sh) or limit (csh) to raise the shell's default limit?

Jordyn

|---------------------------------------------------------------|
|Jordyn A. Buchanan                           jordyn@bestweb.net|
|Bestweb Corporation                      http://www.bestweb.net|
|Senior System Administrator                     +1.914.271.4500|
|---------------------------------------------------------------|


------------------------------

Date: Sun, 04 May 1997 04:46:30 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: How to use perl to fill up a web form and save result in a file?
Message-Id: <336c1353.13165004@nntp.netcruiser>

Copy posted on newsgroup comp.lang.perl.misc and sent to author.

Check out Randall Schwartz's Web Techniques column 3. He does exactly
what you are talking about. He sends the output to the browser with
all the results, but just take it, use the HTML parser from LWP and
save the results to a file. That is if you want text.  If you want
html then save the results to a file instead of STDOUT. The address of
the column is

http://www.stonehenge.com/merlyn/WebTechniques/col03.html

Brian
----------------
Brian Lavender
Brie Web Publishing
Owner
Napa, CA
(707) 226-8891

Brie Business Directory - Napa Valley      http://www.brie.com/bbd 

"Sometimes our only obstacle is the one in our minds."

On Fri, 02 May 1997 17:19:31 GMT, li@globalserve.net (Alex Dong Li)
wrote:

>Hello, there,
>
>I would appreciate it if anyone can tell me where I can find a sample or
>solution to do so:
>Use a program in perl to access a remote web searching machineand save results 
>as local files automatically.
>
>Normal way is to use netscape to fill out the form and save results manually. 
>but I do not want to use netscape to do so.
>
>Thanks a lot!
>
>Alex

----------------
Brian Lavender
Napa, CA
Brie Business Directory - Napa Valley     http://www.brie.com/bbd 
(707) 226-8891

"The world is a good place if you are in a good position."


------------------------------

Date: 04 May 1997 08:36:11 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: sb@en.muc.de
Subject: Re: Loosing clpm regulars (was Re: Perl auto-replier)
Message-Id: <8cpvv7dzbo.fsf@gadget.cscaper.com>


>>>>> "Steffen" == Steffen Beyer <sb@en.muc.de> writes:

Steffen> Another guy in this thread (sorry, I didn't memorize your
Steffen> name!) had a great idea too: Why not create a newsgroup
Steffen> called "comp.lang.perl.wizards" to attract all the people who
Steffen> go for glitter away from the newsgroups where the non-trivial
Steffen> issues are discussed?

Steffen> But I suppose Netiquette wouldn't allow such a big bluff...

No, the problem is that such a title becomes a big "newbie magnet"...
Newbie says, "gee, my question is REALLY TOUGH [for me] and I want the
most ACCURATE answer... I guess I should go ask a WIZARD!"

comp.unix.wizards was the first spectacular failure of this kind.
Eventually it got reformulated as a moderated group.

Automoderation (ala ciaw.cgi) seems to be the only way to go, unless
we got a zillion volunteers.  This is one of the projects that The
Perl Institute is interested in managing and assisting with, but it
has been falling below the TPI resource cutline for the last few
months, sadly.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 485 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: Mon, 05 May 1997 09:31:01 +0200
From: lombardi emanuele <lele@mantegna.casaccia.enea.it>
Subject: MANCGI: a centralized multi hosts unix MAN cgi utility
Message-Id: <336D8CB5.41C6@mantegna.casaccia.enea.it>

I've made a cgi for getting manual pages from various hosts.
The man pages are translated 'on the fly' using a modified version of
man2html (version 2.1.0 of Earl Hood, ehood@convex.com) I called
man2html4cgi

As initial page the cgi presents an help page which can rediplayed
pressing the ? button later.

The user can ask for man pagea or for the man -k (apropos)
informations. In any case all the references to other man pages are 
coverted into hyper link and the user can navigate on the man pages.

The user can select from wich host ask the man informations. 
Of course that implies that user running the web-server has granted some
remote access (via .rhosts) to some other machine. 
If this appens then from the web browser you can select which machine
ask
for the man pages.

All this stuff is usefull for having a single web browser to get all 
the man info about all the machine (and operating systems) you work on!

WHERE TO GET IT: ftp://mantegna.casaccia.enea.it/lele/mancgi.tar.gz

PREREQUISITES:  UNIX
                perl    v5.0    or later
                CGI.pm  v2.29   or later

INSTALL:
                mancgi.README   this file
                mancgi.pl       to be installed in /cgi-bin
                man2html4cgi    to be installed in /cgi-bin
				
NOTES:
                the user running the web-server must have sh as login
shell
                Not any other shell due to the redirection of std-err
                made as 2&1 in mancgi.pl

USAGE:          http://your.server.domain:/cgi-bin/mancgi.pl

TESTED:         netscape communication server running on Digital UNIX
4.0
                remote hosts:   SUNOS 4.1.3
                                CRAY
                                DIGITAL ALPHA SERVER & STATIONS



Enjoy it!
Emanuele Lombardi

I really apreciate comments, suggestions and bug report:
 mailto://lele@mantegna.casaccia.enea.it


-- 

+--------------------------------------+ 
|                                      | Emanuele Lombardi
|                                      | mail: 	ENEA AMB-CLIM-NUM
|                                      | 	I-00060 S.M. di Galeria (RM) 
|                          \\\\/       |        ITALY
|			    O-O	       |
|     _\\|//_ 		     |         |
|    (' O-O ')               -         | email:
lele@mantegna.casaccia.enea.it
|---ooO-(_)-Ooo--------                | tel	+39 6 30483366
|                                      | fax	+39 6 30483591
| Oh no, why has my screen gone blank? |
|                                      |
+--------------------------------------+


------------------------------

Date: Sun, 4 May 1997 10:39:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: need help w/forms and Perl
Message-Id: <E9nK9y.6ML@nonexistent.com>

On Sat, 03 May 1997 22:33:09 -0400, Peter Wood wrote in
comp.infosystems.www.authoring.html,comp.infosystems.www.authoring.misc,comp.lang.perl.misc URL: news:peter.wood-ya023580000305972233090001@n5.supernews.com:
++ Hello,
++ 
++ I am working on a project in which I have a list of service orders for our
++ company.  This is a list in table form, with each row representing a
++ specific service order, with information on service order number, customer,
++ description, etc.

This doesn't seem to be Perl.

++ I am using Perl right now, because that's what I know.
++ 
++ What I would like to do is have two buttons next to each row - one called
++ "modify" and one called "close" - which would do the appropriate actions on
++ service orders.  Also there would be a button at the bottom to open a new
++ service order.  

There are no buttons in Perl.

++ This is the intended final form anyway.  
++ 
++ The way I have it now is this:  Each entry in the list has a radio button
++ next to it, where the value of the button is the service order number,
++ which is coded into the button when the HTML is generated from a raw data
++ file.  These buttons are one set of buttons named "thenum."  Then, at the
++ bottom, there is another set of radio buttons named "userchoice."  The
++ users selects either modify, close, or open.  After selecting one of these,
++ and "thenum" of the service order number above, they submit the form.  The
++ script takes the "userchoice" and decides what form to send the user to
++ next, passing "thenum" along with it to be placed into the appropriate spot
++ on the form.

Still no Perl.

++ This works pretty much as it should.  However, it's really supposed to be a
++ one-click approach.  What I want to know is, how can I do this?  Is there
++ anyway I can have a single-clickable button that is encoded with two
++ values, so that rather than using three clicks, a user would look at the
++ list, click a button, and be taken away?

One doesn't click in Perl.

++ I know this might sound complicated but it is important, and right now, I'm
++ stuck with the clumsy three-click approach.
++ 
++ I have considered JavaScript, but right now I'm more concerned with getting
++ the project done, and don't have time to learn a new language.

But you haven't uttered a single word of Perl yet.

++ Anyone with words of wisdom is welcome to submit them to my email address. 
++ I can try and give you a more detailed description.  I might be able to
++ provide you with some code portions, but not all...got to keep at least one
++ or two industrial secrets, eh? :)

You ask a non-Perl question in a Perl group. You refuse to give a
fragment of your trivial code due to some secrets, but you got Perl,
CGI *and* HTML (all three completely open) for free, and you don't
intend to pay anyone giving an answer, and on top of that you request
an private answer in stead of one in the group?

That's many major violations of nettiquette.


Go away.



Abigail
-- 
    Anyone who slaps a "this page is best viewed with Browser X" label
    on a Web page appears to be yearning for the bad old days, before the
    Web, when you had very little chance of reading a document written on
    another computer, another word processor, or another network.
	    [Tim Berners-Lee in Technology Review, July 1996]


------------------------------

Date: Sat, 3 May 1997 23:03:44 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie confused by all those slashes
Message-Id: <0r1hk5.dm3.ln@localhost>

Eric Bohlman (ebohlman@netcom.com) wrote:
: Tad McClellan (tadmc@flash.net) wrote:
: : I'm most certainly not a Perl guru, but I'll answer it anyway ;-)

: : if ( $values[2] =~ /$prodname/ )   ...

: : =~  "binds" the string to search in ($values[2]) to the
: : pattern to search for (/$prodname/).

: Surely you meant
:   if ( $values[2] =~ /\Q$prodname\E/ ) ...


If had, I wouldn't have typed those two extra characters (\E)  ;-)


: so that a query for "Microsoft Visual P++" would match properly.



I took into account the level of question I was answering, 
and didn't add sensible features that would have obscured
the point.

(which was basically how to _do_ a pattern match in the first place)

Refinements are expected to be applied eventually, but walking comes
before running.



If it was meant to be production code, rather than teaching code,
then I would have used:


if ( $values[2] =~ /\b\Q$prodname\E\b/ )



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Sun, 04 May 1997 11:18:52 -0500
From: "J. Roemer" <jroemer@spiderpub.com>
Subject: Perl 5.003 ELF and Linux
Message-Id: <336CB6EC.50E3@spiderpub.com>

Could somebody please direct me to the
Perl 5.003 ELF package for Linux?
I'm running Redhat 3.0.3, and I wish
to upgrade my version of Perl.

Thanks much!

Jim Roemer


------------------------------

Date: 5 May 1997 00:08:20 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Perl auto-replier
Message-Id: <5kj8dk$2g$1@dartvax.dartmouth.edu>


In article <fl_aggie-ya02408000R2904971553110001@news.fsu.edu>
fl_aggie@hotmail.com (I R A Aggie) writes:

> Next time I'm inclined to be snide, I'll just drop the post on the
> floor and ignore the question.
> 
> And that gains us what, exactly? Especially if a question goes unanswered?

Apparently you see two options:
1) Respond rudely
2) Ignore the question

There is a rather obvious third option which you've somehow managed to
overlook, which is:
3) Reply politely

> Then the clueless poster may whine about how s/he posted here and didn't
> get an answer and that its the newsgroup (and the inhabitants thereof)
> RESPONSIBILITY to answer questions.
> 
> Its better to be snide, or even rude, if the clueless *LEARN* something.
> Condescendsion is typically resented. Maybe the next time, they'll try
> to avoid it and ACTUALLY USE THE FINE MANUAL and LEARN SOMETHING ON THEIR 
> OWN!

Now you assume that they will only learn something if you reply rudely.
 Perhaps if you politely directed them to the documentation or the
appropriate newsgroup?

Your argument seems analogous to this one:
If someone bumps into me on the street, I should punch them.  Sure,
it's rude, but at least they'll learn not to bump into me anymore.

The ends don't justify the means.

Chipmunk


------------------------------

Date: Sun, 04 May 1997 05:33:07 GMT
From: arnie@diac.com (arnie sherman)
Subject: Re: Perl-Books.
Message-Id: <336c1f36.9924437@news.diac.com>

>In article <33526444.61D@absyss.fr>, Douglas Seay <seay@absyss.fr> wrote:
>
>> Randal Schwartz wrote:
>> > Perl is a powerful tool in the hand of an expert.  A beginner might
>> > have some difficulty.  Best to stay for a while with some toy
>> > language, like Visual Basic or TCL. :-)
>> 
>> Cold.  That was very cold.
>
actually, c might be a more reasonable place to start...

randall can be cold, it's ok...
***********************************************************************
arnie sherman
arnie@diac.com
http://www.diac.com/~arnie
***********************************************************************
	"paradise is exactly like where you are right now,
	only much, much better"
				- laurie anderson
***********************************************************************


------------------------------

Date: 4 May 1997 05:12:43 GMT
From: bjepson@bjepson.ids.net (Brian Jepson)
Subject: Re: PERL::ODBC
Message-Id: <slrn5ml4hi.7q.bjepson@bjepson.ids.net>

In article <01bc57d3$401894c0$2a54eccd@default>, Brian Shepard wrote:
>
># Does anybody see the problem with the following script. It is not
>inserting any values into the table. I am not getting an error and when I
>use the dumperror method I do not get a error. I am using Microsoft Access
>for a database with NT. Any help would be appreciated.
>
[...]

># The problem is with the insert into. It is not inserting the value into
>the table. I have checked the database locally for data.
>
>$x = 'testing';
>$o->sql("insert into temptable values ($x)");
[...]

You might want to try:

  $x = 'testing';
  $o->sql("insert into temptable values ('$x')");

Did you try checking for an error immediately after this statement?
I'm surprised it didn't complain, as I'm pretty sure you need to 
delimit strings within the statement.

Hope this helps,

-- 
Brian Jepson * (bjepson@ids.net)  *  http://www.ids.net/~bjepson
  Int(ra|er)net Database Developer, Author, Crypto-Fluxologist
Non-Prophet Arts Technology Flux:      http://www.ids.net/~as220
WWW/Database/NT,Java/Database: http://www.ids.net/~bjepson/books



------------------------------

Date: 04 May 1997 00:30:06 -0400
From: Chaim Frenkel <chaim@nlk.nlk.com>
To: Tobias Zimmerman <automan@umich.edu>
Subject: Re: Pointing a Filehandle _AT_ a Subroutine
Message-Id: <m3wwpfrh9t.fsf@nlk.nlk.com>

>>>>> "TZ" == automan  <automan@umich.edu> writes:

    TZ> Anyway, disclaimer aside, What I'd like to do is to create a
    TZ> filehandle to a pseudo-pipe that is really a subroutine
    TZ> internal to my script.

    TZ> In otherwords, I could write a little perl program to print
    TZ> files to a local printer via an Ascii command to the terminal
    TZ> like so:

Please look at the section on open in perlfunc specifically at
"|-" and "-|" indicators.

To quote...

	If you open a pipe on the command "-", i.e. either "|-" or
	"-|", then there is an implicit fork done, and the return
	value of open is the pid of the child within the parent
	process, and 0 within the child process.  (Use defined($pid)
	to determine whether the open was successful.)  The filehandle
	behaves normally for the parent, but i/o to that filehandle is
	piped from/to the STDOUT/STDIN of the child process.  In the
	child process the filehandle isn't opened--i/o happens from/to
	the new STDOUT or STDIN.  Typically this is used like the
	normal piped open when you want to exercise more control over
	just how the pipe command gets executed, such as when you are
	running setuid, and don't want to have to scan shell commands
	for metacharacters.  The following pairs are more or less
	equivalent:

An off the cuff outline.

	$pid = open(CHILD, "|-");	# Ignoring errors
	if (0 == $pid) {
		# In the child

		while(<STDIN>) {
			# do child like processing
		}

		# Exit so we don't run parent side code.
		# Please be warned that exit() may cause
		# duplicated output, due to unflushed buffers
		exit(0);
		# or you could try: exec "/bin/true";
		# which under unix will throw everything in your
		# process away.
	}

	# Do parent like things here
	while(...) {
		print FOO ...
	}

	exit(0);

<chaim>
-- 
Chaim Frenkel					Nonlinear Knowledge, Inc.
chaimf@cris.com						 +1-718-236-0183


------------------------------

Date: Sun, 04 May 1997 05:27:31 GMT
From: jwilleke@ix.netcom.com (Jonathan C. Willeke)
Subject: Re: space efficiency of arrays?
Message-Id: <336c1af4.76237848@nntp.ix.netcom.com>

jwilleke@ix.netcom.com (Jonathan C. Willeke) wrote:

>Here's my question: have I saved any space in doing so?  In C, an
>array is a space in memory with a fixed number of elements, each with
>a fixed size.  I don't understand Perl arrays: the length is increased
>as needed, and each element can hold a scalar value of any size.

I'm posting this additional question before having seen any responses.
I've decided to try using an array of bit fields.  (I realized how
much space I'm wasting when I read, at
www.doge.nl/~avdhorst/avdhorst.html, that someone had written a sieve
that "packs all the 16-bit primes in slightly over 2 Kbyte".)

Now that I'm learning about bit operations, I wonder to what extent I
can rely on the precision of integers.  I believe the Camel book says
32 bits, 64 bits on some machines.  I initialize a 32-bit field to 1s
by saying

    $bit_field = 2**33 - 1;

Will this result in overflow on some machines?  If so, then I should
change to 31-bit fields.  Thanks in advance for responses.

--Jon

Jon Willeke <jwilleke@ix.netcom.com>


------------------------------

Date: 4 May 1997 11:14:00 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: space efficiency of arrays?
Message-Id: <5khr1o$77g$1@en1.engelschall.com>

[Courtesy CC: mail sent to cited author]

Jonathan C. Willeke <jwilleke@ix.netcom.com> wrote:

> In writing a function to return a list of primes less than or equal to
> given number, it occurred to me that it was possible to sacrifice a
> little speed to save on space.

> Using a sieve of Eratosthenes, my original approach was to use a
> linear array with a one-to-one mapping of array indices to the numbers
> in question.

If you want to be faster AND save a maximum of memory, get my "Bit::Vector"
module from http://www.engelschall.com/u/sb/download or any CPAN ftp server
and look into the demo program "primes.pl" which does exactly what you want.

(It also uses the sieve of Erathostenes)

Hope this helps!

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


------------------------------

Date: Mon, 5 May 1997 05:51:06 GMT
From: stephen farrell <stephen+usenet@farrell.org>
Subject: Re: Substituting multiple lines
Message-Id: <87207m79h1.fsf@phaedrus.uchicago.edu>

k113973@cc.tut.fi (Kilpilinna Sami) writes:

s/<TD.*\/TD>//s

(p. 67 in Programming Perl 2ed)

--steve farrell

> Hello guys,
> 
> I have a small real life problem which many of you can solve
> easily, I'm sure. I have a large number of HTML files and each
> of them has, among other things, these four lines of code:
> 
> 
> <CENTER><TABLE WIDTH=97%><TR><TD ALIGN=left>
> <A HREF=../menu.html onMouseOver="window.status='Go to
> menu'; return true"><IMG SRC=../../icons/menu.gif WIDTH=30
> HEIGHT=30 BORDER=0></A>
> </TD>
> <TD ALIGN=right>
> 
> 
> Now, I would like to cut out this part: 
> 
> <TD ALIGN=left>
> <A HREF=../menu.html onMouseOver="window.status='Go to menu'; return true"><IMG SRC=../../icons/menu.gif WIDTH=30 HEIGHT=30 BORDER=0></A>
> </TD>
> 
> Which means that these things remain:
> 
> <CENTER><TABLE WIDTH=97%><TR>
> <TD ALIGN=right>
> 
> So, how to do this with Perl (5.x)? I'd know how to remove
> code from one line (Something like perl -pi -e
> 's/whatever//g;' *html) but it doesn't handle multiple
> lines.
> 
> Oh, and if anyone knows a program for PC which does this
> kind of things, let me know.
> 
> Thanks,
> 
> Sami


------------------------------

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 430
*************************************

home help back first fref pref prev next nref lref last post