[13015] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 425 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 9 00:06:49 1999

Date: Sun, 8 Aug 1999 21:05:05 -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, 8 Aug 1999     Volume: 9 Number: 425

Today's topics:
    Re: a time to kill <tchrist@mox.perl.com>
    Re: a time to kill (Abigail)
    Re: a time to kill (Damian Conway)
        CGI Perl Properties <janshadebeach@email.msn.com>
    Re: CGI Perl Properties (Martien Verbruggen)
    Re: CGI Perl Properties (Abigail)
    Re: Chopping up a HUGE file <mj.stevenson@auckland.ac.nz>
    Re: Chopping up a HUGE file (Abigail)
    Re: FORM processing <bwalton@rochester.rr.com>
    Re: Nastiness contrary to the spirit of perl? (Matt)
    Re: Nastiness contrary to the spirit of perl? (Abigail)
    Re: Nastiness contrary to the spirit of perl? <cmcurtin@interhack.net>
    Re: Need help with Perl expression and replace <resource@ERASEjps.net>
        Poetry and Dr.W:s Manifesto <qwerty@post.utfors.se>
    Re: Problem with qx() under NT <bwalton@rochester.rr.com>
    Re: Solved: extracting terminology from text <bwalton@rochester.rr.com>
        String compare <Marius.Augenstein@alcatel.com.au>
    Re: String compare (Martien Verbruggen)
    Re: String compare <cmd@maths.uq.edu.au>
    Re: Translation of some nice little Perl scripts to pro <qwerty@post.utfors.se>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 8 Aug 1999 20:15:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: a time to kill
Message-Id: <37ae39c8@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
:You must have a trove of these for every 
:occasion.  I refuse to believe that it was extempore.

I cannot help you believe.  Belief must come from within.

But yes, I dreamt it up just for that posting.

--tom
-- 
 Additional parts and labor may be required at substantial
 additional cost


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

Date: 8 Aug 1999 21:31:39 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: a time to kill
Message-Id: <slrn7qsfbt.9fk.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXIX September
MCMXCIII in <URL:news:37ae2255@cs.colorado.edu>:
||      [courtesy cc of this posting mailed to cited author]
|| 
|| In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
|| :> > invented it, and it means just what I choose it to mean -- neither more
|| :> > nor less.
|| :> > Literary reference on that?  (Not you, Tom -- it's too easy.)
|| :> Alice in Wonderland - Humpty Dumpty said it.
|| :Wrong, but close - right.
|| 
|| Lewis Carroll, _Alice in Wonderland_:
|| 


The entire text of both `Alice in Wonderland' and `Through the Lookin Glass'
can be found on the web, thanks to the Project Gutenberg:

   <URL:http://www.gutenberg.net/_authors/carroll_lewis_.html>


Abigail
-- 
  `Cheshire Puss,' she began, rather timidly, as she did not at
all know whether it would like the name:  however, it only
grinned a little wider.  `Come, it's pleased so far,' thought
Alice, and she went on.  `Would you tell me, please, which way I
ought to go from here?'


  -----------== 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: 9 Aug 1999 02:45:25 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: a time to kill
Message-Id: <7olfc5$73f$1@towncrier.cc.monash.edu.au>


In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
> You must have a trove of these for every 
> occasion.  I refuse to believe that it was extempore.

	Let no-one doubt our Tom's command
	Of instantaneous lyric:
	He plucks them from the firmament
	In couplets most satiric.

	'Bout topics of the ancient past
	And those contemporaneous
	He weaves with equal souciance
	Quadrains extemporaneous.

	Indeed, I trow, on reading this
	Rejoinder to your doubt,
	Ere this verse scarce fades from his screen
	He'll "f" another out.


Damian


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

Date: Sun, 8 Aug 1999 21:14:22 -0500
From: "janshadebeach" <janshadebeach@email.msn.com>
Subject: CGI Perl Properties
Message-Id: <eeEqpzg4#GA.165@cpmsnbbsa03>

Hey, its me again. I would like to know what the major diffrenceses are
between Regular Perl and CGI Perl. You see, I'm making a automatic
registration system and a automatic scoring system. So hopefully I can make
this come to life on my pages soon.

Thank you for support. This is better than ANY 1-800 number :)
Kyle




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

Date: Mon, 09 Aug 1999 02:38:29 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CGI Perl Properties
Message-Id: <Farr3.1397$8E.7016@nsw.nnrp.telstra.net>

In article <eeEqpzg4#GA.165@cpmsnbbsa03>,
	"janshadebeach" <janshadebeach@email.msn.com> writes:
> Hey, its me again. I would like to know what the major diffrenceses are
> between Regular Perl and CGI Perl.

Regular Perl exists. CGI Perl does not exist. You can implement the
CGI in a perl program, preferably using the CGI module that comes with
the standard Perl. Perl is a programming language. CGI is an interface
specification, which can be implemented in (almost) any language.

>                                    You see, I'm making a automatic
> registration system and a automatic scoring system. So hopefully I can make
> this come to life on my pages soon.

I see.

> Thank you for support. This is better than ANY 1-800 number :)

But, we do require you to read some documentation before you post
questions like this. Do yourself a favour, and buy a good book
on Perl. Then buy a good book on CGI. And read some of the
documentation that comes with Perl.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd.       | but mean your mother.
NSW, Australia                      | 


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

Date: 8 Aug 1999 22:43:47 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CGI Perl Properties
Message-Id: <slrn7qsjj5.9fk.abigail@alexandra.delanet.com>

janshadebeach (janshadebeach@email.msn.com) wrote on MMCLXIX September
MCMXCIII in <URL:news:eeEqpzg4#GA.165@cpmsnbbsa03>:
::                    I would like to know what the major diffrenceses are
:: between Regular Perl and CGI Perl. You see, I'm making a automatic

   *  Regular Perl only comes in black, blue and red.
      CGI Perl comes in 256 different, shiny colours; all ugly.
   *  Regular Perl does not have build in ashtrays.
      CGI Perl has an ashtray at every chair, even if you don't smoke.
   *  Regular Perl uses real leather.
      CGI Perl uses imitation leather.
   *  Regular Perl has Tom Christiansen.
      CGI Perl has Matt Wright.
   *  Regular Perl has a 200 hp, 6 gear engine.
      CGI Perl has a 75 hp engine, and automatic transmission.
   *  Regular Perl has only one status LED.
      CGI Perl comes with 16 blinkenlights.
   *  Regular Perl comes with a type 4c keyboard.
      CGI Perl has the control key on a weird place, the ESC key in Alaska,
      and a space bar the size of the backspace key.
   *  Regular Perl is 98% fat free.
      CGI Perl _is_ fat.
   *  There are many good books about Regular Perl.
      There are no books about CGI Perl.
   *  Regular Perl uses Camels, Rams and Llamas.
      CGI Perl uses drop bears and hoop snakes.
   *  Regular Perl gets the job done.
      CGI Perl produces server errors.
   *  Regular Perl is free. 
      CGI Perl licenses are $3500/year/luser, and no source code.
   *  Regular Perl is water proof, up to 15 metres.
      CGI Perl is only water resistant.
   *  Regular Perl is available in small and large sizes.
      CGI Perl is only available in common sizes.
   *  Regular Perl tasts like Coke.
      CGI Perl tasts like Pepsi.
   *  #perl is a useful channel for Regular Perl users.
      #cgi is dead.
   *  Regular Perl has TPJ, TPC *and* YAPC.
      CGI Perl doesn't.
   *  Regular Perl has no Y2K problem.
      Noone knows whether CGI Perl does.

There are some minor differences as well, but they aren't important now.

I'd go for CGI Perl. Regular Perl seems to attract too many clueless people.




Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


  -----------== 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: Mon, 09 Aug 1999 14:07:36 +1200
From: Matthew Stevenson <mj.stevenson@auckland.ac.nz>
Subject: Re: Chopping up a HUGE file
Message-Id: <37AE37E8.8FAE0FD3@auckland.ac.nz>

Andy Chantrill wrote:

> I have a few HUGE files here that I use a script to parse ... my problem is
> however, that it is reading these files into arrays, which causes my
> computer to just run out of memory ...
> I don't want to chop up the file into many other smaller files before
> executing my script - disk space is also an issue  :o)

This is should work (not tested) or at least show you how to read a file
in a line at a time.

open(BIGFILE,"<Big_File_Name") || die;
open(BIGFILE2,">Big_File_Name2") || die;

while(<BIGFILE>){  ### $_ contains one line of BIGFILE
   # do your stuff to the line
   print BIGFILE2 $_;
}

or

@fifty_lines;
$i=0;
while(<BIGFILE>){
   if($i<=49){
      $fifty_lines[$i]=$_;
      $i++;
   }else{
      $i=0;
      #do your stuff on fifty_lines
      print BIGFILE2 @fifty_lines;
   }
}

 
-- 

Matthew Stevenson
University of Auckland
mj.stevenson@auckland.ac.nz
mavricknz@yahoo.com


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

Date: 8 Aug 1999 21:34:19 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Chopping up a HUGE file
Message-Id: <slrn7qsfgi.9fk.abigail@alexandra.delanet.com>

Andy Chantrill (andycha@globalnet.co.uk) wrote on MMCLXIX September
MCMXCIII in <URL:news:7ol849$h16$1@gxsn.com>:
--
-- I have a few HUGE files here that I use a script to parse ... my problem is
-- however, that it is reading these files into arrays, which causes my
-- computer to just run out of memory ...

Well, don't do it then!

-- How would I do this?


Have you read a book or the manual about reading files? Most, if not
all will start off with a method that seems to be suitable for your
needs. Both the "gobble everything in an array" and the "read it Mb
by Mb" are the exceptions, not the rule.



Abigail
-- 
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'


  -----------== 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, 08 Aug 1999 23:02:37 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: FORM processing
Message-Id: <37AE44CD.5041DD8E@rochester.rr.com>

>

 ...

> I'm working on a guestbook script but the problem thing is that I want
> 1 script file that is capable of handling different guestbooks. So the
> webpage calling the script has to pass on a variable containing its name, so
> the script knows which guestbook to update. Well thats the idea. Now did I
> find somewhere a good guestbook script and tried to
> implement my idea. But now comes the problem. The script uses a
> variable which is normally set in the script with the location to the
> guestbook file.
>    $GUESTBOOK="path/gbook.htm";
> now did I change this into
>   $GUESTBOOK= join "/","path",$fields{'filename'};
>
> but it just wont place the filename there, the filename string is empty! BUT
> when I add a line the script to print the value of filename to the file
> it shows up correctly. Thats the weird part of it.
>
> I also tried the following code to get the parameters passed on by the form
> (POST method)
>  @fields = split(/&/,$buffer);
>   foreach $field (@fields) {
>   ($name,$value) = split(/=/,$field);
>   $form{$name} = $value;}
>  $filename = $form{'filename'};
>
> but I get the same result, the $filename variable stays empty. But he knows
> the value of filename somewhere because he can print it to screen!!!!!
>
> Is there anybody who knows what I'm doing wrong? Or has an idea how to make
> a path and filename string on the fly using variables from the form? Thnx in
> advance

 ...
Sverre, if I read what you say correctly, you have two independent verifications
that the string "filename=whatever.ext" did not appear in the input to your CGI
script.  Therefore, you should verify carefully that an <input ...
name="filename"> field exists in your form (you are probably using a
type="hidden" field for this, right?).  The setting of variable $filename to the
name of the HTML file that activated the CGI script might possibly be a feature
of some method of decoding the CGI inputs (although it isn't a feature of any I
know of).

Your code above should work correctly if the "filename=whatever.ext" string is
actually coming in to your CGI script.

Also, you might have better luck with CGI issues on newsgroup
comp.infosystems.www.authoring.cgi :-).



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

Date: Mon, 09 Aug 1999 02:29:58 GMT
From: mck@iag.net (Matt)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <37b0390f.3479222@news.iag.net>

On 8 Aug 1999 23:27:32 GMT, sholden@pgrad.cs.usyd.edu.au (Sam Holden)
wrote:

>But did the posters continue to munge their From: lines? Did they continue
>to disregard conventions, or was it just another interesting and sometimes
>humourous thread? I suspect the later.

There was no munging there. I was using it an example of a less
reactionary, and thus more informative thread. We are all familiar
with the concept of a signal to noise ratio. I am looking here at a
high information to abuse ratio.

>I also suspect that comp.lang.tcl doesn't have the volume of clpm. Seeing
>I don't read it and there are only 4500 posts listed I am now sure that
>it doesn't.

You are correct.

>When the volume gets high people killfile. The normal attitude is that it is 
>better to miss a few good threads then it is to be bombardard by those who
>refuse to do the right thing. 

I agree it can be useful - unless used too indescriminately.

>You might send some useful posts in the future, lots of people won't see
>them, but that's a small price to pay.

Lots of people? Maybe. I have hope for this community that the
majority of people are more tolerant. If it is, then I (and those who
agree with my position), will benefit. We will not miss out on
potentially important information. If my hope is in vain, then this
group is useless to me. I will be diligent enough to get my needed
information elsewhere.

We all deal with junk information: posts, e-mail, mail, and phone
calls from salespeople. But at lease one in 10 junks turns out to be a
bit of useful info. I hope no one will unplug the phone, or weld the
mailbox shut.

>Making an error is one thing. Continually refusing to acknowledge that you
>have, and repeating the behaviour time and time again is a completely
>different story. That's the behaviour killfiles are for, if someone keeps
>sending Make Money Fast posts then killfile them, if someone keeps
>sending non-conformant posts then killfile them, if someone keeps asking
>FAQs then killfile them, if someone refuses to follow etiqutte then killfile
>them.

And I have acknowledged the error. I have stopped the "offensive
behavior" that so many get upset about. Yet you folks continue
repeating the killfile thing, no paitence, no forgiveness. That is the
problem with eliteism and intolerance. Like a brush fire, it can be
self sustaining, and eventually, good things get lost.

I agree with cancelling off topic or repeat offenders. However I truly
believe that openly chastising individuals who offer positive things
to the group is counter productive, can contrary to the spirit that
make open source projects like Perl better than commercial ones. Heck,
if I want abuse, I will go tell our NetWare support team to switch to
NT.

Oh well, I cannot seem to un-convince anyone here that a overly quick
killfile-trigger-finger is not a good thing. That is okay. Personally
I believe anyone too quick to ignore me is worth ignoring themselves.
They just take care of the work for me.

Anyway, I entered this thread not to argue about killfiles, but with
an agreement with the original post. My idea is that this group could
be made better by the _positive_ actions from those who _have useful
things to contribute_. I have positive things. You have positive
things. The spammers are not contributing to the thread. 

Some folks just cannot agree.


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

Date: 8 Aug 1999 22:23:49 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <slrn7qsidm.9fk.abigail@alexandra.delanet.com>

Matt (mck@iag.net) wrote on MMCLXIX September MCMXCIII in
<URL:news:37b0390f.3479222@news.iag.net>:
|| 
|| There was no munging there. I was using it an example of a less
|| reactionary, and thus more informative thread. We are all familiar
|| with the concept of a signal to noise ratio. I am looking here at a
|| high information to abuse ratio.

And he goes off with yet another rant about this group.

If you can't contribute, please shut up.


*ploink*


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== 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: 09 Aug 1999 00:00:20 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <xlxd7wxwqln.fsf@gold.cis.ohio-state.edu>

>>>>> On Mon, 09 Aug 1999 02:29:58 GMT, mck@iag.net (Matt) said:

Matt> We all deal with junk information: posts, 

Killfiled before being seen.

Matt> e-mail,

Piped to adcomplain(1), body unread.

Matt> mail,

Discarded, unopened.

Matt> phone calls

Nope; when I actually answer the phone, I answer in Russian. :-)

Matt> Oh well, I cannot seem to un-convince anyone here that a overly
Matt> quick killfile-trigger-finger is not a good thing. That is
Matt> okay. Personally I believe anyone too quick to ignore me is
Matt> worth ignoring themselves.  They just take care of the work for
Matt> me.

One really oughtn't take presence in another's killfile personally.  A 
simple fact of busy newsgroups is that many savvy readers will seek to 
reduce the amount of content that they see.  That means ignoring some
posts. 

In my case, I actually start with *everything* killed.  I don't see
any articles unless they're specifically scored higher than 0 by my
newsreader.  This isn't to exclude people who might post interesting
things; it's a simple matter of practicality.  I've got more than 500
groups to watch (that includes ClariNet).  If I tried to read news any 
other way, it would take just too much time.  (Actually, the way that
I do scoring, using a combination of homegrown score files and the
adapative scoring feature in Gnus, it does a remarkable job of showing 
me only what I want to see.)

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: Sun, 08 Aug 1999 19:26:07 -0700
From: Warren Bell <resource@ERASEjps.net>
Subject: Re: Need help with Perl expression and replace
Message-Id: <37AE3C3F.76BA1BCB@ERASEjps.net>

Actually I need it to strip any quote within an html tag. Any quotes
outside a html tag wont get striped. Anyone have any ideas?


Warren Bell wrote:
> 
> I'm trying to make an expression in a script that says somthing like:
> 
> If line of text contains <img src="anything" anything> replace it with
> <img src=anything anything>.  The anything would be any charactor.
> 
> What I'm trying to do is strip any quotes from any IMG tag, but only IMG
> tags.  How can I do this in perl?
> 
> Right now I'm using a sad hack that looks like this:
> 
> $message =~ s/<img src="/<img src=/g;
> $message =~ s/gif"/gif/g;
> $message =~ s/jpg"/jpg/g;
> 
> etc..
> 
> Thanks,
> Warren Bell
> 
> --
> ####### Remove ERASE to reply #######

-- 
####### Remove ERASE to reply #######


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

Date: Sun, 08 Aug 1999 05:07:22 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Poetry and Dr.W:s Manifesto
Message-Id: <37ACF46A.470481FE@post.utfors.se>

Mejckr0ß0fft$ blizzual C-- sucks...
it's the worst uglyf-cked 'program'
that has ever seen daylight.
g++ rules.
punk ass gnome can suck my weiner..
 ..It's just copy&paste C, with unresuable code.
(like C's supposed to be)
Motif is just more C-crap... but kind of useful(java's linked against
that stuff).
Why doesnt those Motifweirdos make it
Gnu or open source? and make MotifC++(for the 2000)
Java is faster than the speed of light on my other computer.
I'ts a Cray T3e-1200e(own port).
On anything less than an ultrasparc 30 you'll lose all your
hair and grow 50" beard before the javacompiler has done its stuff.
(preferably with >1Gb sram).
Perl is useful, and has got highest speed with least trouble.
anyone tried regexps in C? (I did once, never again).
It is still missing some windowing interface for X11.
Tk just won't do with less than a cray. The dialog boxes never draw.
and that perl gtk-stuff hasn't any docs ..more than a few that sucks.
Why is some people still using the Athena-widgets?
do they work fulltime as crashtestdummies(with serious braindamages)?
I am Dr. Who, that's who I am.
This is my punk ass manifesto.
Like it or not.

Br.
Dr.Who

---------------
http://www.fugly.net
---------------



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

Date: Sun, 08 Aug 1999 22:34:03 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Problem with qx() under NT
Message-Id: <37AE3E1B.963A46F3@rochester.rr.com>

 ...

> I'm porting a set of Perl scripts from UNIX to NT and can't figure out what's
> wrong with the following use of qx().
> This is ActiveState Perl and the Cygwin bash shell.
>
> I have a file 'h' which contains one line of the text: 'hello',
> a perl script 'a':
>     #!/usr/local/bin/perl5
>     #
>     print qx(cat h);
>     print qx(headoff h);
>
> and perl script 'headoff':
>     #!/usr/local/bin/perl5
>     ###############################
>     die "usage: headoff\n" if @ARGV != 0;

>
> Running a gives the following:
> bash-2.02$ a
> hello
> The name specified is not recognized as an
> internal or external command, operable program or batch file.
> bash-2.02$
>
> i.e., the qx(cat h) works but the qx(headoff) does not.
>
> Running headoff at the shell works too:
> bash-2.02$ headoff h
> usage: headoff
>

 ...
Larry, probably the qx operator is running NT's "cmd" shell, not the bash shell you
are thinking it is running.  That is probably not Perl's fault, but rather is the
default behavior of NT when attempting to run a command.  Under the "cmd" shell,
"cat h" will work, because "cat" is actually cat.exe, and cmd can locate it on the
path.  However, "headoff" probably doesn't have a filename extension, and "cmd"
doesn't pay any attention to such goodies as the #! line in your script (and in
fact won't even see your file unless its extension is on a short list of executable
extensions like .exe, .bat, ...).  Thus "cmd" doesn't find your script.  Your best
deal would be to run Linux, where things just work; your second best deal might be
to put a .bat file wrapper around "headoff", making it "headoff.bat"; or make a
separate little headoff.bat file that fires up Perl with your script; or perhaps
tell NT to use bash as its command shell.  I can't remember how to do that (it
involves an environment variable, maybe CMDSHELL?), and I don't know if that is
actually advisable (gobs of NT stuff might break).



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

Date: Sun, 08 Aug 1999 22:08:57 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Solved: extracting terminology from text
Message-Id: <37AE3838.400E5C0E@rochester.rr.com>

>

 ...

> Also, there was a problem with regex \W+ as word delimiter (does not
> take into account existence of various accented chars in various
> languages), so that required a simple solution, too...
> ...

<long script deleted>
 ...
Would

use locale;

have been a bit easier?



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

Date: Mon, 09 Aug 1999 13:07:29 +1000
From: Marius Augenstein <Marius.Augenstein@alcatel.com.au>
Subject: String compare
Message-Id: <37AE45F1.1590DCCA@alcatel.com.au>

Hy there

I have to read a html-file and compare the actual readen line with a
previous defined one.

e.g.
  open FILE, "xyz.html" or die "Can't open xyz.html";
  open TEMP, "tmp.html" or die "Can't open tmp.html";
  $stopstring = "<!-- New tableentry after this indicator -->";

  while (<FILE>) {
	if ( /$stopstring/ ) { 
		print TEMP "<!-- New tableentry after this indicator -->\n";
		print TEMP "<TR><TD>New entry</TD></TR>\n";
	}
	else {
		print TEMP "$_";
	} 
  }
  close TEMP;
  close FILE;
  system ("mv tmp.html xyz.html");

What's wrong with it ?? 

Thanks in advance .... Marius


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

Date: Mon, 09 Aug 1999 03:53:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: String compare
Message-Id: <bhsr3.1633$8E.8883@nsw.nnrp.telstra.net>

In article <37AE45F1.1590DCCA@alcatel.com.au>,
	Marius Augenstein <Marius.Augenstein@alcatel.com.au> writes:

Do you have the -w flag and use strict? If not, please, add them.

>   open FILE, "xyz.html" or die "Can't open xyz.html";
>   open TEMP, "tmp.html" or die "Can't open tmp.html";

You check for errors. Very good. You should add the $! variable in
your error message, which will tell you what exactly went wrong.

>   $stopstring = "<!-- New tableentry after this indicator -->";

There is no need for the double quotes. Single quotes would do better
here. You are not trying to interpolate anything, so why ask for it.

>   while (<FILE>) {
> 	if ( /$stopstring/ ) { 

To avoid interpretation of any possible re metacharacters in that
string:

if ( /\Q$stopstring\E/ )

# perldoc perlre

But... Are you sure you want to match a line that _contains_ the
$stopstring, or that _is_ the $stopstring? If the latter, a eq would
do better. Make sure that your $stopstring contains the newline as
well in that case.

> 		print TEMP "<!-- New tableentry after this indicator -->\n";

Why create two spots in your code where you have to maintain this
string?

print TEMP $stopstring, "\n";

You opened TEMP for reading, but you are trying to write to it here.
Your open line should have been something like:

open(TEMP, '>tmp.html') || die "Can't open tmp.html for write: $!";

> 		print TEMP "<TR><TD>New entry</TD></TR>\n";
> 	}
> 	else {
> 		print TEMP "$_";

Obsolete quotes. Obsolete use of $_. The print function by default
prints $_ if nothing is specified. If you want to specify $_
explicitly anyway, at least leave off the quotes.

> 	} 

The whole block inside the while could be written like:

{
	print TEMP;

	if (/\Q$stopstring/)
	{
		print TEMP "<TR><TD>New entry</TD></TR>\n";
	}
}

>   }
>   close TEMP;
>   close FILE;
>   system ("mv tmp.html xyz.html");

Why shell out when you can use a perfectly fine builtin function for
this?

rename('tmp.html', 'xyz,html') || 
	die "Couldn't rename tmp.html to xyz.html: $!";

> What's wrong with it ?? 

Not that much. I suspect that what you were asking was about the wrong
open. For future reference: When you ask 'what's wrong with this',
describe what you want it to do, and what it doesn't do. Describe any
error messages or unexpected behaviour. Don't make us guess what you
mean. We don't have enough time to do that. We are not here to review
code.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.       | from a rich salesperson.
NSW, Australia                      | 


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

Date: Mon, 09 Aug 1999 14:14:04 +1000
From: chris <cmd@maths.uq.edu.au>
Subject: Re: String compare
Message-Id: <37AE558C.C773B9AD@maths.uq.edu.au>

Marius Augenstein wrote:
> 
> Hy there
> 
> I have to read a html-file and compare the actual readen line with a
> previous defined one.
> 
>   open TEMP, "tmp.html" or die "Can't open tmp.html";

open TEMP, ">tmp.html" or die ...
if you're writing to the file.

> 
> What's wrong with it ??

Do I win a holiday for two or something?

Chris


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

Date: Sun, 08 Aug 1999 05:17:02 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Re: Translation of some nice little Perl scripts to produce an  executable program.
Message-Id: <37ACF6AE.CE89AF8F@post.utfors.se>

Abigail wrote:

> angela (anonymous@web.remarq.com) wrote on MMCLXVIII September MCMXCIII
> in <URL:news:934137257.10424@www.remarq.com>:
> `` Hi,
> `` We have created some nice little Perl scripts, that run
> `` under <A HREF = {CENSORED}>{CENSORED}</A>
> ``
> `` Now we are looking for someone, who is able to translate
> `` these scipts into a language that allows executable programs
> ``  to run on a PC.
>
> Ah, that's simple:
>
>     perl -pi -we0  file1 file2 ... filen
>
> That will translate your Perl programs into a language that allows
> executable programs to run on a PC. That is, a PC running DOS, Windows,
> Unix, ....
>
> Abigail
> --
> perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
> .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
> .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
> %$^U;$^V/=$^U}while$^V!=$^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 ==-----

-
hmm .. I was looking at your homepage ..
are you really a female? how old? married? ;)




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

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". 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 V9 Issue 425
*************************************


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