[16557] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3969 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 9 21:05:43 2000

Date: Wed, 9 Aug 2000 18:05:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965869520-v9-i3969@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 9 Aug 2000     Volume: 9 Number: 3969

Today's topics:
    Re: Calling other programs (Greg Bacon)
    Re: Calling other programs <abe@ztreet.demon.nl>
    Re: Calling other programs brian@socko.net
    Re: CGI.pm not passing ampersands properly <nospam@nospam.com>
    Re: CGI.pm not passing ampersands properly (Greg Bacon)
    Re: CGI.pm not passing ampersands properly <flavell@mail.cern.ch>
    Re: Check datatype <lr@hpl.hp.com>
    Re: cleaning shell screen <amonotod@netscape.net>
    Re: cleaning shell screen (Greg Bacon)
    Re: DBI: LAST_INSERT_ID() getting the value of (Jon Drukman)
    Re: Dereferencing correctly in regular expressions <elephant@squirrelgroup.com>
        Finding & writing to printer port <kj0@mailcity.com>
        Help with quotewords troylachinski@my-deja.com
    Re: How do I dislpay all the conents in a file? (Decklin Foster)
    Re: is mysql faster using Perl or PHP? (brian d foy)
    Re: is mysql faster using Perl or PHP? <troyr@vicnet.net.au>
        Issues with running Perl on a Win2000 network? mikelot@my-deja.com
    Re: Large-File Reformatting Problem (Regexp gurus, et a <lr@hpl.hp.com>
    Re: Large-File Reformatting Problem (Regexp gurus, et a (Greg Bacon)
    Re: Large-File Reformatting Problem (Regexp gurus, et a (Ilya Zakharevich)
    Re: Large-File Reformatting Problem (Regexp gurus, et a <lr@hpl.hp.com>
    Re: Large-File Reformatting Problem (Regexp gurus, et a <lr@hpl.hp.com>
    Re: Mailform <troyr@vicnet.net.au>
    Re: Need help with simple cgi code brian@socko.net
        OT: nfilter [was: 5.00 > 5.6] <elephant@squirrelgroup.com>
    Re: parsing Finger replies with perl (Tony L. Svanstrom)
    Re: parsing Finger replies with perl <nospam@nospam.com>
    Re: parsing Finger replies with perl <godzilla@stomp.stomp.tokyo>
    Re: parsing PDF <elephant@squirrelgroup.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 09 Aug 2000 20:30:25 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Calling other programs
Message-Id: <sp3fr1lrn4t160@corp.supernews.com>

In article <8msdgf$gsv$1@slb3.atl.mindspring.net>,
    Rich <rvanoni@e-estimating.com> wrote:

: Can anyone tell me how a perl program can call another perl program and pass
: data or variables between them?  Thanks.  Rich.

What have you tried?

Greg
-- 
It's a miracle that curiosity survives formal education.
    -- Albert Einstein


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

Date: Thu, 10 Aug 2000 02:16:05 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Calling other programs
Message-Id: <dks3psc0rhnhp28nvv72tv63s7dn57g8q3@4ax.com>

On Wed, 9 Aug 2000 16:03:47 -0400, "Rich" <rvanoni@e-estimating.com>
wrote:

> Can anyone tell me how a perl program can call another perl program and pass
> data or variables between them?  Thanks.  Rich.
> 

perldoc -f do

-- 
Good luck,
Abe


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

Date: Thu, 10 Aug 2000 00:09:39 GMT
From: brian@socko.net
Subject: Re: Calling other programs
Message-Id: <3991f278.26606599@news.hwcn.org>

The require syntax should do the trick. It will run the script that
you call upon and allow you to exchange variables and arrays.

$scriptpath = '/path/to/script.pl';
require $scriptpath;

On Wed, 9 Aug 2000 16:03:47 -0400, "Rich" <rvanoni@e-estimating.com>
wrote:

>Can anyone tell me how a perl program can call another perl program and pass
>data or variables between them?  Thanks.  Rich.
>
>



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

Date: 9 Aug 2000 22:42:14 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: CGI.pm not passing ampersands properly
Message-Id: <8msmo6$1oi$0@216.155.33.80>

In article <Pine.GHP.4.21.0008092057040.23130-100000@hpplus03.cern.ch>, 
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:

 | Hang on, calm down.  It's all straightforward if you keep the issues
 | clear in your mind.  It's hopeless if one lashes out with random
 | escaping recipes.

*cough* i was neither uncalm nor lashing out. I don't honestly KNOW how 
you managed to misconstrue that from the factual tone of my posting. and 
&amp; is not a 'random escaping recipie. 

all the info is available at www.htmlhelp.com for anyone who checks :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 09 Aug 2000 23:28:41 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: CGI.pm not passing ampersands properly
Message-Id: <sp3q9980n4t80@corp.supernews.com>

In article <8msmo6$1oi$0@216.155.33.80>,
    The WebDragon  <nospam@nospam.com> wrote:

: *cough* i was neither uncalm nor lashing out. I don't honestly KNOW how 
: you managed to misconstrue that from the factual tone of my posting. and 
: &amp; is not a 'random escaping recipie. 
: 
: all the info is available at www.htmlhelp.com for anyone who checks :)

HTML isn't the only place that URLs may be present.

Greg
-- 
We're putting extra stress on a structure that wasn't up to code in the
first place.
    -- Hank Hill


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

Date: Thu, 10 Aug 2000 01:42:40 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI.pm not passing ampersands properly
Message-Id: <Pine.GHP.4.21.0008100119580.17576-100000@hpplus03.cern.ch>

On 9 Aug 2000, The WebDragon wrote:

>  | Hang on, calm down.  It's all straightforward if you keep the issues
>  | clear in your mind.  It's hopeless if one lashes out with random
>  | escaping recipes.
> 
> *cough* i was neither uncalm nor lashing out. I don't honestly KNOW how 
> you managed to misconstrue that from the factual tone of my posting. and 
> &amp; is not a 'random escaping recipie. 

Let's review the original question:

|If I have a form field called "name", and I type in the value "Mr &
|Mrs Smith", instead of getting $form{name}="Mr & Mrs Smith", I get
|$form{name}="Mr" and $form{ Mrs Smith}=.

As the original poster later reported (under a different posting
name), they had been incorrectly interpreting their observations,
because their submission was being garbled by some intermediate
process.

From the hon usenaut's description, it is evident that the ampersand
had been wrongly interpreted as a separator between form submission
fields.  There's no way that you can correct that by replacing & with
&amp;, in any relevant context that I can think of.

> all the info is available at www.htmlhelp.com for anyone who checks :)

Well, www.htmlhelp.(org|com) is an excellent place to go for help, I
strongly recommend it, but when the chips are down, the authoritative
specifications are available in the authoritative places.  
Nevertheless, there is basically only one correct way of applying
them.  And I'm still unable to make your answer fit any question
similar to the one that was asked, I'm afraid.  On the other hand I
will concede that my digression into hand-composed URLs, while
accurate as to principles, really had almost nothing to do with the
question under discussion.

all the best




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

Date: Wed, 9 Aug 2000 16:04:03 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Check datatype
Message-Id: <MPG.13fb833eacc3a43e98ac57@nntp.hpl.hp.com>

In article <3991ADED.5F667844@mail.com> on Wed, 09 Aug 2000 14:15:57 -
0500, a <mail@mail.com> says...
> How can I check the datatype.  Right now I have:
> 
> if( ($numberRecords !=~ /\D/) || ($numberErrors !=~ /\D/) )
> 
> to see if the variable is a number.

That's isn't valid Perl syntax.  The 'not matches' operator is '!~', not 
'!=~'.

However, your approach is remarkably like the solution in perlfaq4: "How 
do I determine whether a scalar is a number/whole/integer/float?"  My 
only problem with it is that it also matches the empty string, as well 
as a string of all digits.

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


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

Date: Wed, 09 Aug 2000 22:50:31 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: cleaning shell screen
Message-Id: <8msn7m$em8$1@nnrp1.deja.com>

In article <39915537.2254A8F6@yahoo.es>,
  Javier Hijas <jhijas@yahoo.es> wrote:
> How do I clean the shell screen with perl?
>
> (i.e. not using print "\n\n\n\n\n....")
>

#!perl -w
print "clearing the screen...\n";
sleep 5;
if (-d "c:/winnt") {
  system "cls\n";
  print "Windows...\n";
} else {
  system "clear\n";
  print "*nix...\n";
}
print "\nThere now, isn't that nice?\n";
exit;

May not be the prettiest, but works like a champ on Solaris 2.6 and
Winnt 4.

HTH,
amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 09 Aug 2000 23:24:01 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: cleaning shell screen
Message-Id: <sp3q0hijn4t20@corp.supernews.com>

In article <39915537.2254A8F6@yahoo.es>,
    Javier Hijas  <jhijas@yahoo.es> wrote:

: How do I clean the shell screen with perl?

That's a frequently asked question.  Not surprisingly, it's answered
in the Perl FAQ, Section 8.

Greg
-- 
They that can give up liberty to obtain a little temporary safety deserve
neither liberty nor safety.
    -- Ben Franklin


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

Date: Wed, 09 Aug 2000 23:53:41 GMT
From: jsd@cluttered.com (Jon Drukman)
Subject: Re: DBI: LAST_INSERT_ID() getting the value of
Message-Id: <slrn8p3ro5.uec.jsd@cluttered.com>

On Wed, 9 Aug 2000 01:41:51 +0100,
 Mark Worsdall <linux@worsdall.demon.co.uk> wrote:
>So could I form a command that:
>INSERT ONLY if a STRING doesn't exist in stringColumn

this is a SQL question again, not a perl question.
i'll send you an answer in private email.
best not to bog down the group with off-topic discussions.

-jsd-




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

Date: Thu, 10 Aug 2000 00:52:14 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Dereferencing correctly in regular expressions
Message-Id: <MPG.13fc9a27f9dce76c9896d5@news>

Larry Rosler writes ..
>Actually, if I had the choice, I'd push the line the other way -- toward 
>interpolating a simple variable only -- no array indexing or hash 
>accessing.  (There is precedent for this elsewhere, in filehandles, for 
>example, because of syntactic ambiguity.)
>
>I abhor ambiguity resolution by white space, so that, for example:
>
>    /$x[0]/
>
>interpolates the 0'th element of @x, but
>
>    /$x [0]/
>
>matches a scalar interpolation of $x followed by a space, followed by a 
>character class containing '0'.  Does it depend on whether @x is already 
>declared?

it gets worse than that .. '[' binds so tightly that the 'index]' part 
doesn't even need to be there .. try

  print "$x[";

now that's smelly (and potentially quite challenging to debug) .. of 
course - strict helps a little .. but warn doesn't *8^(

the proposed alternative (of interpolating only simple variables) is 
fine for quote situations where you can concatenate .. but what about 
(as your examples use) the regex situation .. to have to assign an array 
element to a simple scalar first would be very frustrating

I see the whitespace ambiguity resolution as quite DWIMy .. perhaps some 
enhancement could be made to improve the parsing when there's no 
whitespace so that in strict circumstances if @x was undefined then it 
reparsed as $x.'[0]'

I don't know how far you go though .. surely if you do it for array 
elements then you'd have to do it for scalars as well and "$x" for undef 
$x would output '$x' rather than '' ??

certainly the result of "$x[" should be fixed somehow

I don't know how DWIMy that is .. I do know that I'm glad you raised the 
Perl6 backwards compatibility point *8^)

>Oh, for a formal language definition!

you sure are 'Another' Larry ;)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 9 Aug 2000 20:33:31 -0400
From: kj0 <kj0@mailcity.com>
Subject: Finding & writing to printer port
Message-Id: <8mst8r$bkg$1@panix3.panix.com>





Suppose I have the name (say "foo") of a printer to print directly to.
How do I find the printer port associated with printer "foo", and how
do I write directly to that port?

Thanks,

kj





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

Date: Wed, 09 Aug 2000 23:51:20 GMT
From: troylachinski@my-deja.com
Subject: Help with quotewords
Message-Id: <8msqpo$h42$1@nnrp1.deja.com>

I am working on a data conversion program.  The following code works
properly EXCEPT when $plu_descriptor contains a single quote (').  When
this is the case all variables are empty.

Sample code:

use Text::ParseWords;
while(<OLD>) { # read a line from file IN into $_
     ($plu_number, $dept, $plu_descriptor, $nothing1,
          $price1) = quotewords(",",0,$_);
     print NEW "$plu_number - $dept - $plu_descriptor - $nothing1 -
          $price1";

Thanks in advance for the help!



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 09 Aug 2000 22:29:23 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: How do I dislpay all the conents in a file?
Message-Id: <7Xkk5.14715$f_5.74069@news1.rdc1.ct.home.com>

thirdgc@my-deja.com <thirdgc@my-deja.com> writes:

> open(time1, "</home/3gc/www/ctb/posts/$file\.time") || dienice("Can't
> open /home/3gc/www/ctb/posts/$file\.time: $! \n");

The other issues have been covered, but what is dienice()? perhaps you
should look up what $SIG{__DIE__} does.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Wed, 09 Aug 2000 18:52:22 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: is mysql faster using Perl or PHP?
Message-Id: <brian-ya02408000R0908001852220001@news.panix.com>

In article <3991A21A.910@siol.net>, marvin <alesr@siol.net> posted:


[comparing speed of Perl and PHP access to MySQL]

> It is the same speed, if you're running single SQL command, since
> SQL command is distributed to MySQL server, and then accepting
> its output back to the client.

that is not a valid conclusion.  the client libraries could have
differences which could affect their efficiency and speed.  there
are many degrees of freedom in this problem.

> If you have a lot of work in database, I would definetly prefer use of
> MySQL stored procedure. 

do you have some special version of MySQL not available to the rest
of the world?  stored procedures are still on the "if we get around to
it" list in the documentation.

> Notice, that speed again would be the same from
> Perl or whatever. Difference would not be noticable for you.

you don't even know what the OP is doing, soany claims
about performance are pre-mature.  there is not *an* answer.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Thu, 10 Aug 2000 10:51:32 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: is mysql faster using Perl or PHP?
Message-Id: <c2nk5.81111$N4.2029385@ozemail.com.au>

How about Speedy CGI?

--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"brian d foy" <brian@smithrenaud.com> wrote in message
news:brian-ya02408000R0908001852220001@news.panix.com...
> In article <3991A21A.910@siol.net>, marvin <alesr@siol.net> posted:
>
>
> [comparing speed of Perl and PHP access to MySQL]
>
> > It is the same speed, if you're running single SQL command, since
> > SQL command is distributed to MySQL server, and then accepting
> > its output back to the client.
>
> that is not a valid conclusion.  the client libraries could have
> differences which could affect their efficiency and speed.  there
> are many degrees of freedom in this problem.
>
> > If you have a lot of work in database, I would definetly prefer use of
> > MySQL stored procedure.
>
> do you have some special version of MySQL not available to the rest
> of the world?  stored procedures are still on the "if we get around to
> it" list in the documentation.
>
> > Notice, that speed again would be the same from
> > Perl or whatever. Difference would not be noticable for you.
>
> you don't even know what the OP is doing, soany claims
> about performance are pre-mature.  there is not *an* answer.
>
> --
> brian d foy
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
> Perl Mongers <URL:http://www.perl.org/>




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

Date: Thu, 10 Aug 2000 00:07:47 GMT
From: mikelot@my-deja.com
Subject: Issues with running Perl on a Win2000 network?
Message-Id: <8msroi$hr7$1@nnrp1.deja.com>

I'm in an environment with a Win2000 network. I'd like to create some
simple perl scripts and have others on the network be able to run them
without installing Perl/PerlScript. Are there any issues with
installing Perl and any needed modules on a single system and having
the users run the Perl interpreter from there, as opposed to locally?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 9 Aug 2000 15:28:19 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Large-File Reformatting Problem (Regexp gurus, et al.)
Message-Id: <MPG.13fb7adb4cd3abde98ac55@nntp.hpl.hp.com>

In article <sp2uqbd563a177@corp.supernews.com> on Wed, 09 Aug 2000 
15:39:55 GMT, Greg Bacon <gbacon@HiWAAY.net> says...

 ...

A couple of nitlets:

>     $/ = "";
>     while (<>) {
>         # skip empty records
>         next unless /\w/;

                      /\S/
 
>         # zap trailing and leading whitespace
>         s/^\s+//s;

          s/^\s+//;

>         s/\s+\z//;
> 
>         # turn a single blank line into an empty line
>         # compress runs of empty or blank lines into one empty line
>         s/\n\s+\n/\n\n/g;
> 
>         # add record terminator
>         print $_, "\n\n";
>     }

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


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

Date: Wed, 09 Aug 2000 22:58:29 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Large-File Reformatting Problem (Regexp gurus, et al.)
Message-Id: <sp3ogl14n4t182@corp.supernews.com>

In article <MPG.13fb7adb4cd3abde98ac55@nntp.hpl.hp.com>,
    Larry Rosler  <lr@hpl.hp.com> wrote:

: A couple of nitlets:
: 
: In article <sp2uqbd563a177@corp.supernews.com> on Wed, 09 Aug 2000 
: 15:39:55 GMT, Greg Bacon <gbacon@HiWAAY.net> says...
:
: >     $/ = "";
: >     while (<>) {
: >         # skip empty records
: >         next unless /\w/;
: 
:                       /\S/

It should actually be 

    next unless /^[\w\s]+$/;

because that's how a well-formed record was defined.

: >         # zap trailing and leading whitespace
: >         s/^\s+//s;
: 
:           s/^\s+//;

Mine stays in check regardless of the value of $*.

Greg
-- 
Feminists say 60 percent of the country's wealth is in the hands of
women.  They're letting men hold the other 40 percent because their
handbags are full.
    -- Earl Wilson


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

Date: 9 Aug 2000 23:41:51 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Large-File Reformatting Problem (Regexp gurus, et al.)
Message-Id: <8msq7v$862$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Greg Bacon
<gbacon@hiwaay.net>],
who wrote in article <sp3ogl14n4t182@corp.supernews.com>:
> : >         next unless /\w/;
> : 
> :                       /\S/
> 
> It should actually be 
> 
>     next unless /^[\w\s]+$/;
> 
> because that's how a well-formed record was defined.

 ... and which is the same (but significantly slower) as

  next if /[^\w\s]/;

Ilya


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

Date: Wed, 9 Aug 2000 16:50:35 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Large-File Reformatting Problem (Regexp gurus, et al.)
Message-Id: <MPG.13fb8e26cdd669d998ac59@nntp.hpl.hp.com>

In article <sp3ogl14n4t182@corp.supernews.com> on Wed, 09 Aug 2000 
22:58:29 GMT, Greg Bacon <gbacon@HiWAAY.net> says...
> In article <MPG.13fb7adb4cd3abde98ac55@nntp.hpl.hp.com>,
>     Larry Rosler  <lr@hpl.hp.com> wrote:
> 
> : A couple of nitlets:
> : 
> : In article <sp2uqbd563a177@corp.supernews.com> on Wed, 09 Aug 2000 
> : 15:39:55 GMT, Greg Bacon <gbacon@HiWAAY.net> says...

 ...

> : >         # zap trailing and leading whitespace
> : >         s/^\s+//s;
> : 
> :           s/^\s+//;
> 
> Mine stays in check regardless of the value of $*.

<Perl porn shields up!>

Gasp!  Does no one understand what 'deprecated' means?  Among other 
things, it means 'not to be discussed among polite company', let alone 
'not to be used in new code'.

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


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

Date: Wed, 9 Aug 2000 17:17:57 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Large-File Reformatting Problem (Regexp gurus, et al.)
Message-Id: <MPG.13fb948c633503898ac5a@nntp.hpl.hp.com>

In article <8msq7v$862$1@charm.magnus.acs.ohio-state.edu> on 9 Aug 2000 
23:41:51 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Greg Bacon
> <gbacon@hiwaay.net>],
> who wrote in article <sp3ogl14n4t182@corp.supernews.com>:
> > : >         next unless /\w/;
> > : 
> > :                       /\S/
> > 
> > It should actually be 
> > 
> >     next unless /^[\w\s]+$/;
> > 
> > because that's how a well-formed record was defined.
> 
> ... and which is the same (but significantly slower) as
> 
>   next if /[^\w\s]/;

I wonder why it would be 'significantly slower'.  The speed of either 
one depends on how much of the string has to be examined before success 
or failure.  Benchmarks show no significant difference.


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

use vars qw( $s0 $s1 $s2 );
$s0 =       'a' x 240;
$s1 =       'a' x 240 . '.';
$s2 = '.' . 'a' x 240;

timethese( 1 << (shift || 0), {
    Greg0  => 'my $x = $s0 =~ /^[\w\s]+$/',
    Greg1  => 'my $x = $s1 =~ /^[\w\s]+$/',
    Greg2  => 'my $x = $s2 =~ /^[\w\s]+$/',
    Ilya0  => 'my $x = $s0 =~ /[^\w\s]/',
    Ilya1  => 'my $x = $s1 =~ /[^\w\s]/',
    Ilya2  => 'my $x = $s2 =~ /[^\w\s]/',
} );
__END__

Output:

Benchmark: timing 262144 iterations of Greg0, Greg1, Greg2, Ilya0, 
Ilya1, Ilya2.
 ..
     Greg0:  5 wallclock secs ( 5.48 usr +  0.00 sys =  5.48 CPU) @ 
47801.60/s (n=262144)
     Greg1:  5 wallclock secs ( 5.42 usr +  0.00 sys =  5.42 CPU) @ 
48348.21/s (n=262144)
     Greg2:  1 wallclock secs ( 1.61 usr +  0.00 sys =  1.61 CPU) @ 
162923.56/s (n=262144)
     Ilya0:  5 wallclock secs ( 5.14 usr +  0.00 sys =  5.14 CPU) @ 
50990.86/s (n=262144)
     Ilya1:  5 wallclock secs ( 5.78 usr +  0.00 sys =  5.78 CPU) @ 
45345.79/s (n=262144)
     Ilya2:  2 wallclock secs ( 1.77 usr +  0.00 sys =  1.77 CPU) @ 
148439.41/s (n=262144)

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


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

Date: Thu, 10 Aug 2000 10:45:42 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: Mailform
Message-Id: <KYmk5.81103$N4.2029451@ozemail.com.au>

#!/usr/bin/perl

use CGI;


# Retrieve paramters from form
my %data=&readform;

# If you are going to use email addresses in the email make sure you escape
them
# ie test\@test.com

# SENDING EMAIL
# Find the path of your sendmail app
  my $mail_prog = '/usr/sbin/sendmail';
  open (MAIL, "|$mail_prog -t");
  print MAIL "To: someone\n";
  print MAIL "From: someone\@somewhere\n";
  print MAIL "Subject: Details\n";
  print MAIL "\n\nYour Message\n\n";
  print MAIL "Thank you for registering. We hope to see you soon!\n";
  close (MAIL);

print "Content-type:text/html\n\n";

print "Your email has been sent";

sub readform {
  my ($query,@names,%parameters);
  $query = new CGI ;
  @names = $query->param;
  foreach (@names) {
    $parameters{"$_"}=$query->param("$_");
  }
  return (%parameters);
}

--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
<vnguyen_1999@my-deja.com> wrote in message
news:8mrld3$k6t$1@nnrp1.deja.com...
> No codes, no clue to help. Send us some actual codes so that we know
> what's going on.
>
>
>
>
> In article <8mqst5$1lv4$1@beast.euro.net>,
>   "Ronald Kas" <unartic@cistron.nl> wrote:
> > Hi there!
> >
> > I'm completely new at perl, and though I'm formiliar with html, asp,
> > javascript , I want to learn more about perl. I'm trying to write a
> script
> > that sends a form by email, but I receive the following error from my
> > logfile:
> >
> > 'Premature end of script headers'
> >
> > That is this causing and how do I fix it?
> >
> > Question 2:
> > Does anybody now some good sites on which I can learn perl?
> >
> > Thanx!
> >
> > Ronald
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Thu, 10 Aug 2000 00:05:06 GMT
From: brian@socko.net
Subject: Re: Need help with simple cgi code
Message-Id: <3991f0d1.26183613@news.hwcn.org>

the problem is in the open statment,
using a single greater than sign indicates that you want to start a
new text file or overwrite the existing file, if you write type open
as listed below it will add it after, also, insert a \n so there will
be a hard return placed in the text file :)

open(SITES,">>/path/to/sites.txt");

print SITES "$caller\n";

close(SITES);

Brian Delaney,
http://www.socko.net

On Wed, 9 Aug 2000 16:17:31 -0500, "Peter" <peterclones@hotmail.com>
wrote:

>I'm a newbie with cgi scripting so need a quick hand in writing this simple
>code.  I'm trying to write a script that grabs the 'HTTP_REFERER' info from
>the Environment variables and prints it to a text file.  Each time the
>script is run I'd like it to add it to the list that's already there in the
>text file.  I know this is terrible easy to do but I'm merely a beginner.
>Here's what I have so far:
>
>#!/usr/bin/perl
>
>$caller = $ENV{'HTTP_REFERER'};
>
>open SITES,">sites.txt";
>
>print $caller;
>
>close SITES;
>
>
>
>This little test doesn't work right now for some reason.  All my paths and
>chmods are correct, I know that for sure.  Please correct this so it will
>work, and keep adding the info to the text file rather than overwrite it.
>
>Much Appreciated!  Peter
>
>
>



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

Date: Thu, 10 Aug 2000 00:56:04 GMT
From: jason <elephant@squirrelgroup.com>
Subject: OT: nfilter [was: 5.00 > 5.6]
Message-Id: <MPG.13fc9b0673b045139896d6@news>

Keith Calvert Ivey writes ..
>What the hell!?  And I thought the four-line spam sig
>newsfeeds.com was adding to the end of my posts before I escaped
>my ISP's news service was outrageous.  If I didn't know better,
>I'd assume this was some sort of forgery designed to make
>newsfeeds.com look even worse than it is.  This company must be
>destroyed!

welcome nfilter .. kills on any header field

  http://www.nfilter.org/

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 10 Aug 2000 00:20:52 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: parsing Finger replies with perl
Message-Id: <1ef4guy.1n73visleq3y4N%tony@svanstrom.com>

The WebDragon <nospam@nospam.com> wrote:

> Does anyone have either a short bit of business they coded and would be
> willing to share regarding parsing the components of Finger replies (for
> date last updated, .plan information, etc.) or have a URL link to the
> RFC for finger formats that I could study in my efforts to do the same?
> 
> any and all assistance appreciated, as always :)

No real standard that can tell you for sure where to find what
information, just finger a lot of people and then make the search as
fuzzy as possible.


     /Tony
PS you can find all the rfc's you ever could want using
www.rfc-editor.org.
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
 DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82  78A6 647F F247 9363 F1DB
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©1999  <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: 9 Aug 2000 22:43:21 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: parsing Finger replies with perl
Message-Id: <8msmq9$1oi$1@216.155.33.80>

 | No real standard that can tell you for sure where to find what
 | information, just finger a lot of people and then make the search as
 | fuzzy as possible.

*chuckle* that's what I'm afraid of heh :)

 |      /Tony
 | PS you can find all the rfc's you ever could want using
 | www.rfc-editor.org.


ah thanks. appreciate it.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 09 Aug 2000 13:27:39 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: parsing Finger replies with perl
Message-Id: <3991BEBB.84CE6F0A@stomp.stomp.tokyo>

The WebDragon wrote:
 
> Does anyone have either a short bit of business they coded and 
> would be willing to share regarding parsing the components of 
> Finger replies (for date last updated, .plan information, etc.)
> or have a URL link to the RFC for finger formats that I could 
> study in my efforts to do the same?


These are fairly stereotypical finger results. Incidently,
when finger results are collected by legal counsel or
by law enforcement, they are legally permissable evidence.
These are a few from hundreds collected during the course
of a felony stalking case our family initiated, collected
to show a person's whereabouts when crimes where committed.
Finger results like these nailed him quite effectively.

I'm not so sure it's his friends whom are stupid, considering
this person has a Master's in computer science, via my own
alma mater.

Godzilla!

**


1000 Watts (kilowatt)
Home: /u13/kilowatt
Shell: /bin/csh
No mail.
  User     Real Name  Idle  TTY  Host      Console Location
kilowatt 1000 Watts   0:06   q8 netcom23 (alaska.dh.trw.com)
No plan.


1000 Watts (kilowatt)
Home: /u13/kilowatt
Shell: /bin/csh
No mail.
1000 Watts (kilowatt) is not presently logged in.
Last seen at netcom23 on Wed Sep  3 12:49:57 1997


Login name: tutup                       In real life: Todd Witteles
Directory: /home/csalumni/tutup         Shell: /bin/bash
Last login Mon Aug 18 16:47 on pts/9 from stingray.ucr.edu
New mail received Wed Aug 27 12:38:29 1997;
  unread since Tue Aug 26 17:21:24 1997
Project: I'm not really BRILLIANT.. it's just that my friends are stupid!
No Plan


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

Date: Thu, 10 Aug 2000 01:04:24 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: parsing PDF
Message-Id: <MPG.13fc9cfb298a7ca69896d7@news>

steveFarris writes ..
>Does anyone know of one...i checked CPAN but all i saw was early
>developement modules??

look again

  Text MHOSKEN   Text-PDF-0.12.tar.gz    45k  31 Jul 2000

-- 
  jason -- elephant@squirrelgroup.com --


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3969
**************************************


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