[11967] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5567 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 5 03:07:17 1999

Date: Wed, 5 May 99 00:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 May 1999     Volume: 8 Number: 5567

Today's topics:
    Re: "learning perl" does not seem to be written well (David H. Adler)
    Re: "learning perl" does not seem to be written well (Andrew Johnson)
    Re: ANNOUNCE: Experienced perl programmer needed! <design@raincloud-studios.com>
    Re: Another script question - please help ! <design@raincloud-studios.com>
    Re: Another script question - please help ! <ebohlman@netcom.com>
        Creating a file on a different NT File Server chipa@nwlink.com
        Dumb Question <JFedor@datacom-css.com>
    Re: Dumb Question <egwong@netcom.com>
    Re: Dumb Question (Sam Holden)
    Re: Dumb Question <JFedor@datacom-css.com>
        embedding Perl in C++ .. ostream problems <hilgart@uiuc.edu>
    Re: having problems getting this script to work... <hawkwynd@adelphia.net>
    Re: I'm new - Please help - Sorting Question (Tad McClellan)
    Re: Limit to number of if statements??? (Larry Rosler)
    Re: Limit to number of if statements??? (Ilya Zakharevich)
    Re: Making executables from .pl files? smnayeem@my-dejanews.com
    Re: May 3rd, SV.pm First Meeting!! (David H. Adler)
    Re: Newbie having problems getting this script to work. (Larry Rosler)
    Re: Perl 5: The Complete Reference, Martin Brown (Larry Rosler)
    Re: Perl Editors On Win32 (Lai L F)
        question about Curses (GEMINI)
    Re: question on regex... (Larry Rosler)
    Re: What's the difference between Perl and CGI? goodguys@my-dejanews.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 5 May 1999 02:03:42 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <slrn7ivnpt.5cq.dha@panix.com>

On Tue, 04 May 1999 16:36:25 -0700, David Cassell
<cassell@mail.cor.epa.gov> wrote:

>A Masters in anthro?  Neat!  
>
>So you opted to program rather than wave a fan in Dilbert's office,
>huh?  :-)
>
>David {who started college as an English major...}

Ha!  I've got you both beat.  I've got a degree in Philosophy!  Ha!

:-)

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
All hail El Cabeza Del Oro!


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

Date: Wed, 05 May 1999 06:37:40 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <UGRX2.1018$VK.381067@news2.rdc1.on.home.com>

In article <slrn7ivnpt.5cq.dha@panix.com>,
 David H. Adler <dha@panix.com> wrote:
!  On Tue, 04 May 1999 16:36:25 -0700, David Cassell
!  <cassell@mail.cor.epa.gov> wrote:
! 
!  >A Masters in anthro?  Neat!  

well, yeah...'neat' sums it up nicely :-)

!  >So you opted to program rather than wave a fan in Dilbert's office,
!  >huh?  :-)

something like that...but I did my fan-waving while digging bones
in the desert northeast of Cairo (and it didn't help any). But,
I did use Perl to munge (not fudge) data when I got back!

!  >David {who started college as an English major...}

there are worse things to do in college ...
  
!  Ha!  I've got you both beat.  I've got a degree in Philosophy!  Ha!

see!

:-)

regards
andrew

-- 
Andrew L. Johnson   http://members.home.com/andrew-johnson/
      The generation of random numbers is too 
      important to be left to chance.


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

Date: Wed, 05 May 1999 06:34:59 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: ANNOUNCE: Experienced perl programmer needed!
Message-Id: <nERX2.1643$iu1.1412@news.rdc1.tn.home.com>

>Universal Studios.

A monster the size of King Kong can only be tamed by Perl.

CT




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

Date: Wed, 05 May 1999 06:13:49 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Another script question - please help !
Message-Id: <xkRX2.1640$iu1.1181@news.rdc1.tn.home.com>

>Thanks for everyone's help on my last CGI question.  I have a second
CGI
>question I need help with.  I have a web-site (let's call it Site 1)
>where I need to continually update a second web-site (lets say Site 2)
>with info from Site 1 by filling in fields and then hitting a submit
>button. I want to try to find a way to automate this process, as I end
>up doing this over 5 times a day.
>
>Is there any way to have my web site (Site 1) automatically go onto
Site
>2, and use
>information on Site 1 to fill out a couple of fields, and then have the
>information
>submitted? Does anyone know how to do it, or can someone point me in
>the  right
>direction?

>Thanks in advance, and please email me if you can  :)

If you find time to submit forms over 5 times a day, you can find time
to come back here for your answer. :)


I'm no logistics genius here but I think you are coming at this from the
wrong angle.

What's so special about the Site1 submission? From your viewpoint I see
you are trying to make a computer perform a human task. You are using
human interface terms to solve your problem. It'll never fly that way.

Make it a computer task and it will make much more sense. Computers
don't have fingers and have no use for submit buttons, pretty pictures,
or things like soda pop and dirty magazines. (Why does all this seem
familar? :O)

This reminds me of when I was often asked how to make a button in
Windows automatically get clicked in programming. I always said.. 'click
it when you feel the need... that's pretty automatic'.

1) If the script requires using a human interface, then it requires a
human to interface with it. Using one of those ugly little buttons no
doubt.
2) If it requires information that only a human can input in a form,
then it requires a human.
3) If 1 and 2 are true in any combination, then automation is most
likely impossible. Unless of course you can get your hands on some
surplus NASA apes.

It's obvious that if you already have communication between the Sites
(which is indicated by your email) then you already have the means in
front of you. You need to forget CGI for this and rewrite your scripts
to communicate between two computers. Pretend it's two computers on a
network (ok.. so it takes 0 imagination because it's true) and appraoch
it from that angle. Take the human equation out or you'll be second
guessing yourself for months.

I don't know what protocols or modules you'll need (The otehr guys here
do), but I do know you're slightly skewed in your landing pattern.

HTH,

CT
-------
speaking of automation...

Perl makes me sleepy.
No wait... that's beer.
Gosh... Perl *can* do anything.




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

Date: Wed, 5 May 1999 06:29:57 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Another script question - please help !
Message-Id: <ebohlmanFB8y1x.3Et@netcom.com>

andrij <andrij@mail.idt.net> wrote:
: Is there any way to have my web site (Site 1) automatically go onto Site
: 2, and use
: information on Site 1 to fill out a couple of fields, and then have the
: information
: submitted? Does anyone know how to do it, or can someone point me in
: the  right
: direction?  Thanks in advance, and please email me if you can  :)

As someone else pointed out, this task seems daunting to you because 
you're thinking about it at the wrong level.  Filling out fields is 
something that a person does on a browser.  What you want is for your 
program to the same thing that a browser would do *after* the human 
submitted the form: make an HTTP connection to site 2 and issue either a 
GET or POST (depending on which site 2 is set up to take) request 
specifying the URL for the script on site 2 and the data to be sent to 
site 2.  Note that this can be accomplished without your program having 
to retrieve the form from site 2; you just need to find out what 
parameter names and values the script on site 2 wants.

Since this is a Perl group, I'll point out that although what you want to 
do can be done in any language, Perl has the LWP:: series of modules, 
which specialize in making HTTP connections to remote systems, making 
requests for resources, and returning the results.  You'll almost 
certainly want to use LWP for this task.



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

Date: Wed, 05 May 1999 06:30:20 GMT
From: chipa@nwlink.com
Subject: Creating a file on a different NT File Server
Message-Id: <7gooht$q6m$1@nnrp1.dejanews.com>

I'm trying to create a CGI/Perl script that creates a new file on a different
NT File Server over my LAN.  The script works fine when I pass in a directory
on the local machine (i.e., "c:\test.txt") but fails when I use a network
directory (i.e., "g:\test.txt").  I suspect its a NT permission thing but I'm
not sure where to set the proper settings.  I tried granting "Full Access"
permissions on the File share (G:) and the destination directory, but no
luck.  I guess I have to grant permission to "Perl" and/or my webserver (IIS)
but I'm stumped about where I do that.

I realize this isn't exactly a Perl question but I'm hoping someone has run
into this issue before and can post a quick solution.

FWIW, This is using NT 4.0 Server (service pack 4), IIS 4.0, and ActivePerl
509.

Thanks in advance,
Chip

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 5 May 1999 01:53:17 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Dumb Question
Message-Id: <7gokr9$nq0$1@plonk.apk.net>

my $query = $ENV{'QUERY_STRING'};
????????  $query =~ s/&*//; ??????????
$query =~ s/s=//;
$query =~ s/%[0-9a-fA-F]{2}/ /g;
my @words = ($query =~ /\w+/g);


OK, a dumb question, I'm trying to ignore anything in the query string after
&

The ????? line did not remove or truncate the rest of the string like i
wanted it to.

What I'm receiving from the browser:
http://www.???.???/cgi-bin/search.pl?s=epson+ribbons&x=30&y=11

I don't need the co-ordinates but they are never the same so I can't use
something like this:

$query =~ s/&??????????//;

I'm not sure if & needs to be escaped with \ but I tried it that way too and
it didn't work.

Just another dumb question from someone trying to learn while doing.

Thanks in advance for the help.




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

Date: Wed, 5 May 1999 05:43:28 GMT
From: Eric Wong <egwong@netcom.com>
Subject: Re: Dumb Question
Message-Id: <egwongFB8vwG.MH8@netcom.com>

Jody Fedor <JFedor@datacom-css.com> wrote:
: my $query = $ENV{'QUERY_STRING'};
: ????????  $query =~ s/&*//; ??????????

$query =~ s/&.*//;

The way you have it, you're searching for zero or more instances
of "&"; instead you want to match "&" *and* whatever follows.
See the perlre manpage for more detail.  By the way, for cgi work,
I'd suggest using CGI.pm (at CPAN, of course.)

Eric
[cc'd]


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

Date: 5 May 1999 05:50:57 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Dumb Question
Message-Id: <slrn7ivn21.nu.sholden@pgrad.cs.usyd.edu.au>

On Wed, 5 May 1999 01:53:17 -0400, Jody Fedor <JFedor@datacom-css.com> wrote:
>my $query = $ENV{'QUERY_STRING'};
>????????  $query =~ s/&*//; ??????????

That remove 0 or more sequential occurances of &. Since the beginning of
ths string has 0 ampersands it removes those ones and thus leaves the
string untouched.

Regular expressions are not globs. * does not match zero or more
sequential occurances of anything. * matches zero or more sequential
occurances of whatever it follows.

If you read the perlre documentation that comes with perl you will
find some documentation that tells you how regular expressions work.

The information on what . means would be particularly relevant and extremely
useful in solving your problem.
>$query =~ s/s=//;
>$query =~ s/%[0-9a-fA-F]{2}/ /g;
>my @words = ($query =~ /\w+/g);

Those last two lines would indicate that you know what * does... It works
in a similar way to {2} and + after all.

>What I'm receiving from the browser:
>http://www.???.???/cgi-bin/search.pl?s=epson+ribbons&x=30&y=11

You really shouldn't do CGI stuff by hand. Use something like CGI.pm
and a lot of problems will go away...


-- 
Sam

You can blame it all on the internet. I do...
	--Larry Wall


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

Date: Wed, 5 May 1999 02:27:16 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Dumb Question
Message-Id: <7gomqu$p12$1@plonk.apk.net>

Another Dumb Question...
        I have Active State Perl on my Win 95 machine...  How do i get the
perlre manpages?

        I know the perldoc -q "Question Here"  seems to work fine.
        I also have "Programming Perl" by O'Reilly
                            "Perl In A Nutshell" by O'Reilly
                            "Perl Cookbook" by O'Reilly  and last but not
least
                            "Advanced Perl Programming" by O'Reilly.

After you telling me about the .  I found it on page 68 of Perl in a
nutshell and I understand now.  Sometimes it just takes someone smarter than
you to point you in the right direction...

Thanks!

Jody

Eric Wong wrote in message ...
>Jody Fedor <JFedor@datacom-css.com> wrote:
>: my $query = $ENV{'QUERY_STRING'};
>: ????????  $query =~ s/&*//; ??????????
>
>$query =~ s/&.*//;
>
>The way you have it, you're searching for zero or more instances
>of "&"; instead you want to match "&" *and* whatever follows.
>See the perlre manpage for more detail.  By the way, for cgi work,
>I'd suggest using CGI.pm (at CPAN, of course.)
>
>Eric
>[cc'd]




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

Date: Wed, 05 May 1999 01:31:32 -0500
From: Mark Hilgart <hilgart@uiuc.edu>
Subject: embedding Perl in C++ .. ostream problems
Message-Id: <372FE5C4.F47CEAFC@uiuc.edu>


I have Perl embedded in my C++ program, but I can't include iostream.h
or any other headers that define the >> or << operators.  I'm including
EXTERN.h and perl.h as shown in the perlembed man page.  Anyone know why
this is?  I got around it by using printf instead of cout, but now I
need to use map, which defines the >> and << operators.  I'm using Linux
(RedHat 5.2) and Perl 5.005p2.  Here's what I get:

g++ -g -o mas mas.cc `perl -MExtUtils::Embed -e ccopts -e ldopts`
In file included from /usr/include/g++/stl_algobase.h:53,
                 from /usr/include/g++/stl_tree.h:56,
                 from /usr/include/g++/tree.h:33,
                 from /usr/include/g++/map.h:30,
                 from mas.cc:21:
/usr/include/g++/iostream.h:97: `ostream::operator <<(char)' is already
defined in class ostream
/usr/include/g++/iostream.h:216: `istream::operator >>(char &)' is
already defined in the class istream
make: *** [mas] Error 1

If I don't include map.h, my program works great.  Help!

-- 
Mark Hilgart                          http://www.ews.uiuc.edu/~hilgart
hilgart@uiuc.edu                            ICQ: 569586   AIM: Guess98


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

Date: Wed, 05 May 1999 06:18:33 GMT
From: "Hawkwynd" <hawkwynd@adelphia.net>
Subject: Re: having problems getting this script to work...
Message-Id: <ZoRX2.416$5g5.3867@server1.news.adelphia.net>


Bob Trieger wrote in message <7gobjr$bvg$1@birch.prod.itd.earthlink.net>...
>[ courtesy cc sent by mail if address not munged ]
>[ alt.perl removed from newsgroup line ]


>Looks like you gave it an honest. But please use a more accurate subject
>line from now on. Preferably one that doesn't include that
>fingernails-across-the-blackboard word "newbie".


Point well taken, thanks. No more nails on the blackboard.


>This code was a mess, which is just what you expect from somebody new.
>But, you need to slow down and take it one step at a time. Learn the
>syntax for one function before moving on to the next and don't try and
>learn everything at once.


I've begun reading all I can get my eyeballs onto, and still come up with a
headache, and a full ashtray.

Note: This is run on Perl for windows, Active perl

Here's what I understand so far:

#!c:/perl -w
$file_dir = "C:/wp";
opendir DIR,$file_dir or die "Error: unable to open $file_dir:$!";
# Open the directory
my @myarray = (readdir(DIR));
# Get my array list of files in dir
print map  {"$_\n" } @myarray;
# list the files on the screen
close DIR;
# Close the dir

To this point, I've created an array that holds the filenames in the c:/wp
folder.

Next step, is to be able to open each text file listed in the array, to
perform a search and replace:

foreach (@myarray) {

Open the file, for read, and assign the data in that file to a variable:

open(INF," $Iamlosthere")


Basically, I'm trying to be able to read the files one by one in a
directory, which are all .txt files. Within each file contains two
characters that have to be removed, afterwards, saving each file without the
 .TXT extension and trimming off the 1st 3 letters of the filename.

Example:

in the dir are:

33_1234.txt
33_1235.txt
33_1236.txt
and so on...

Open file, and remove ascii char 13 and 14, which appear as the male sex
symbol in ASCII editor, and the note character.
Then save the file like:

1234
1235
1236

This is killing me, as I usually write perl scripts for my web site, and
somehow I'm losing touch here.

Back to the books, and I appreciate any pointers you might have..

Scott Fleming





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

Date: Tue, 4 May 1999 19:53:41 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: I'm new - Please help - Sorting Question
Message-Id: <5a1og7.bo4.ln@magna.metronet.com>

Chance Houston (news@i-tradeonline.com) wrote:

: My database is a text file that looks like this . . .

: major_category|sub_category|site_url|site_title|description|feature|graphic|keywords|clickCount

: What is the best way to sort my search results by the last item (clickCount)?

: A simple answer is all that I'm looking for.


   Perl FAQ, part 4:

      "How do I sort an array by (anything)?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 4 May 1999 22:32:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Limit to number of if statements???
Message-Id: <MPG.119977cce4b7b79a9899c8@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <foqng7.ij4.ln@magna.metronet.com> on Tue, 4 May 1999 
18:01:51 -0400, Tad McClellan <tadmc@metronet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote:
> : [Posted and a courtesy copy mailed.]
> 
>    Talking to yourself Larry?

Yes, habit!  See above.  I very seldom follow up my own posts.

I noticed right away, because I got the mail really fast. :-)  But I 
didn't think anyone else would notice.

>    heh, heh
> 
> : In article <MPG.11990c0687eea23e9899ba@nntp.hpl.hp.com> on Tue, 4 May 
> : 1999 14:52:42 -0700, Larry Rosler <lr@hpl.hp.com> says... 
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas

Still missing the trailing space in the cut line... 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 5 May 1999 06:13:11 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Limit to number of if statements???
Message-Id: <7gonhn$7tn$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.11990c0687eea23e9899ba@nntp.hpl.hp.com>:
> Too neat, unfortunately.  What happens if the hash lookup fails?
> 
>   	&{defined $town_to_builder{$FORM{Key4}} ?
>              $town_to_builder{$FORM{Key4}} : \&unreferred}};

if (exists $town_to_builder{$FORM{Key4}) {
   $town_to_builder{$FORM{Key4}}->();
} else {
   do_something;
}

Ilya


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

Date: Wed, 05 May 1999 05:59:01 GMT
From: smnayeem@my-dejanews.com
Subject: Re: Making executables from .pl files?
Message-Id: <7gomn3$op5$1@nnrp1.dejanews.com>

In article <372f7f73@cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>  [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
>     "Asbjorn Gjemmestad" <agjemmes@extremeonline.com> writes:
> :I am looking for a way to make executables
>
> chmod +x
>
> :from my .pl files
>
> What would you execute a library?
>
> :to avoid
> :shipping my source code with my programs.
>
> Don't ship the programs.
>
> :I know perl2exe does just that,
>
> It does?  Look closely.
>
> :but they charge $500 for a full package, so I thought I'd check in here
> :first.

But say what if i want to send a copy of my file to someone who doesnt have
perl installed. With the present way of distributing i have to go to every
place and install perl (or have them install it) before my program can be of
any use. isnt that like making it cause too much of an overhead?

smnayeem

> :I need to compile files
>
> No, you don't.
>
> :for at least unix systems (as many variations as
> :possible), but hopefully also windows and solaris. Can anyone help me?
>
> Probably, but ability and volition may have different values here.
>
> --tom
> --
>     I think I'm likely to be certified before Perl is...  :-)
>         --Larry Wall in <1995Feb12.061604.6008@netlabs.com>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 5 May 1999 02:27:55 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: May 3rd, SV.pm First Meeting!!
Message-Id: <slrn7ivp7a.5cq.dha@panix.com>

On Thu, 29 Apr 1999 07:21:22 GMT, Craig R. Belcham <crb@highpoint.co.uk> wrote:
>fxia@yahoo.com wrote:
>
>>  Next Meeting     Monday, May 3, 1999 7:00 pm
>
>A PERL mongers meeting on my birthday, Im touched!:)

Heck, I *called* a meeting for *my* birthday.  Oh, wait, I'm a group
leader... I can do that.  Never mind...

:-)

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"...for all you know we're a bunch of malcontents who couldn't get
sci.corned-beef, and are going to reject all the submitted articles
that aren't about corned beef." - Mark-Jason Dominus


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

Date: Tue, 4 May 1999 22:21:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie having problems getting this script to work...
Message-Id: <MPG.119975393451403e9899c7@nntp.hpl.hp.com>

In article <7gobjr$bvg$1@birch.prod.itd.earthlink.net> on Wed, 05 May 
1999 03:02:14 GMT, Bob Trieger <sowmaster@juicepigs.com> says...
> Looks like you gave it an honest.

So did you -- a valiant effort!  Please don't mind if I pick some nits 
and correct one real error.

 ...
>         opendir DIR,"$file_dir" or die "Can't open $file_dir: $!";

Nit:  Supefluous quotes on $file_dir.
 
> >@myarray = ((join("\n", readdir($file_dir)). "\n"));   # Get all files,
> 
> nope:
>         my @myarray = defined(readdir(DIR));

Bug:  This makes @myarray be (1).  Kill the 'defined'!

 ...
> >$myarray = ~s/33_/ /g;     # Remove the 33_ prefix from filename
> >$myarray = ~s/.txt/ /g;     # Remove the .txt extension from filename
> 
> There is still no $myarray variable defined.
> You need to escape that . (period) and the g switch here is unneeded 
> unless you plan on having ".txt" in the file more than once.

Oversights (= ~ must be written as =~; add anchors):

   $myarray =~ s/^33_//;     # Remove the 33_ prefix from filename
   $myarray =~ s/\.txt$//;   # Remove the .txt extension from filename

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 4 May 1999 22:00:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl 5: The Complete Reference, Martin Brown
Message-Id: <MPG.1199703c9d9a64289899c6@nntp.hpl.hp.com>

In article <7gof41$omg$1@towncrier.cc.monash.edu.au> on 5 May 1999 
03:49:21 GMT, Damian Conway <damian@cs.monash.edu.au> says...
> tadmc@metronet.com (Tad McClellan) grammar-flames:
> >   It isn't even English!
> >   I thought you weren't supposed to use a preposition to
> >   end a sentence with.
> 
> Tad's right on the money with his other criticisms--such blatant and
> foolish mistakes are unpardonable in a professionally published book.
> But it's a disservice to propagate (even in jest) the myth of never
> ending on a preposition.
 ...
> PSS: Just to forestall the inevitable counter-flames, it's also perfectly
>      acceptible to begin a sentence with "But..."
       acceptable  :-)

Mr. Winston Churchill was once publicly reprimanded for ending a 
sentence with a preposition. 

"Mr. Churchill," he was told, "one should never end one's sentence with 
a preposition!" 

"Madame," he replied, "that is a rule up with which I shall not put."  

[Authoratative citation not available.  :-]

And then of course there's the one about the convict who was knifed to 
death in the prison's shower room.  He ended his sentence with a 
proposition.

[I'd better stop now.  No way to find Perl in this post!]

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 5 May 1999 05:33:01 GMT
From: csclailf@leonis.nus.edu.sg (Lai L F)
Subject: Re: Perl Editors On Win32
Message-Id: <7gol6d$1er$1@nuscc.nus.edu.sg>

: Ian Taite <ian.taite@nospam.zen.co.uk> wrote in message
: news:Qc4V2.20256$Hh5.2084@news-reader.bt.net...
: > Anyone know of a free full screen editor running under Windows NT
: > that's Perl aware? i.e. colour codes the program source
: > Ian.
: >

Try gvim from http://www.vim.org


--

==============================================================================
Lai Loong Fong                    |  email: mailto:csclailf@leonis.nus.edu.sg
Computational Science Department  |  WWW: http://www.cz3.nus.edu.sg/~lailf
National University of Singapore  |       http://lai.cz.nus.edu.sg


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

Date: 5 May 1999 06:11:11 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: question about Curses
Message-Id: <7gondv$2v4$1@netnews.csie.NCTU.edu.tw>

hi all,

I am using Curses to create a box that will display 
messages. I can use addstr to add a string to the window,
but it will not scroll up automatically when the 
content reaches the bottom of window. I tried to use 
scroll function to scroll up one line, but it has no 
effect at all. Even it works, I have to keep track of the 
cursor position to know when it reaches the bottom.
So how can I use the window just like the normal console
screen?
thanks.


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

Date: Tue, 4 May 1999 23:51:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: question on regex...
Message-Id: <MPG.11998a5524e53d589899c9@nntp.hpl.hp.com>

In article <7goej8$l63@fumnix.metronet.com> on 4 May 1999 22:40:24 -
0500, Tye McQueen <tye@metronet.com> says...
> ) In article <x3yu2tsafsb.fsf@tigre.matrox.com> on Tue, 4 May 1999 
> ) 13:47:00 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
> ) ...
> ) > 	@matches = grep { /^\Q$test/ } @grouplist;
> 
> lr@hpl.hp.com (Larry Rosler) writes:
> ) Whenever I see something like this, I wonder why we aren't showing more 
> ) of the 'index' function, which is speedier than cranking up the regex 
> ) engine for each match.
> ) 
> )   	@matches = grep index($_, $test) == 0, @grouplist;
> 
> In this case, I think it would be better to use substr():
> 
> 	@matches = grep $test eq substr($_,0,length($test)), @grouplist;

#!/usr/local/bin/perl -w
use strict;
use Benchmark;

my $front = 'matchstring' . 'x' x 50;
my $back  = 'x' x 50 . 'matchstring';
my $none  = 'x' x 61;
my $match = 'matchstring';

timethese(1 << (shift || 0), {
  index0 => sub { index($front, $match) == 0 },
  index1 => sub { index($back,  $match) == 0 },
  index2 => sub { index($none,  $match) == 0 },
  regex0 => sub { $front =~ /^\Q$match/o },
  regex1 => sub { $back  =~ /^\Q$match/o },
  regex2 => sub { $none  =~ /^\Q$match/o },
  subst0 => sub { $match eq substr $front, 0, length $match },
  subst1 => sub { $match eq substr $back,  0, length $match },
  subst2 => sub { $match eq substr $none,  0, length $match },
});
__END__

Benchmark: timing 524288 iterations of index0, index1, index2, regex0, 
regex1, regex2, subst0, subst1, subst2...
    index0:  3 wallclock secs ( 3.07 usr +  0.00 sys =  3.07 CPU)
    index1:  4 wallclock secs ( 4.18 usr +  0.00 sys =  4.18 CPU)
    index2:  4 wallclock secs ( 4.00 usr +  0.00 sys =  4.00 CPU)
    regex0:  6 wallclock secs ( 6.59 usr +  0.00 sys =  6.59 CPU)
    regex1:  5 wallclock secs ( 3.68 usr +  0.00 sys =  3.68 CPU)
    regex2:  3 wallclock secs ( 3.62 usr +  0.00 sys =  3.62 CPU)
    subst0:  3 wallclock secs ( 4.29 usr +  0.00 sys =  4.29 CPU)
    subst1:  5 wallclock secs ( 4.22 usr +  0.00 sys =  4.22 CPU)
    subst2:  3 wallclock secs ( 4.35 usr +  0.00 sys =  4.35 CPU)

Observations:
    Not much difference between match-at-back or no match (no surprise!)
    Index isn't so fast when it fails on long strings.
    Regex-match-at-front is much slower than regex-back or none (why???)
    Substr is relatively constant, but slower than index.

There Are Three Ways To Do It (at least), and it's hard to choose among 
them based on speed.  There are many dependencies on string lengths and 
match probabilities.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 05 May 1999 05:41:49 GMT
From: goodguys@my-dejanews.com
Subject: Re: What's the difference between Perl and CGI?
Message-Id: <7golmt$nuj$1@nnrp1.dejanews.com>

In article <7gk990$hf$1@nntp5.atl.mindspring.net>,
  <joeyandsherry@mindspring.com> wrote:
> I have been apparently posting to the wrong newsgroups,
>
> What's the difference between Perl and CGI?
>
> Thanks for the enlightment.
>
> --
> Joey Cutchins
> President
> Trading Post.Com, L.L.C.
> http://internettradingpost.com
> ceo@internettradingpost.com
>
>

Perl is a programming language.
CGI is a protocol.You can use any languages,for example,C,C++,Tcl,bash
shell,etc, to write cgi scripts as long as your scripts conform CGI protocol

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5567
**************************************

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