[19362] in Perl-Users-Digest
Perl-Users Digest, Issue: 1557 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 18 06:10:27 2001
Date: Sat, 18 Aug 2001 03:10:12 -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: <998129411-v10-i1557@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 18 Aug 2001 Volume: 10 Number: 1557
Today's topics:
Re: perldoc is like Greek to a beginner?? <bernie@fantasyfarm.com>
Re: permuting extremely large string <iltzu@sci.invalid>
Please help in Regular expression question!! <eric138@yahoo.com>
Re: Please help in Regular expression question!! <jurgenex@hotmail.com>
Re: Processing a scalar in the same way of a filehandle (Eric Bohlman)
Re: redirecting stdin and stdout <bkennedy99@Home.com>
Re: redirecting stdin and stdout (Tad McClellan)
Re: redirecting stdin and stdout <ahorvath@cyberjus.com>
Re: removing trailing and leading blanks <dbe@wgn.net>
Search the pattern with Perl Regular Expression <eric138@yahoo.com>
Re: Self-Searchable Perl documention - Extremely Useful (David Combs)
Re: Simple Problem <dscarlett@optushome.com.au>
Re: SOAP::Transport and forking servers... how to do it <landman@localhost.localdomain>
Re: Update: (Perl) programming contest loosely based on <iltzu@sci.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 18 Aug 2001 00:14:01 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <2pqrnt4jf7nhuthkng0r17kvepju3v30gf@news.supernews.net>
abigail@foad.org (Abigail) wrote:
} Could you give examples from some well known languages, like C, Java
} and ADA that proves they are not truely context free?
How about something like:
---------------------
typedef int x ;
x *y();
---------------------
Does it parse into an expression with a function call, or a declaration?
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: 18 Aug 2001 04:20:20 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: permuting extremely large string
Message-Id: <998108038.18300@itz.pp.sci.fi>
In article <Pine.LNX.4.33.0108091115180.2586-100000@schewanella.stanford.edu>, Les Ander wrote:
>Hi,
>i need to permute a string which is about 4 Mb!
>I experience memory problems if i convert it to an array (the program
>crashes). So I need to permute the string inplace without converting
>it into an array.
Wow! A practical task where Tie::CharArray is actually useful!
use Tie::CharArray;
tie my @chars, 'Tie::CharArray', $string;
# now permute @chars with the standard Fisher-Yates shuffle
I knew when I wrote that module that someone, someday, would find a real
use for it. It seems the day has finally come. :-)
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Sat, 18 Aug 2001 12:31:55 +0800
From: "Eric Chow" <eric138@yahoo.com>
Subject: Please help in Regular expression question!!
Message-Id: <9lkqkg$ih33@ctmsun0.macau.ctm.net>
Hello,
Would you please to teach me how can I get the following result with Regular
Expression ?
data.txt
===================================================
<small><font color=red size=20>Hello World</font></small>
<small><font color=blue size=22>I am Eric</font></small>
===================================================
The above is the contents of data.txt.
How can use one Regular Expression, so that it can return "Hello World" and
"I am Eric" ?
Would you please to give me an example ?
Best regards,
Eric
------------------------------
Date: Fri, 17 Aug 2001 22:42:40 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Please help in Regular expression question!!
Message-Id: <3b7e0051$1@news.microsoft.com>
"Eric Chow" <eric138@yahoo.com> wrote in message
news:9lkqkg$ih33@ctmsun0.macau.ctm.net...
> Would you please to teach me how can I get the following result with
Regular
> Expression ?
>
> data.txt
> ===================================================
> <small><font color=red size=20>Hello World</font></small>
> <small><font color=blue size=22>I am Eric</font></small>
> ===================================================
>
> The above is the contents of data.txt.
>
> How can use one Regular Expression, so that it can return "Hello World"
and
> "I am Eric" ?
Please see PerlFAQ9: "How do I remove HTML from a string?"
It is the first reply to "perldoc -q HTML"
jue
------------------------------
Date: 18 Aug 2001 04:29:16 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Processing a scalar in the same way of a filehandle
Message-Id: <9lkqus$eqp$2@bob.news.rcn.net>
Bart Lateur <bart.lateur@skynet.be> wrote:
> John Porter wrote:
>> for my $p ( split /\n+/, $cnt ) { ... }
> Paragraph mode demands a separation of at least 2 newlines.
> for my $p ( split /\n\n+/, $cnt ) { ... }
Still not exactly equivalent, because in paragraph mode the record
separators are tacked on to the end of the paragraphs; your code gives the
equivalent of a readline followed by a chomp (which, to be fair, is
probably what the OP wants).
------------------------------
Date: Sat, 18 Aug 2001 02:49:52 GMT
From: "Ben Kennedy" <bkennedy99@Home.com>
Subject: Re: redirecting stdin and stdout
Message-Id: <kJkf7.113994$EP6.30044010@news1.rdc2.pa.home.com>
"Tarak Parekh" <tarak@lectura.CS.Arizona.EDU> wrote in message
news:9lk8dt$q9j$1@hisatsinom.cs.arizona.edu...
> What would be the right way to redirect standard out and standard error
> messages from a binary invoked by the system function call ?
You should use typical shell redirects, e.g.
system("yourprog 2>stderr.txt >stdout.txt");
This will actually first invoke a shell, see perldoc -f system for details
--Ben Kennedy
------------------------------
Date: Fri, 17 Aug 2001 23:35:23 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: redirecting stdin and stdout
Message-Id: <slrn9nrojr.d1m.tadmc@tadmc26.august.net>
Tarak Parekh <tarak@lectura.CS.Arizona.EDU> wrote:
>What would be the right way to redirect standard out and standard error
>messages from a binary invoked by the system function call ?
Perl FAQ, part 8:
"How can I capture STDERR from an external command?"
Please check the Perl FAQs *before* posting to the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 18 Aug 2001 09:30:12 +0200
From: "Andreas Horvath" <ahorvath@cyberjus.com>
Subject: Re: redirecting stdin and stdout
Message-Id: <998119395.455820@fuchs.cyberlink.ch>
Tarak Parekh <tarak@lectura.CS.Arizona.EDU> schrieb:
> I have a small perl script that basically invokes the 'system'
> function call.
> Before invoking the system function call I try redirecting the
> STDERR and STDOUT to a file handle by doing
>
> *STDOUT=*FILE_HDL;
> *STDERR=*FILE_HDL;
>
> After that i invoke
> system ("/tmp/a.out");
let's asume you have STDIN (fileno 0), STDOUT (fileno 1), STDERR (fileno 2)
and FILE_HDL (fileno 3).
*STDOUT = *FILE_HDL;
print STDOUT "foo";
results in 'write(3, "foo", 3)'. it doesn't dup() your FILE_HDL to STDOUT,
it's just an internal redirect.
system() gets its stdout and stderr by duping your process' fileno 1 and 2,
it won't take the effect you want.
open STDOUT, ">&" . fileno FILE_HDL;
print STDOUT "foo";
this dups FILE_HDL to STDOUT and results in 'write(1, "foo", 3)', system()
will get the correct fileno
HTH, andy
------------------------------
Date: Fri, 17 Aug 2001 19:13:40 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
Subject: Re: removing trailing and leading blanks
Message-Id: <3B7DCF54.1736007E@wgn.net>
john smith wrote:
>
> What is the most efficient way of removing leading and trailing
> blanks from a string.
>
> for e.g., "john smith " should become "john smith"
>
> and " john smith" should become "john smith".
> Is there a standard perl function for either of this.
s/^\s+//; s/\s+$//;
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles Mailto:dbe@todbe.com
/ ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
------------------------------
Date: Fri, 17 Aug 2001 18:41:47 +0800
From: "Eric Chow" <eric138@yahoo.com>
Subject: Search the pattern with Perl Regular Expression
Message-Id: <9liru7$ii19@ctmsun0.macau.ctm.net>
Hi,
I am a beginner in Perl.
Would you please to teach me how I can get a pattern of text from a string ?
For example :
=========================================================
<small><font size=12 color=red>PERL</font></small>
<small><font size=18 color=blue>Regular Expression</font></small>
========================================================
As the above text, how can I use only one expression, so that it can return
tow results as "PERL" and "Regular Expression" ???
Would you pelase to teach me and show me the solution??
Best regards,
Eric
------------------------------
Date: 18 Aug 2001 07:59:28 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: Self-Searchable Perl documention - Extremely Useful!
Message-Id: <9ll790$fvi$2@news.panix.com>
In article <74f348f7.0108120702.662a6771@posting.google.com>,
Yves Orton <demerphq@hotmail.com> wrote:
>...
>Incidentally, I stayed up all night enhancing your activestate search
>engine (found a couple of minor gliitches, but who cares). Check your
>mails for a copy of my mods.
>
How about posting it here so everyone can
see it too.
Good or bad idea?
David
------------------------------
Date: Fri, 17 Aug 2001 12:07:30 GMT
From: "David Scarlett" <dscarlett@optushome.com.au>
Subject: Re: Simple Problem
Message-Id: <6O7f7.20003$A5.59870@news1.eburwd1.vic.optushome.com.au>
"Smiley" <gurm@intrasof.com> wrote in message
news:3b7ccee6.225130079@news1.on.sympatico.ca...
> I'm having trouble with a simple find and replace. I must be tired or
> something because I can't figure out what the problem is. This is the
> line:
>
> $form[$key] =~ s/\'//gi;
>
> It doesn't seem to want to get rid of the single quotes though. Can
> anybody tell me what's wrong here?
>
Well, seeing how you use the name "$key", is form meant to be a hash? If so,
it should be:
$form{$key} =~ s/\'//gi;
--
David Scarlett
dscarlett@optushome.com.au
http://www.listen.to/artifice/
http://members.optushome.com.au/dscarlett/
"Damn it, Kif, where's the little umbrella? That's what makes it a scotch on
the rocks!"
-Capt. Zapp Brannigann, Futurama
------------------------------
Date: Sat, 18 Aug 2001 04:10:56 GMT
From: "Joe Landman" <landman@localhost.localdomain>
Subject: Re: SOAP::Transport and forking servers... how to do it?
Message-Id: <20010817.195032.1390592480.6788@localhost.localdomain>
In article <mvyitg0vhui.fsf@Zathras.Stanford.EDU>, "Rob Riepel"
<riepel@zathras.stanford.edu> wrote:
[...]
> This works for me:
>
> # forkHTTP.pm - Forking SOAP HTTP daemon
>
Thanks !!! Ill give it a try!
Joe
------------------------------
Date: 18 Aug 2001 05:02:45 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Update: (Perl) programming contest loosely based on the prisoners' dilemma
Message-Id: <998108759.18440@itz.pp.sci.fi>
In article <9l0m17$r0b$07$1@news.t-online.com>, Steffen Müller wrote:
>"Yves Orton" <demerphq@hotmail.com> schrieb im Newsbeitrag
>news:74f348f7.0108100359.2b7908f4@posting.google.com...
>> This sounds like Core-Wars or Core-Bots.
>>
>> Yves
>> Im interested in hearing more though. Sounds neat.
>
>Yeah, now that you mention Core Wars, it reminds me of it, too. Only
>concerning the playing grounds, however.
Not really all that much like Core War. Although as it happens, there
is a connection -- I once ran a CW tournament involving a form of the
iterated Prisoner's Dilemma.
http://www.sci.fi/~iltzu/corewar/imt1/
>I wanted to get some feedback if such a contest is wanted at all.
>Considering the incredible amount of follow-ups, I might not start at all...
I'd be interested, if you decide to go ahead with it.
You might want to post about it to rec.games.corewar too. Despite the
name, all programming games like that are considered on topic there.
I bet folks on the Fun With Perl mailing list would be interested too.
I'd suggest, however, that you think about the details some more first.
The best way to hook people onto something like this is to have a full
set of rules ready so that they can start thinking about strategies as
soon as they find out about the contest.
Emphasize that anyone can enter, even utter beginners -- and it costs
nothing. Make the code you'll be using available, so that people can
debug and evaluate their entries at home.
And, once you have the rules and deadlines set, do advertize far and
wide. There are Perl newsgroups outside comp.lang.perl.*, and Perl
forums outside Usenet -- mailing lists, web discussion boards, IRC...
Don't spam or post off topic, but do mention this everywhere it *is* on
topic. A separately written informal message for each forum probably
works best, with a link to an "official" webpage.
And if you still, for whatever reason, don't get more than a hadful of
entries, just keep in mind that any number over one is plenty enough.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1557
***************************************