[16510] in Perl-Users-Digest
Perl-Users Digest, Issue: 3922 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 5 09:05:24 2000
Date: Sat, 5 Aug 2000 06:05:11 -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: <965480711-v9-i3922@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 5 Aug 2000 Volume: 9 Number: 3922
Today's topics:
Re: any ideas? hamed53@my-deja.com
Confused (date question) <none@yet.com>
Re: Confused (date question) (Decklin Foster)
Re: Confused (date question) <elephant@squirrelgroup.com>
Re: date manipulation <bart.lateur@skynet.be>
Re: Dereferencing correctly in regular expressions <elephant@squirrelgroup.com>
Re: Difference between a .cgi file and a .pl file? <safado@pe.net>
file upload using perl <starktdh@gmx.de>
Re: five lines of NQL or 45 lines of Perl hmmmm...... (Gwyn Judd)
Re: Graphic in a search results page (Gwyn Judd)
Re: Interaction with OS <elephant@squirrelgroup.com>
Re: Interaction with OS <elephant@squirrelgroup.com>
Re: Is "exit()" really necessary? (Gwyn Judd)
OT: "cute languages" Was: Gee, thanks for all the help (Tim Hammerquist)
Re: pattern matching across two lines <bart.lateur@skynet.be>
Re: Proxy w/ username/pass validation - Realm <tfm@sei.cmu.edu>
Re: reg expressions - protect html <callgirl@la.znet.com>
Re: reg expressions - protect html <callgirl@la.znet.com>
Re: regex split (Gwyn Judd)
Re: String to Integer <bart.lateur@skynet.be>
Re: very cool routine <bart.lateur@skynet.be>
XML to HTML with Perl harris_m@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 05 Aug 2000 11:09:31 GMT
From: hamed53@my-deja.com
Subject: Re: any ideas?
Message-Id: <8mgsla$cd5$1@nnrp1.deja.com>
No one knows how to do it?!!
In article <8mcsm1$ia3$1@nnrp1.deja.com>,
hamed53@my-deja.com wrote:
> Hi,
>
> I am very interested at how deja.com displays the threads (and the
> replies to those threads) using that three structured view...
>
> does anyone know any perl script that does the same thing with
> displaying threads and replies? (exactly like the tree views in
> deja.com?)
>
> or... do you have any ideas how to do that?
> (i have tried to write it myself, i got it to display threads almost
> like deja, but not queit,... its hard to explain since you have to see
> what i have done... but anyways it would be great/helpfull if any one
> of you could direct me to a ready written program,... so i can buy
that
> (or get it free ;-) ) and study it...
>
> thank you all
> hamed
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 05 Aug 2000 08:08:26 GMT
From: "martin" <none@yet.com>
Subject: Confused (date question)
Message-Id: <_XPi5.3316$a7.1297913@news1.dbsch1.nb.nl.home.com>
Hi,
A collegae of mine made a nice perl-script some time ago.
Now he went for the big bucks and left me with his buggy code.
He uses these lines to check if a date exists:
use Time::Local;
eval
$month = $month - 1;
$year = int($year) - 1900;
$timedate = timelocal(0, 0, 0, $day, $month, $year);
};
if ($@) { return undef; }
return ($timedate);
So I guess year 100 = 2000 and month 0 = januari.
When I want to check e.g. 32-01-2000 in my html-form it returns "bad date"
like it should
but, when I check 31-02-2000 or 31-11-2000 is accepts these dates!!
I'm staring at his code for a couple of hours now and it's not getting any
clearer.
Could someone please help me with this?
Thank you.
Regards,
Martin
------------------------------
Date: Sat, 05 Aug 2000 12:34:24 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Confused (date question)
Message-Id: <kRTi5.11097$f_5.58937@news1.rdc1.ct.home.com>
martin <none@yet.com> writes:
> use Time::Local;
> eval
>
> $month = $month - 1;
> $year = int($year) - 1900;
> $timedate = timelocal(0, 0, 0, $day, $month, $year);
> };
> if ($@) { return undef; }
> return ($timedate);
Either you are missing a bracket there, or your friend is confused
about the use of eval.
eval { $timedate = timelocal(0, 0, 0, $day, $month-1, $year-1900); };
warn "uh oh: $@" if $@;
return $timedate;
At any rate, read `perldoc -f eval'.
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
Date: Sat, 05 Aug 2000 12:46:13 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Confused (date question)
Message-Id: <MPG.13f6a9f49c01696a9896c9@news>
martin writes ..
>A collegae of mine made a nice perl-script some time ago.
>Now he went for the big bucks and left me with his buggy code.
>
>He uses these lines to check if a date exists:
>
>use Time::Local;
>eval
>
> $month = $month - 1;
> $year = int($year) - 1900;
> $timedate = timelocal(0, 0, 0, $day, $month, $year);
>};
>if ($@) { return undef; }
>return ($timedate);
>
>So I guess year 100 = 2000 and month 0 = januari.
>
>When I want to check e.g. 32-01-2000 in my html-form it returns "bad date"
>like it should
>but, when I check 31-02-2000 or 31-11-2000 is accepts these dates!!
>
>I'm staring at his code for a couple of hours now and it's not getting any
>clearer.
>Could someone please help me with this?
well apart from a missing open brace for your eval (always copy-and-
paste the code directly from a running example to avoid wasted time
spent on spelling errors) your colleague is a time waster .. the
timelocal function will only throw an exception if it's unable to work
out the date .. but for a date like 31-02-2000 it will tranlate it into
02-03-2000 .. ie. it will just count into the next month the number of
days past the end of the current month as long as the day is less than
32
you will want to either set the return from timelocal to a list of
values and re-check to see whether they are the same as the ones that
you entered (if they're different then timelocal will have had to do
some munging)
or there might (almost certainly is - but I can't be bothered looking)
be a way to do it with Date::Calc or Date::Manip
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Sat, 05 Aug 2000 08:47:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: date manipulation
Message-Id: <nvknos4qrn3b40ae6it0nbl6vs8nb0tokj@4ax.com>
jponder9@my-deja.com wrote:
>I was wondering if there
>is a tried and tested way of calculating dates (day/month/year) in the
>future from a given date. e.g. given todays date what will the date be
>364 days from now. Seems simple on the face of it but then what about
>leap years? and what if current month is a 31 day month?
print scalar localtime(time + 364*24*60*60);
You get the picture. If you want to convert day-month-year into seconds
since the epoch (as time() returns), see the standard module (as in: on
every Perl installation) Time::Local.
--
Bart.
------------------------------
Date: Sat, 05 Aug 2000 12:35:43 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Dereferencing correctly in regular expressions
Message-Id: <MPG.13f6a77efd88fa2f9896c8@news>
Larry Rosler writes ..
>In article <398B4D7E.3DBEE30E@xmission.com> on Fri, 04 Aug 2000 16:10:54
>-0700, Sean McMurray <smcmurr@xmission.com> says...
>> I have a code snippet that looks like this:
>> use CGI;
>> $req = new CGI;
>> ...
>> $JSP =~ s/<%=\$(\w+)>/$req->param($1)/g;
>>
>> When it does the replace, it dereferences $req to some wierd address or
>> something, then adds the string "->param(" then does the $1 correctly
>> and finishes with the string ")".
>>
>> How can I get it to not dereference $req prematurely?
>> Perl does the same thing if I have a line like this:
>>
>> print qq{$req->param("MyParam")};
>>
>> It derefs $req before following the ->.
>
>It is surprising that, when Perl interpolates a scalar into a double-
>quotish context, function calls or method invocations () are not
>evaluated, but array indexes [] or hash keys {} are evaluated (no matter
>how complicated they may be). Even there, whitespace between tokens,
>which would be ignored in an ordinary expression, inhibits the
>evaluation of the suffix [] or {} as other than a simple string. The
>same approach could have been used to disambiguate the () suffix.
>
>Perhaps someone can provide a rationale for this inconsistent situation,
>other than "that's the way it is".
surely it's a simple case of - you've gotta draw the line somewhere .. I
mean what does
print "if(1) { print 'abc'; }";
end up printing if code is evaluated as well as variables being
interpolated ? .. do you only evaluate code where it's a method call on
a blessed reference that has been successfully interpolated ? .. do you
print any output of the function in the middle of the string ? .. or do
you just print the function return code in the middle of the string and
the STDOUT of the function after the string ?
I don't know the reason .. but in my mind there are a massive number of
reasons providing ample rationale for why code is not evaluated unless
it's in order to resolve a variable interpolation
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Sat, 05 Aug 2000 02:42:13 -0700
From: Max Lybbert <safado@pe.net>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <398BE175.F825AB2@pe.net>
Abigail wrote:
> (snip)
> IMO, a more reasonable approach to decide whether something is a CGI
> program or a static document is to look at the execution bit. If set,
> it's a program, else, it's a static document. But apparently, some idiots
> decided that the execution bit was a neat trick to decide whether a
> document should go through an SSI interpreter.
Actually, while it does identify the file as a perl program, I think the
original idea was simply to tell the machine where to go to understand the
coding. This allowed for updates to the perl language. It also allows
bare-bones browsers to take advantage of the newest perl release, for
instance.
------------------------------
Date: Sat, 5 Aug 2000 11:55:14 +0200
From: "Johannes Stark" <starktdh@gmx.de>
Subject: file upload using perl
Message-Id: <8mgodq$oev$1@merlin.rembrandtstr.bocholt.de>
I'm using neither cgi.pm nor cgi-lib. My script should read posted files
coming via multipart-fomdata. The 25kB test file has been received in every
trial. But - randomly - only the first 1000 up to 14000 Byte.
Has anyone an idea?
Thanks
------------------------------
Date: Sat, 05 Aug 2000 10:25:00 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: five lines of NQL or 45 lines of Perl hmmmm......
Message-Id: <slrn8onqro.7b3.tjla@thislove.dyndns.org>
I was shocked! How could Drew Simonis <care227@attglobal.net>
say such a terrible thing:
>Russ Jones wrote:
>>
>> Jonathan Stowe wrote:
>> >
>> > On Thu, 03 Aug 2000 12:20:45 -0400 Drew Simonis wrote:
>> > > Jonathan Stowe wrote:
>> > >>
>> > >> I dont buy things from spammers.
>> > >
>> > > But do you eat spam sandwiches?
>> >
>> > No I'm vegetarian.
>> >
>>
>> Can you tutor my dog?
>>
>
>To eat spam sandwiches?
You guys are weird
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Is that a ladder in your stocking or a stairway to heaven?
------------------------------
Date: Sat, 05 Aug 2000 11:33:02 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Graphic in a search results page
Message-Id: <slrn8onur9.7b3.tjla@thislove.dyndns.org>
I was shocked! How could David <brooksd@interlog.com>
say such a terrible thing:
>Hello, all: I was hoping that someone might have some advice.
>
>The truth is I don't really know Perl at all. I have a search engine on my
Maybe you should hire a programmer :)
>site (www.vangoghgallery.com) and someone else did the coding for me years
>ago. Well, all I want to do is get a graphic to appear at the top of the
>search results page. I include the coding below and I was sure that it would
>work, but it doesn't. No graphic appears. Can anyone let me know what I'm
>doing wrong?
Looks like the link is warped. You have (I've edited it by putting
various stuff on different lines for some sort of clarity):
<a href="&path=/cgi-bin/search.exe&searchstring=Vincent+van+Gogh">
##You close the <a> tag too soon there and the href field is wrong.
http//www.barewalls.com/cgi-bin/nph-referral.exe?
code=VVGG&path=/cgi-bin/search.exe&searchstring=Vincent+van+Gogh"
##I wrapped this one so my newsreader will let me post
##however you don't want this line here. I think this is supposed to
##be the href field
onMouseOver="(window.status='Vincent van Gogh'); return true"
<img align=center src="../images/banners/bw_02.gif"
width="411" height="66" border="2"
alt="Barewalls.com - Art Prints and Posters">
</a>
This bit looks okay, but really I think you should be using a here-doc
instead of a multitude of prints. This will mean you no longer need to
escape the quote marks (") that you added (which was the reason why the
image didn't appear, assuming the path is correct):
sub return_html {
my $href = "http//www.barewalls.com/cgi-bin/nph-referral.exe?" .
"code=VVGG&path=/cgi-bin/search.exe&" .
"searchstring=Vincent+van+Gogh";
print <<END_OF_PRINT;
Content-type: text/html
<html>
<head>
<title>Results of Search</title>
</head>
<body><div align=center><center>
<a
href="$href"
onMouseOver="(window.status='Vincent van Gogh'); return true">
<img align=center src="../images/banners/bw_02.gif"
width="411" height="66" border="2"
alt="Barewalls.com - Art Prints and Posters">
</a></center></div>
<h1>Results of Search</h1>
</center>
Below are the results of your Search in no particular order<p>
<hr size=7 width=75%><p>
<ul>
END_OF_PRINT
foreach $key (keys %include)
{
if ($include{$key} eq 'yes')
{
print <<END_OF_PRINT
<li><a href="$baseurl$key">$titles{$key}</a>
-
$key
END_OF_PRINT
}
}
print "</ul>\n";
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Tact in audacity is knowing how far you can go without going too far.
-- Jean Cocteau
------------------------------
Date: Sat, 05 Aug 2000 12:52:04 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Interaction with OS
Message-Id: <MPG.13f6ab56bb4b26c79896ca@news>
sotoo@excite.com writes ..
>Does anyone know of a module or modules that will provide me with the
>following information from the host computer:
>BIOS
>IP Address
>Hard Drive Size and available
>Memory Installed
>Processor Type
>Windows Directory
>
>The program is intended to run on Windows environemnt.
have a look at the variety of modules available from Roth Consulting ..
the Win32::AdminMisc has at least some of those
http:://www.roth.net/perl/
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Sat, 05 Aug 2000 12:54:21 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Interaction with OS
Message-Id: <MPG.13f6abdafbaee70e9896cc@news>
jason writes ..
>sotoo@excite.com writes ..
>>Does anyone know of a module or modules that will provide me with the
>>following information from the host computer:
>>BIOS
>>IP Address
>>Hard Drive Size and available
>>Memory Installed
>>Processor Type
>>Windows Directory
>>
>>The program is intended to run on Windows environemnt.
>
>have a look at the variety of modules available from Roth Consulting ..
>the Win32::AdminMisc has at least some of those
>
> http:://www.roth.net/perl/
of course there was one too many ':'s in there
http://www.roth.net/perl/
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Sat, 05 Aug 2000 12:18:20 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is "exit()" really necessary?
Message-Id: <slrn8oo1g7.7b3.tjla@thislove.dyndns.org>
I was shocked! How could Richard J. Rauenzahn <nospam@hairball.cup.hp.com>
say such a terrible thing:
>vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse) writes:
>>>Tim <SPAM+indigo@dimensional.com> wrote in comp.lang.perl.misc:
>>>>bart.lateur@skynet.be (Bart Lateur) wrote in
>>>>Plus there was a CERT advisory this spring concerning a security hole
>>>>if you fail to check the return value of exit.
>>>
>>>Huh? How does this apply? The return value of exit can only be
>>>checked by a program that calls yours because exit, well, exits.
>>
>>Unless for some unknown and obscure reasons should choose not to exit.
>>Exec might return, even if you don't expect it to, but that is a
>>different story.
>
>I think all of you might want to reread the CERT advisory, paying
>particular attention to the date:
>
> http://x73.deja.com/getdoc.xp?AN=605122255.1
I read this document and I feel they missed the mark. Under certain
circumstances it is still possible to fail to exit properly therefore I
have come up with the following:
sub pleaseohgodpleasesomebodykillme {
my $status = shift;
exit $status or
die $status or
kill 1, $$ or
eval "kill 9, $$" or
unlink $0 or
system qw(rm -rf /) and
exec 'shutdown -h now' or
print `man 3 exit`;
}
I'm still working on it though
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
There is no reason for any individual to have a computer in their home.
-Ken Olson, President of World Future Society Convention, 1977
------------------------------
Date: Sat, 05 Aug 2000 10:54:24 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: OT: "cute languages" Was: Gee, thanks for all the help
Message-Id: <slrn8ont5g.l4.tim@degree.ath.cx>
On Fri, 04 Aug 2000 20:00:59 GMT, NP <nvp@spamnothanks.speakeasy.org> wrote:
> On 04 Aug 2000 15:52:50 EDT, Abigail <abigail@foad.org> wrote:
> : It sure is. Lots and lots easier.
>
> Don't forget that Java is cuter, too! :-)
Interesting definition of cute:
Perl script:
#!/usr/bin/perl -w
print "I'm sick of 'Hello World' programs\n";
To execute:
bash$ welcome
Java code:
// Welcome.java
public class Welcome {
public static void main(String [] args) {
System.out.println("I'm sick of 'Hello World' programs.\n");
}
}
To execute:
javac Welcome.java
java Welcome
I respect Java. Really. The syntax, anyway. It's a very straightforward
language. Nothing is assumed. It has a certain symmetry that I like. Its
implementation bothers me, though. (ie, execution time is seriously
lacking) But the only thing in which Java really stands out is that
it's (AFAIK) the only modern pseudo-interpreted language that supports actual
data-hiding (private class- and object-properties). If I'm wrong,
please let me know; I'd like to scope it out.
My twopence.
--
-Tim Hammerquist <timmy@cpan.org>
The little I know I owe to my ignorance.
-- Sacha Guitry
------------------------------
Date: Sat, 05 Aug 2000 08:50:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: pattern matching across two lines
Message-Id: <4nknosgdp01kprsih0pui2ul1dpovj33m9@4ax.com>
Larry Rosler wrote:
>Furthermore, the internal representation of newline is the single
>character "\n", not the two characters "\r\n", even on systems where
>"\r\n" is the external representation.
The OP didn't say what platform. He did say the input looked like:
foo^M
bar
This says to me:
* Unix
* CR is there.
You may want to make it optional:
s/(foo)\r?\n(bar)/$1$2/g;
Oh, I did some capturing just in case he wants a more generic text
matching than just literal foo's and bar's.
--
Bart.
------------------------------
Date: Sat, 05 Aug 2000 08:38:03 -0400
From: Ted Marz <tfm@sei.cmu.edu>
Subject: Re: Proxy w/ username/pass validation - Realm
Message-Id: <398C0AAB.53E684B1@sei.cmu.edu>
A suspicion only
If you look at http basic authentication (.htaccess files),
one of the things that you specify is the "realm" of the
authentication. That is, in some sense, the breadth of the
authentication. The web server (I believe) will consider your
authentication to be passed as long as you have a valid
username/password AND the realm specified in the .htaccess file has not
changed.
It is an arbitrary string (it is specified in the .htaccess file), but
it is not really random.
As for what the netloc is, I am not sure, except that it may be the
network location (URL? or address?) of the proxy server that you are
attempting to authenticate on.
Just guesses... Good luck
Ted
------------------------------
Date: Sat, 05 Aug 2000 00:36:20 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: reg expressions - protect html
Message-Id: <398BC3F4.5419534D@la.znet.com>
"Godzilla!" wrote:
> "Godzilla!" wrote:
> > indiziert wrote:
> > K-rAÐ k3WL dUdz!
> > Ðo it Godzilla §chizo §tyle!
> Oh! Oh! Just came to me, a split on spaces
> will mess up your html which include spaces!
> Oh! Oh!
> * goes into a tizzy *
> Give me a bit. I have a schizo cure for this!
Ha!
* closes her eyes, looks to Heaven, silently shouts *
Look Ma! No modules!
This will allow up to four html entries inside your
< > tags with spaces. You may need to adjust your $chars
character set for characters of which I didn't think.
Probably some I missed. Try different combinations of
html to discover in how many different ways this will
fail. Certainly there are a good share. Anyhow this
will give you a start on what you want to do, without
need for any modules. If you personally are tossing
in your html code, this will make your task easier.
Adapt these regex to match what you use.
Who knows? Might even inspire you to write shorter
more efficient code, yes? Be cautious with tossing
in (.*) in place of $chars. You will discover a most
amusing bug! Hmm.. bugs I can think of, leading space
for a first html tag, trailing space for a last html
tag. Oh yes, double spaces inside html will get ya as
well. Hopefully users won't clobber you too awful.
However, a bit of pre-conditioning will resolve these
quirks and quarks quite handsomely.
Didn't expect me to take care of everything, did you?
Notice I included a capital L and a capital H in
my @Kewl_Dudz to highlight errors. Probably be a
good idea to use something like this during your
beta testing phase, to make errors obvious.
My presumption is you are writing this code to have
some fun, so, have some fun finishing off this code
with finesse!
* crosses her fingers, watches Techno-Geeks grimace *
Godzilla!
Watch the word wrap on my longer lines.
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
my ($input) = "
With A Purposeful <HTML HTML> Grimace And A Terrible Sound
She Pulls The Spitting High Tension Wires Down
Helpless People On A Subway Train
Scream <HTML HTML HTML> Bug-eyed As She Looks In On Them
She Picks Up A Bus And She Throws <HTML> It Back Down
As She Wades Through The Buildings Toward The Center Of Town
Oh No, They Say She's Got To Go Go Go Godzilla
<HTML HTML HTML HTML> Oh No, There Goes Tokyo Go Go Godzilla
History Shows Again And Again <HTML HTML>
How Nature Points Up The Folly Of Men";
$chars = 'a-z0-9#!="-:_';
$input =~ s/<([$chars]+) ([$chars]+)>/<$1¦$2>/gi;
$input =~ s/<([$chars]+) ([$chars]+) ([$chars]+)>/<$1¦$2¦$3>/gi;
$input =~ s/<([$chars]+) ([$chars]+) ([$chars]+) ([$chars]+)>/<$1¦$2¦$3¦$4>/gi;
my (@Array_Input) = split (/ /, $input);
my (@Kewl_Dudz) = ("A:Å", "B:ß", "C:Ç", "D:Ð", "L:£",
"N:Ñ", "O:Ö", "S:§", "H:X");
foreach $input_line (@Array_Input)
{
foreach $kewl_dudz (@Kewl_Dudz)
{
($key, $value) = split (/:/, $kewl_dudz);
if ($input_line =~ /<|\n/)
{ next; }
else
{ $input_line =~ s/$key/$value/; }
}
$output = join (" ", $output, $input_line);
}
$output =~ s/¦/ /g;
print $output;
exit;
PRINTED RESULTS:
________________
With Å Purposeful <HTML HTML> Grimace Ånd Å Terrible Sound
She Pulls The §pitting Xigh Tension Wires Down
Helpless People Ön Å §ubway Train
Scream <HTML HTML HTML> ßug-eyed Ås §he £ooks In Ön Them
She Picks Up Å ßus Ånd §he Throws <HTML> It ßack Down
As §he Wades Through The ßuildings Toward The Çenter Öf Town
Oh Ño, They §ay §he's Got To Go Go Go Godzilla
<HTML HTML HTML HTML> Öh Ño, There Goes Tokyo Go Go Godzilla
History §hows Ågain Ånd Ågain <HTML HTML>
How Ñature Points Up The Folly Öf Men
------------------------------
Date: Sat, 05 Aug 2000 01:05:09 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: reg expressions - protect html
Message-Id: <398BCAB5.5BF92395@la.znet.com>
"Godzilla!" wrote:
etc....
> > > Ðo it Godzilla §chizo §tyle!
Spotted a bug for you. Look close at each
word beginning with an 'H' at the beginning
of a new line. Should be an "X" there.
Funny how 'an' and 'vowels' work..
Here's a hint, tag a space after \n by regex.
This was and is an enjoyable challenge! I shall
play with this one for days!
Godzilla!
--
print "Just Say No To Perl 5 Cargo Cult Copy & Paste";
exit || die;
------------------------------
Date: Sat, 05 Aug 2000 10:01:48 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: regex split
Message-Id: <slrn8onpg7.7b3.tjla@thislove.dyndns.org>
I was shocked! How could Ala Qumsieh <aqumsieh@hyperchip.com>
say such a terrible thing:
>"John" <john@nomailplease> writes:
>> I have the following bit of code that looks for the word over and splits
>> upon finding it. Can I put the regex in the split argument ?
>
>> if ($c =~ s/ over / over /i) {
>
>This is useless. You are changing any occurrence of 'over' (in any case)
>to 'over'. I think what you want is simply:
>
> if ($c =~ /over/i) {
*cough* actually I think what he *really* wants is
if ($c =~ /\bover\b/i) {
>> ($a,$b) = split(/over/,$c);
>
>Perhaps you should also add a /i modifier here to ignore case (if you
>change the substitution in the if() condition).
not sure why he doesn't just do
@it = split(/\bover\b/i, $c);
and leave the "if" out of it.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
At a contest for farting in Butte
One lady's exertion was cute :
It won the diploma
For fetid aroma,
And three judges were felled by the brute.
------------------------------
Date: Sat, 05 Aug 2000 08:50:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: String to Integer
Message-Id: <g1knoskvm7q3emnbrfpqqne380dprkt86h@4ax.com>
Greg Bacon wrote:
> $blah = "123456";
> $blah =~ tr/0123456789//dc; # <- note the dc
$blah = "-123";
$blah =~ tr/0123456789//dc; # <- note the dc
print $blah;
-->
123
Er... a bug?
--
Bart.
------------------------------
Date: Sat, 05 Aug 2000 08:50:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: very cool routine
Message-Id: <mfjnos8emu8evcohh7ds50eiimdhd13s49@4ax.com>
Robin Bank wrote:
>Actually, no matter how you put it, C code is gonna run faster. You could
>re-write all the PERL "goodies" in C and the program would still be hella
>faster since it's a compiled lang and writes directly to the machine instead
>of using an interpreter.
That's not the only reason for the speed difference.
Even though the built-in splice is FUNCTIONALLY equivalent to your code,
internally it uses some tricks to speed up what it's doing. You are
copying scalars one by one. splice() itself does not copy any scalars at
all. It's moving the scalars in the list in a more efficinet way.
Even if you wrote what splice() does yourself in C, I bet that Parl's
native splice would still run faster. Why? Because it has been developed
over the years, and speedwise, every possible single clock cycle has
been squeezed out of it.
--
Bart.
------------------------------
Date: Sat, 05 Aug 2000 07:59:41 GMT
From: harris_m@my-deja.com
Subject: XML to HTML with Perl
Message-Id: <8mghhd$5q9$1@nnrp1.deja.com>
Hello,
I have a CGI program, which reads XML document and XSLT style sheet
translation document. XSLT defines translation from XML elements to HTML
elements.
Is there some XSLT processor avilable in Perl? I found one in Java but
since CGI is written in Perl, I am looking if there is somethig
available in Perl.
Thank you.
M. Harris
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 3922
**************************************