[13206] in Perl-Users-Digest
Perl-Users Digest, Issue: 616 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 22 18:07:18 1999
Date: Sun, 22 Aug 1999 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 22 Aug 1999 Volume: 9 Number: 616
Today's topics:
$5 for 1st perl script that prints out most common phra (Dr. Jason A. Taylor)
Re: A reference to a number <perin@panix.com>
Date::Calc version in Perl? <kistler@fnmail.com>
Re: determining a leap year <kistler@fnmail.com>
Re: How to do "or" in IF test? <kistler@fnmail.com>
Re: killing my child <kistler@fnmail.com>
Re: matching tags in HTML <ahands@sprynet.com>
Re: newbie CGI question re CGI.pm <webmaster@chatbase.com>
Re: PERL EDITOR (Me)
Re: PERL EDITOR (Greg Teets)
Re: Perl puzzle: array of booleans to ranges <apter@panix.com>
Re: perldoc and activeperl help (Stuart Slaugh)
quicker way <nead@neadwerx.com>
Re: quicker way (Andrew Johnson)
Re: quicker way <sarmad@fas.harvard.edu>
Re: quicker way (Andrew Johnson)
Re: Regular Expression woes <kistler@fnmail.com>
Re: Substitute <kistler@fnmail.com>
Re: thanks for nothing everybody (Stuart Slaugh)
Re: Why use Perl when we've got Python?! (Ilya Zakharevich)
Re: Why use Python when we've got Perl? <watterss@pilot.msu.edu>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Aug 1999 21:37:56 GMT
From: theoblit@wam.umd.edu (Dr. Jason A. Taylor)
Subject: $5 for 1st perl script that prints out most common phrases
Message-Id: <7ppqjk$1gj$4@dailyplanet.wam.umd.edu>
Keywords: $5 for 1st perl script that prints out most common phrases
Subject: $5 for 1st perl script that prints out most common phrases
Newsgroups: comp.infosystems.www.authoring.cgi,comp.lang.perl.misc
Distribution: world
Summary: $5 for 1st perl script that prints out most common phrases
Keywords: $5 for 1st perl script that prints out most common phrases
Greetings.
I am looking for a cgi/perl/C/sed script/program that outputs the most
common phrases in a file. Doing this for single words is very easy
using sed and sort. However, I want something that does this for
phrases composed of one or more words.
I am pretty sure something out there does this for html files (for the
creation of indexes and search databases) and probably even
compression of binary files. I do not, however, know where such a
program is.
My specific need is to create a quick and dirty index of my latex
file. I already wrote a script (see below) that reads phrases from a
list and adds latex command entries (e.g., ``\index{}'') to my
document. Now I just need a list of frequently used phrases. I am
sure that I will have to do mild editing of the phrase list if it is
computer-generated. However, it would be nice if phrases starting in
``the,'' etc., were automatically ignored. I do not really want it to
ignore stuff with latexing notation like $\eta_l$ as this could go
into the index.
NOTE: I will mail a check for $5 (US) to the first person who explains
where such a program is and how to use it. Please give me your
address if you post a reply. I will be online all day. As soon as a
solution is posted, I will modify my .plan file at
jtaylor@tsunami.umiacs.umd.edu. Finger me there before posting as
sometimes it can take a while before things get posted.
--
Jason A. Taylor
Hyattsville, Maryland, USA
-script for adding index tags to latex file in case anyone ever might want it-
#!/bin/tcsh
#
# 8/21/1999 JAT
# messy but should work
#
if ( $#argv <= 0 ) then
echo ''
echo ' Usage:'; echo ''
echo ' '$0' <file prefix>'
echo ' Creates latex file <file>-with-index.tex with index entries of phrases in '
echo ' <file>.indexphraselist.' ; echo ''
exit 1
endif
#
# format of <file>.indexphraselist file is
# <phrase to look for in text>;<index entry, if any>
# example:
# NPR;National Public Radio (NPR)
# birds
# large dogs;dogs, large
setenv num_of_phrases `wc $1.indexphraselist | awk '{print $1}'`
if ( $num_of_phrases <= 0 ) then
echo Didn\'t read file. Quitting now.
exit 1
endif
setenv linenumber 1
\cp -a $1.tex $1-with-index.tex
while ( $linenumber <= $num_of_phrases )
setenv line `sed -n "$linenumber,$linenumber"p "$1.indexphraselist"`
# echo $line
set phrase=(`echo $line | awk -F\; '{print $1}'`)
set indexphrase=(`echo $line | awk -F\; '{print $2}'`)
if ( "$indexphrase" == "" ) set indexphrase=($phrase)
echo $phrase, $indexphrase
# find out how many words are in the phrase
# echo $#phrase
setenv i2 1
while ( $i2 <= $#phrase )
# echo line= $line i2= $i2
# echo word = ${phrase[$i2]}
\mv $1-with-index.tex $1-with-index-temp.tex
if ( $i2 == 1 ) then
cat $1-with-index-temp.tex | sed "s/$phrase/$phrase\\index\{$indexphrase\}/g" > $1-with-index.tex
else
setenv i2minus1 `expr $i2 - 1`
# echo beg of phrase = ${phrase[-$i2minus1]} , end of phrase = ${phrase[$i2-]}
cat $1-with-index-temp.tex | sed "N;s/${phrase[-$i2minus1]}\n${phrase[$i2-]}[ ]/$phrase\\index\{$inde
xphrase\}\\
/g" > $1-with-index.tex
endif
\rm $1-with-index-temp.tex
setenv i2 `expr $i2 + 1`
end
setenv linenumber `expr $linenumber + 1`
end
------------------------------
Date: 22 Aug 1999 17:53:42 -0400
From: Lewis Perin <perin@panix.com>
Subject: Re: A reference to a number
Message-Id: <pc7vha7wkgp.fsf@panix6.panix.com>
abigail@delanet.com (Abigail) writes:
> Lewis Perin (perin@panix.com) wrote on MMCLXXXII September MCMXCIII in
> <URL:news:pc7lnb3c0p1.fsf@panix6.panix.com>:
> <> websites@erols.com (Irwin Feuerstein) writes:
> <>
> <> > In the brief tutorial to references and objects it says that sometimes
> <> > you want to construct a reference to a string, or to a number, instead
> <> > of a named variable. Why would you want to do that? What advantages do
> <> > you get?
> <>
> <> You might want a constant:
> <>
> <> [lew@prez lew]$ perl -e "my \$pi = \\3.14; print \"\$\$pi\n\";"
> <> 3.14
> <>
> <> (Note that away from the command line you won't need to quote the
> <> dollar signs, backslashes and quotes.)
>
>
> And note that real shells quote the way Perl quotes. (Where do you think
> Perl got the idea of ' and " from?) Also, take advantage of the -l switch:
>
> $ perl -wle 'my $pi = \3.14; print $$pi'
Right; thanks! Forgetting that is what comes from using NT at work.
> Having said that, neither $pi, nor $$pi is much of a constant; as they
> can trivially be assigned to.
Well, $$pi seems assignment-resistant:
$ perl -wle 'my $pi = \3.14; print $$pi; $$pi=4.2; print $$pi'
3.14
Modification of a read-only value attempted at -e line 1.
Cheers, Lew
------------------------------
Date: Sat, 21 Aug 1999 11:49:45 +0200
From: Per Kistler <kistler@fnmail.com>
Subject: Date::Calc version in Perl?
Message-Id: <37BE7639.5C6E82FD@fnmail.com>
Hi All
Is there some version of Date::Calc written in Perl, which
must not be compilied and does not need a *.so lib?
For a program to run on different hosts, it would be good
to have modules which just could be copied in.
Thanks, Per.
--
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Sat, 21 Aug 1999 23:33:13 +0200
From: Per Kistler <kistler@fnmail.com>
To: K C Owens <owensk@cadvision.com>
Subject: Re: determining a leap year
Message-Id: <37BF1B19.E91F7BC2@fnmail.com>
K C Owens wrote:
> A year divisible by 4 is a leap year unless it is divisible by 400. 2000 is
> a leap year but 2100 is not.
> Abigail wrote in message ...
2000 is divisible by 4 and also by 400, so why then is it
a leap year?
Of course, Unix says it is a leap year:
>>cal 2 2000
February 2000
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29
Where I'm a wrong?
-Per.
--
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Sun, 22 Aug 1999 11:28:16 +0200
From: Per Kistler <kistler@fnmail.com>
Subject: Re: How to do "or" in IF test?
Message-Id: <37BFC2B0.DA80694C@fnmail.com>
Jim wrote:
> I am learning Perl using "Learning Perl" (great book). I am not
> able to find info on how to implement a logical OR in an if
> statement test, such as
> if (this or that) {
> I tried several permutations such as
> if ((this) || (that))
This should work. "||" and "or" do the or. Please show more
code, to see what's wrong.
-Per.
--
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Sat, 21 Aug 1999 23:39:06 +0200
From: Per Kistler <kistler@fnmail.com>
To: Bill Moseley <moseley@best.com>
Subject: Re: killing my child
Message-Id: <37BF1C7A.DE8684B9@fnmail.com>
Bill Moseley wrote:
>
> open (PIPE, "$command_line|") || die $!;
>
> Do I need to do anything else besides close( PIPE ) if I want to
> properly kill the program before I've read all its output?
Hi Bill
open() returns the PID of the spawned process. That one can
be killed (perldoc -f kill).
The slauthered child may send a SGICHLD signal, which may
in turn hartatack the parent. So the parent should probaply
capture that signal with: $SIG{SIGCHLD} = sub { print "smile" };
or so. Perl is like a jungle, but with lots of jackfruits:-)
-Per.
--
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Sun, 22 Aug 1999 17:20:17 -0400
From: Adrian Hands <ahands@sprynet.com>
To: TSOI_WING_SHING <wstsoi@ee.cuhk.hk>
Subject: Re: matching tags in HTML
Message-Id: <37C06991.4F41EF0D@sprynet.com>
TSOI_WING_SHING wrote:
> it said modification of read-only data.........
And it's right, $1 is read-only.
#!/usr/bin/perl -w
use strict;
open(HTML, "<tt.html");
undef $/;
(my $whole_file=<HTML>) =~ s/\n//ig;
$/="\n";
close(HTML);
open(HTML, ">tt.html");
print HTML $whole_file;
close(HTML);
If you're on unix, you can also do something like this (without perl):
$ tr -d "\n" < tt.html > tt.html.$$ && cp tt.html.$$ tt.html && rm
tt.html.$$
------------------------------
Date: Sun, 22 Aug 1999 14:57:58 -0700
From: TRG Software: Tim Greer <webmaster@chatbase.com>
Subject: Re: newbie CGI question re CGI.pm
Message-Id: <37C07266.7CF136AE@chatbase.com>
Larry Rosler wrote:
> > #!/usr/bin/perl
> >
> > > use CGI qw(:standard);
> > > my $echoline = param("anecho");
> > > print header, start_html("Yes, there is an echo!"), h1("You typed");
> > > if ($echoline) {
> > > print q($echoline);
> > > } else {
> > > print q("You didn't type anything.");
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > There's no reason to use q() here, unless you want it print the double
> > quotes. :-)
>
> Or even worse, to print the string C<$echoline> in the other branch.
>
I don't know why I missed the first q()!!!? Maybe they literally did
want it to print $echoline? Unlikely and I wouldn't assume they did, but
it's possible. :-)
Either way, thanks for pointing that out, hopefully it'll help the
poster. And I believe you are probably correct in guessing they mean to
use p().
--
Regards,
Tim Greer : webmaster@chatbase.com | software@linkworm.com
The ChatBase: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripts in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, +Sciences.
------------------------------
Date: Sun, 22 Aug 1999 19:55:26 GMT
From: me@me.com (Me)
Subject: Re: PERL EDITOR
Message-Id: <7ppknp$mlq$1@nnrp03.primenet.com>
I've been extremly happy with Perl Builder, available from
http://www.solutionsoft.com/
It's an IDE for Perl.
--mark
Previously, hoz@rocketmail.com (hoz) wrote:
>>Does anyone of you know an good and nice editor for writting perl code?
>
>for a windows editor I recommend editplus, its shareware
>-hoz
------------------------------
Date: Sun, 22 Aug 1999 21:01:14 GMT
From: teetsg@fuse.net (Greg Teets)
Subject: Re: PERL EDITOR
Message-Id: <37c064b7.13042913@nntp.fuse.net>
Get Programmers' File Editor (PFE). It's freeware and you can
run your java program with the DOS output sent to a PFE window.
It works great and you can't beat the price.
Just use Yahoo or your favorite search engine to find it.
Greg Teets
Cincinnati, OH
On Thu, 19 Aug 1999 15:03:32 -0300, "Webmaster"
<webmaster@compre-ya.com> wrote:
>Does anyone of you know an good and nice editor for writting perl code?
>
>I´m getting tired of notepad
>
>
>
>
>
------------------------------
Date: Sun, 22 Aug 1999 15:29:29 -0400
From: "stevan apter" <apter@panix.com>
Subject: Re: Perl puzzle: array of booleans to ranges
Message-Id: <7ppir4$nkl$1@news.panix.com>
cute problem indeed.
let's see how we do it in k (http://www.kx.com).
here is your boolean vector:
b:1 1 0 1 1 1 0 0 1
and here is the k solution:
f:(*|:;1+-/)@\:(&<':1!;&>':)@\:0,
thus:
f b
(0 3 8
2 3 1)
i'll step through the ideas and the code-construction:
to find the indices of those 1's which start a 1-sequence, we should
ask each element whether it is greater than the element which precedes
it. since nothing precedes the first element, we'll tack on a leading
0:
s:&>':0,b
s
0 3 8
': is a k adverb and means "prior". it takes a transitive verb as input
(in this case "greater-than") and produces a new verb which applies the
input verb to pairs in b. & is "where": given an integer vector v, it
replicates the indices i of each element of v v[i]-many times. so read
>':0,b as "where b[i] is greater than b[i-1]".
to find the indices of those 0's which terminate a 1-sequence, we should
ask each element whether it is less than the element which precedes it.
since b might terminate with a 1, we'll tack on a trailing 0:
t:&<':b,0
t
1 5 8
if we now subtract the first result from the second, and then add 1, we'll
get the length of each 1-sequence:
l:1+t-s
l
2 3 1
this gives us an equivalent non-functional alternative to f:
g:{s:&>':0,b;t:&<':b,0;(s;1+t-s)}
so how does f (or g) perform on medium-size boolean vectors? let's try
one with a million elements:
b:1000000 _draw 2 / random generation of a million 1s and 0s
\t r:f b / time it
350 / 350 ms on my pentium 450 mhz
some elementary statistics:
#*r / number of sequences
249808
|/r 1 / longest sequence of 1s
17
(#:'=r 1)@<?r 1 / distribution of sequences of length 1, 2, ..., 17
124506 62517 31640 15760 7732 3841 1874 960 521 227 116 48 36 16 8 3 3
to test linear scaling, we'll try with one 10 million elements:
b:10000000 _draw 2
\t f b
3986
Abigail <abigail@delanet.com> wrote in message
news:slrn7rvi4b.c9p.abigail@alexandra.delanet.com...
> Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXXXII September MCMXCIII
> in <URL:news:37bf9c06.1651265@news.skynet.be>:
> [] OK, here's a cute little coding problem. The aim is the opposite of
> [] obfuscation: make the code as clear as possible; and a variation on
Perl
> [] Golf: fewer Perl tokens ("words", not keystrokes) is better. For
> [] example, "print $x+123" is 4 tokens: ("print", "$x", "+", "123").
> []
> [] Problem: convert an array of booleans to a list/array of ranges of
where
> [] the boolean is true.
> []
> [] from: @boolean = (1, 1, 0, 1, 1, 1, 0, 0, 1);
> [] to: @result = ([0, 2], [3,3], [8, 1]);
> []
> [] In the result, the first number is the starting index, the second
number
> [] the number of consecutive true values.
>
> my @R = (1, 1, 0, 1, 1, 1, 0, 0, 1);
> my ($i, $j, $k) = (-1, 0);
> my @r = map {$i++; $k=$j++; $_ ? () : do {$j=0; $k ? [$i-$k, $k] : ()}}
@R, 0;
>
>
> Abigail
> --
> perl -we 'print q{print q{print q{print q{print q{print q{print q{print
q{print
> qq{Just Another Perl Hacker\n}}}}}}}}}' |\
> perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w |
perl -w
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==-----
------------------------------
Date: Sun, 22 Aug 1999 19:04:19 GMT
From: ohyeahh@worldnet.att.net (Stuart Slaugh)
Subject: Re: perldoc and activeperl help
Message-Id: <37c0444e.6621944@netnews.worldnet.att.net>
On Tue, 10 Aug 1999 10:47:36 GMT, michel.dalle@usa.net (Michel Dalle)
wrote:
>In article <7oogo2$ep8$0@216.39.133.87>, "Bart Simpson" <phony@nospam.com> wrote:
>>I am running ActivePerl under Win98, and I download the perl docs so I could
>>use "perldoc -f whatever" to look up commands, but it doesn't work so well
>>under windows.
>
>Oh yes, it does. See below.
>
>>It works fine if its just a small amount of text returned, such as when I
>>use "perldoc -f ucfirst", but when I try to look up 'substr' most of the
>>info scrolls off the top of the screen. Same as when I type "perldoc -h"
>>
>>Is there a switch to pause every screen?
>
>* Sigh * Have you tried 'perldoc -f substr | more' ?
re: *Sigh*...although we newbies do sincerely appreciate the time
taken by Perl *Gurus* on our behalf, some of the aforementioned
*Gurus* seem to be waiting in gleeful anticipation for an opportunity
to demonstrate to the rest of their *Peers* how world-weary and
condescending they have become helping the *Clueless*. Well, it seems
that you folks think that if we just studied the provided
documentation a little more diligently, we wouldn't be cluttering this
newsgroup with lazy, *Clueless* questions. In many cases, this is
unfortunately true. There are indeed lazy folk who want to be taken by
the hand and gain enlightenment without any effort on their behalf.
This is regrettable and I can certainly see how this would be
frustrating. However, I think that many *Gurus* don't realize that
many of the *Clueless* do not have a Unix background...and this is
essential in order to navigate and comprehend much of the
documentation - especially the man pages and core Perl docs.
For example, I have spent many hours and days attempting to find
answers to programming problems in Perl; unfortunately, much of the
documentation itself NEEDS DOCUMENTATION! I have experienced the same
scrolling screen problem as Michele Dalle. I scoured the documentation
for Perldoc, shell commands, piping, etc., and didn't run across the
syntax "perldoc -f substr, etc." This was not from laziness or
stupidity; the documentation is HUGE and organized and written in such
a manner that it often only makes sense to the *Initiated*. As I work
with Perl, and I do so on a daily basis, the documentation and the
*Lingo* are slowly revealing themselves...it is a slow and incremental
process...as it should be! This is a fairly complex subject, and I
certainly understand that patience is a virtue. Nonetheless, it would
be helpful if the *Gurus* didn't assume knowledge and experience based
on their own knowledge and experience. I have never seen Tom
Christiansen or other notable Perl luminaries exhibit condescending
attitudes unless they were responding to trolls or really blantantly
stupid or lazy questions...perhaps we could learn from them? I can
assure the Perl community that I have not and will not post questions
here until I have spent a reasonable amount of time attempting to find
the answer for myself. But if I can't efficiently navigate the
documentation yet, please try to be a little more understanding of
those of us who sincerely try to approach these matters as best we
can. Thank you.
>
>This is a standard way of showing the output of commands 'by page'.
>
>>I tried redirecting to a file, like "perldoc -f substr>one.txt" that didn't
>>work.
>
>Probably a typo, because it's supposed to work too (and does here)...
>
>>I do appreciate the answers I've been receiving, which tell me to look it up
>>in perldoc, now I just need help with perldoc. Go figure. :)
>
>As an alternative, you'll find a shortcut to the Online Documentation in
>your Start Menu, under Programs/ActivePerl. That should keep you
>busy for some time :-)
>
>The perldoc -f stuff is located in the file 'perlfunc', under 'Core Perl
>Docs'.
>
>Michel.
------------------------------
Date: 22 Aug 1999 19:04:55 GMT
From: "Nick Downey" <nead@neadwerx.com>
Subject: quicker way
Message-Id: <01beecd1$1698df70$73463d80@r52h83>
Novice perl programmer seeks guru to yield master opinion:
for( $i = 0; $i <= 2; $i++) {
shift @myArry;
}
Looking to strip the first three scalars out of the array *wondered* if
there was a 'suave' way.
------------------------------
Date: Sun, 22 Aug 1999 19:20:36 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: quicker way
Message-Id: <84Yv3.9418$dr6.172136@news1.rdc2.on.home.com>
In article <01beecd1$1698df70$73463d80@r52h83>,
Nick Downey <nead@neadwerx.com> wrote:
! Novice perl programmer seeks guru to yield master opinion:
!
! for( $i = 0; $i <= 2; $i++) {
! shift @myArry;
! }
!
! Looking to strip the first three scalars out of the array *wondered* if
! there was a 'suave' way.
how about instead of a guru master opinion or a suave way, I just
tell you to use Perl's splice() function (see: perldoc -f splice):
splice @array,0,3;
regards
andrew
------------------------------
Date: 22 Aug 1999 21:14:23 GMT
From: Shaikh Sarmad <sarmad@fas.harvard.edu>
Subject: Re: quicker way
Message-Id: <7ppp7f$12h$1@news.fas.harvard.edu>
Rumour has it, Andrew Johnson <andrew-johnson@home.com> said:
> ! Looking to strip the first three scalars out of the array *wondered* if
> ! there was a 'suave' way.
@myArry = @myArry[3..$#myArry];
--
===========================================================================
Sarmad M Shaikh 617.495.9647 (work)
Manager, HSA Computer Services 617.493.2453 (home)
67 Mount Auburn Street http://www.hsacs.com
Cambridge MA 02138 http://www.fas.harvard.edu/~sarmad
===========================================================================
------------------------------
Date: Sun, 22 Aug 1999 21:34:28 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: quicker way
Message-Id: <E1_v3.9500$dr6.173470@news1.rdc2.on.home.com>
In article <7ppp7f$12h$1@news.fas.harvard.edu>,
Shaikh Sarmad <sarmad@fas.harvard.edu> wrote:
! Rumour has it, Andrew Johnson <andrew-johnson@home.com> said:
! > ! Looking to strip the first three scalars out of the array *wondered* if
! > ! there was a 'suave' way.
!
! @myArry = @myArry[3..$#myArry];
please do try to get your attributions correct ... I did not
ask the above question, I answered it with a reference to
the built-in splice() function.
andrew
--
Reality is that which, when you stop believing in
it, doesn't go away.
-- Philip K. Dick
------------------------------
Date: Sat, 21 Aug 1999 11:47:47 +0200
From: Per Kistler <kistler@fnmail.com>
To: Bill Moseley <moseley@best.com>
Subject: Re: Regular Expression woes
Message-Id: <37BE75C3.E4B59B61@fnmail.com>
Bill Moseley wrote:
> Too bad I can't write:
>
> while ( $x =~ s/<META\s+NAME="(.+?)"\s*CONTENT="(.+?)">//g ) {
> $hash{ $1 } = $2;
> }
Why not? That's a common way to remove things, which are
even overlaping. But then without the /g option, of course.
-Per.
--
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Sun, 22 Aug 1999 04:19:32 +0200
From: Per Kistler <kistler@fnmail.com>
Subject: Re: Substitute
Message-Id: <37BF5E34.BA211C93@fnmail.com>
Darren wrote:
> one two three four
> I need to remove the spaces, replace them with a , and then call them from a
> variable like $num[0] $num[1].
$line = "one two three four";
$line =~ s/\s+/,/g;
@words = split(/,/,$line);
$words[0] is "one" etc.
Was it this?
-Per.
--
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Sun, 22 Aug 1999 19:22:57 GMT
From: ohyeahh@worldnet.att.net (Stuart Slaugh)
Subject: Re: thanks for nothing everybody
Message-Id: <37c14bec.8572177@netnews.worldnet.att.net>
On Thu, 12 Aug 1999 01:49:04 -0400, rjk@linguist.dartmouth.edu (Ronald
J Kimball) wrote:
>Diane <tech1@magicnet.net> wrote:
>
>> Gee thanks for your help NOT!!
>>
>> All I wanted was a brief interpretation of some of the lines of code that
>> were NOT related to HTML, and all you people could come up with are
>> critiques of the code. I did not want or need that. Its NOT a cgi class,
>> just touches on it and I just wanted to explain some of the code, but
>> apparantly none of you are capable of doing that. I must say this is my
>> first time being treated so badly and getting such useless info from a
>> newsgroup. Most groups are most helpful and willing to share knowledge..
>> guess you folks are not. Sorry I wasted my time and hoped for some help
>>
>
>Yes, please go teach your students to use Perl code like this, so that
>they too can come to this newsgroup, whine about how they need help
>understanding poorly written Perl code, ask lots of FAQs, and get pissy
>when they don't the free help they think they deserve because they're
>too clueless to read the documentation. That's really what we want!
See my post on perldoc...sometimes the documentation is as obtuse as
the problem...sorry, we're not all intuitive computer scientists...if
stupid questions are so stressful for some of you, well...as Frank
Zappa once said, it's not getting any smarter out there. What did you
expect? Platonic dialectics? It seems as if some of the Initiated are
getting revenge for all the times they were referred to as Geeks in
high school, and now they trot out their world-weary superiority as an
identity...I'm perfectly aware that lazy fools do in fact abuse this
service and need to be 'educated' as to protocol...but nit-picking
character assasination will not solve this problem, because the
Clueless will be ever thus...they cannot be insulted, and they will
continue to do stupid things regardless...so all you accomplish is the
elevation of your own stress level, and the humiliation of many who
don't deserve it. If this is so painful, why do you participate ? I
think that in SOME, but certainly not ALL cases, this posturing is an
ego thing...the supposed frustration with newbies is really both
necessary and a guilty pleasure for those with fragile egos and
self-esteem issues...
>
>I would strongly recommend learning Perl before you teach it.
>
>
>[I'm catching up on threads from the past week and a half. :) ]
------------------------------
Date: 22 Aug 1999 21:41:05 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7ppqph$ju4$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@delanet.com>],
who wrote in article <slrn7rv9bc.c9p.abigail@alexandra.delanet.com>:
> What of course really sucks in Perl is that you cannot easily do operator
> overloading, unless you resort to 'use overload'. Which of course, doesn't
> have overload magic for assignment or indexing.
Of course, you did not do
perldoc overload
for loooooooooooooong time.
> Oh, and don't even think of creating an overloaded operator with lazy
> evaluation/short circuiting. Or to overload an operator such that it
> takes a regex as argument.
Aha, and you do not read p5p either...
Ilya
------------------------------
Date: Sun, 22 Aug 1999 15:10:24 -0400
From: "Shannon Watters" <watterss@pilot.msu.edu>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <7ppi33$8oe$1@msunews.cl.msu.edu>
Xah <xah@best.com> wrote in message news:37bfe42c$0$221@nntp1.ba.best.com...
>
> Perl wouldn't be a nice community without bad asses like Tom Christensan,
> Chris Nador and some other regulars I don't want to mention now. We thrive
> on smiting newbies. We live to smite each other too. If you start to feel
> uncomfy, get out.
>
> un'stand?
>
It's easy to act like a tough guy over the net, isn't it?
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 616
*************************************