[19464] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1659 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 30 14:10:30 2001

Date: Thu, 30 Aug 2001 11:10:13 -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: <999195013-v10-i1659@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Aug 2001     Volume: 10 Number: 1659

Today's topics:
    Re: Pattern matching, grabing everything right of the m (Randal L. Schwartz)
    Re: Pattern matching, grabing everything right of the m <godzilla@stomp.stomp.tokyo>
    Re: perl "study" function in java? <elrac@gmx.net>
        re HELP ME: I want to know if with Perl i can use the m (Mike Solomon)
    Re: REGEX <godzilla@stomp.stomp.tokyo>
    Re: s/\s+$// <Tassilo.Parseval@post.rwth-aachen.de>
    Re: s/\s+$// <godzilla@stomp.stomp.tokyo>
    Re: s/\s+$// <Tassilo.Parseval@post.rwth-aachen.de>
    Re: search.cpan.org <Tassilo.Parseval@post.rwth-aachen.de>
    Re: search.cpan.org <randy@theory.uwinnipeg.ca>
        Sort output and find last. <joe.meyer@swt.edu>
    Re: Using perl for a server daemon????? <ilya@martynov.org>
    Re: Valid IP address format (Eric Bohlman)
    Re: Valid IP address format (John J. Trammell)
    Re: Why do tabs eliminate the rest of the line? (John J. Trammell)
        www.cpan.org links (Chas Friedman)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 30 Aug 2001 08:23:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Pattern matching, grabing everything right of the match
Message-Id: <m1elpto9ks.fsf@halfdome.holdit.com>

>>>>> "Steve" == Steve McDonald <steve_mcdonald@choicehotels.com> writes:

Steve> Thanks! the .* worked great!

Presuming you have no newlines then.  For that, you either need
something easy to understand like /[\0-\377]*/, or hard to understand
like /(?s).*/ or /.*/s .

print "Just another Perl hacker," =~ /(?s)(.*)/;

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 30 Aug 2001 09:03:09 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Pattern matching, grabing everything right of the match
Message-Id: <3B8E63BD.88BDD980@stomp.stomp.tokyo>

Steve McDonald wrote:
 
> Tad McClellan wrote:
> > Steve McDonald  wrote:

(snipped)

> > >Is there a
> > >"universal" replacement for "\w+.\w+." that will grab all characters

> > Yes:   .*

> Thanks! the .* worked great!


This syntax presented by many, this stereotypical
Perl 5 Cargo Cult code works, yes. However, your
proclaiming it "great" is certainly exaggeration.


Godzilla!
--

#!perl

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

use Benchmark;

print "Run One:\n\n";
&Time;

print "\n\nRun Two:\n\n";
&Time;

print "\n\nRun Three:\n\n";
&Time;


sub Time
 {
  timethese (100000,
  {
   'name1' =>
   '$str = "CurrentTicketStatus=Godzilla Rocks And Rolls! Oh Yes! She Rocks My Socks Off!";
    if (index ($str, "CurrentTicketStatus=") > -1)
     { $output = substr ($str, index ($str, "CurrentTicketStatus=") + 20); }',

   'name2' =>
   '$str = "CurrentTicketStatus=Godzilla Rocks And Rolls! Oh Yes! She Rocks My Socks Off!";
    if ($str =~ /CurrentTicketStatus=(.*)/)
     { $output = $1; }',
  } );
 }


PRINTED RESULTS:
________________


Run One:

Benchmark: timing 100000 iterations of name1, name2...
 name1:  0 wallclock secs ( 0.49 usr +  0.00 sys =  0.49 CPU) @ 204081.63/s
 name2:  1 wallclock secs ( 1.21 usr +  0.00 sys =  1.21 CPU) @ 82644.63/s


Run Two:

Benchmark: timing 100000 iterations of name1, name2...
 name1:  1 wallclock secs ( 0.50 usr +  0.00 sys =  0.50 CPU) @ 200000.00/s
 name2:  1 wallclock secs ( 1.20 usr +  0.00 sys =  1.20 CPU) @ 83333.33/s


Run Three:

Benchmark: timing 100000 iterations of name1, name2...
 name1:  1 wallclock secs ( 0.50 usr +  0.00 sys =  0.50 CPU) @ 200000.00/s
 name2:  1 wallclock secs ( 1.21 usr +  0.00 sys =  1.21 CPU) @ 82644.63/s


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

Date: Thu, 30 Aug 2001 17:36:53 +0200
From: Carl Smotricz <elrac@gmx.net>
Subject: Re: perl "study" function in java?
Message-Id: <3B8E5D95.60ADA3D@gmx.net>

Hello Crypto,

IBM (among others) has built a good, powerful regular expression library
for Java. They say 

[quote]
Regex for Java is a powerful, high-performance, regular expression
library for Java. With Regex for
  Java, a search can be done for a string matching a regular expression
pattern in your application. 

  Regex for Java supports almost all features of Perl5's regular
expression; it also supports the
  syntax of XML Schema's regualar expression. 
[/quote]

The address for this marvel of technology, which may be free but I don't
quite understand the licensing terms, is:

http://www.alphaworks.ibm.com/tech/regex4j

You can build as many regexp objects with compiled expressions as you
want, and run your string against the whole list. Sounds to me like what
you're looking for.

Enjoy!

-Carl-

crypto_boy wrote:
> 
> abigail@foad.org (Abigail) wrote in message news:<slrn9ons99.rpa.abigail@alexandra.xs4all.nl>...
> > crypto_boy (crypto-boy@llnl.gov) wrote on MMCMXVIII September MCMXCIII in
> > <URL:news:646ea35e.0108271446.56ba5d98@posting.google.com>:
> > $$ Problem:
> > $$ -----------------
> > $$ I need to see if a one of many regexes match a fixed string in java.
> >
> > That's a Java problem, not a Perl one.
> >
> > $$ What I miss from perl is the "study" function.
> >
> > So? Then program in Perl, not in Java if you want a study function.
> > The fact it's not there doens't hold any relevance in this Perl group.
> >
> > Please take your discussion out of the Perl group.
> >
> > Abigail
> 
> This question is posed to those who have experience in both java *AND*
> perl.  Since there is no perl/java group, I posted to both
> comp.lang.java.programmer and comp.lang.perl.misc.
> 
> If anyone has any *HELPFUL* advice, please post.
> 
> Thanks.


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

Date: 30 Aug 2001 08:51:48 -0700
From: mike_solomon@lineone.net (Mike Solomon)
Subject: re HELP ME: I want to know if with Perl i can use the most popular scientific functions
Message-Id: <56568be5.0108300751.47634808@posting.google.com>

>I´m very interested in know is Perl let me use the scientific
>funciton like sin, cos, sqrt, Statisticals functions.

lookat

perldoc -f sin
perldoc -f cos
perldoc -f sqrt

Regards

Mike Solomon


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

Date: Thu, 30 Aug 2001 08:40:07 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: REGEX
Message-Id: <3B8E5E57.510BAC41@stomp.stomp.tokyo>

Fredrik Andersson aka The CLPM Troll blathered:
 
> Dear Miss Godzilla!

> I'm gratful for the help with my problem from you and from the
> other kind people how have help me.
> The Newsgroups are for the people how needs help and for thouse
> kind people how have the will to help these people.
> You are allowed to call me rude as much as you like (I'm not going
> to call you that) but one might think that one might hurt a person
> with this words if one is a Homo Sapiens.
 
> My deepest regrets for my poor definition of my problem (can happen
> again :-) ),


Oh gosh, you forgot to be rude to others whom also
indicated your article is incoherent and lacking
any clear description of what you want to do.

Such an ignorant bigot of a troll are you.

This reminds me of an article I wrote about
your racism over in another group.

Bigot, racist, not much difference there, yes?


Godzilla!
--
08:36:50 08/30/2001 - RESTRICTED FILE REDIRECT:
   - DNS: h111n2fls31o828.telia.com - IPA: 213.66.252.111
   - System: 
   - Redirect URL: /default.ida


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

Date: Thu, 30 Aug 2001 18:29:42 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: s/\s+$//
Message-Id: <3B8E69F6.6000201@post.rwth-aachen.de>

Godzilla! wrote:

>>s/\s+$//
>>
>  
> 
>>Does anyone of you know what this operation is doing?
>>
> 
> 
> Yes, this line serves to create a fatal syntax error.

Bogus. Why should it?

@a = qw (abc  def  ghi );
for (@a) {
	s/\s+$//
}

Any fatal syntax error in the above?

Tassilo
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 30 Aug 2001 10:21:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: s/\s+$//
Message-Id: <3B8E7632.47E40BDA@stomp.stomp.tokyo>

Tassilo von Parseval aka The CLPM Troll, grasping at straws, blathered:
 
> Godzilla! wrote:
 
> >>s/\s+$//

> >>Does anyone of you know what this operation is doing?

> > Yes, this line serves to create a fatal syntax error.
 
> Bogus. Why should it?
 
> @a = qw (abc  def  ghi );
> for (@a) {
>         s/\s+$//
> }
 
> Any fatal syntax error in the above?


You are claiming, paraphrased,

This syntax   s/\s+$//   should not create a fatal syntax error.


#!perl -w

s/\s+$//

Use of uninitialized value in substitution (s///) at test1.pl line 5.


#!perl -w

$string = "abc  def  ghi"

$string =~  s/\s+$//

print $string;


Scalar found where operator expected at test1.pl line 7, near "$string"
        (Missing semicolon on previous line?)
syntax error at test1.pl line 7, near "$string "
Execution of test1.pl aborted due to compilation errors.


Should I present more classic examples of your irrational thinking?


Godzilla!
--
08:43:19 08/30/2001 - RESTRICTED FILE REDIRECT:
   - DNS: 207-167-7-2.dsl.worldgate.ca - IPA: 207.167.7.2
   - System: 
   - Redirect URL: /default.ida


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

Date: Thu, 30 Aug 2001 19:56:51 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: s/\s+$//
Message-Id: <3B8E7E63.4000709@post.rwth-aachen.de>

Godzilla! wrote:

[snipped]

> Should I present more classic examples of your irrational thinking?

Irrelevant. Your comments do not comply with
the originating author's stated parameters.

Tassilo!  King Of Relevancia.

-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 30 Aug 2001 18:16:31 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: search.cpan.org
Message-Id: <3B8E66DF.7030909@post.rwth-aachen.de>

Randy Kobes wrote:

> What is the URI in your perldoc-soap that's not working? The
> original was contained in the lines
>     my $soap_uri = 'http://theoryx5.uwinnipeg.ca/Apache/DocServer';
>     my $soap_proxy = 'http://theoryx5.uwinnipeg.ca/soap';
> which connects fine from here (locally).

Yes, these are the two lines within your modified perldoc and....hmmh, 
hell, it worked just now. I know for quite sure it did not work this 
afternoon. I suppose it was because I requested docs that weren't to be 
found on the server. I can retrieve those of Mail::Audit but not those 
of Mail::Sendmail for instance.

Tassilo
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 30 Aug 2001 11:25:54 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: search.cpan.org
Message-Id: <9mlq0c$jl7$1@canopus.cc.umanitoba.ca>

"Tassilo von Parseval" <Tassilo.Parseval@post.rwth-aachen.de> wrote
  in message news:3B8E66DF.7030909@post.rwth-aachen.de...
> Randy Kobes wrote:
>
> > What is the URI in your perldoc-soap that's not working? The
> > original was contained in the lines
> >     my $soap_uri = 'http://theoryx5.uwinnipeg.ca/Apache/DocServer';
> >     my $soap_proxy = 'http://theoryx5.uwinnipeg.ca/soap';
> > which connects fine from here (locally).
>
> Yes, these are the two lines within your modified perldoc and....hmmh,
> hell, it worked just now. I know for quite sure it did not work this
> afternoon. I suppose it was because I requested docs that weren't to be
> found on the server. I can retrieve those of Mail::Audit but not those
> of Mail::Sendmail for instance.

I guess a more informative error message in cases that the requested
document isn't on the server would be better ... However, in the particular
case of Mail::Sendmail, it should've been there - I'll look into why it
wasn't
found.

best regards,
randy kobes





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

Date: Thu, 30 Aug 2001 11:45:58 -0500
From: "Joe Meyer" <joe.meyer@swt.edu>
Subject: Sort output and find last.
Message-Id: <9mlptl$agjk$1@news.swt.edu>

I am a beginner in Perl programming.  I am looking for a way to sort a
dataset on a Perl variable, so multiple responses to an internet survey are
grouped together.  Then, I want to pick up the last non-missing response to
each question for each respondent.  I think I know how to sort the data, but
I am not sure how to pick up the last non-missing value of each variable
after the sort is done.

Regards,
Joe Meyer




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

Date: 30 Aug 2001 19:10:16 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Using perl for a server daemon?????
Message-Id: <87vgj5inxj.fsf@abra.ru>

>>>>> On 30 Aug 2001 07:29:06 -0700, gary@irl.com (Gary Cub) said:

GC> Hi,
GC>    I have been asked to build a server daemon to run on a Linux
GC> platform and was thinking about doing it in PERL.  Can anyone tell me
GC> of any security problems their would be in using PERL over C, as I
GC> prefer PERL.

Perl itself should not introduce any security problems unless there
are exist bugs in libc in your OS.

GC>    Also, if there is no reasons not to use PERL why then are more
GC> server daemons written in PERL??

C code will be probably more lightweight than Perl implementation. If
your server should handle high load then it can be limitation. Also if
you need to handle concurent access your design decision for server is
limited to select or fork models. Threads in Perl are not stable yet.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 30 Aug 2001 15:33:52 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Valid IP address format
Message-Id: <9mlmd0$cdt$1@bob.news.rcn.net>

John J. Trammell <trammell@haqq.hypersloth.invalid> wrote:

[quoting .sig]

> Only a very small fraction of our DNA does anything; the rest is all
> comments and ifdefs.

Actually, a whole bunch of it is cargo cult code; certain sequences of DNA 
are more easily copied by DNA polymerase and its related enzymes than 
others, and therefore they tend to accumulate regardless of any function 
they might have.  Thus you wind up with the biochemical equivalent of /s 
modifiers on dot-free regexps, quotes around variable names, etc.



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

Date: 30 Aug 2001 16:17:04 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Valid IP address format
Message-Id: <slrn9ot8th.71q.trammell@haqq.hypersloth.net>

On 30 Aug 2001 15:33:52 GMT, Eric Bohlman <ebohlman@omsdev.com> wrote:
> John J. Trammell <trammell@haqq.hypersloth.invalid> wrote:
> 
> [quoting .sig]
> 
> > Only a very small fraction of our DNA does anything; the rest is all
> > comments and ifdefs.
> 
> Actually, a whole bunch of it is cargo cult code; certain sequences of DNA 
> are more easily copied by DNA polymerase and its related enzymes than 
> others, and therefore they tend to accumulate regardless of any function 
> they might have.  Thus you wind up with the biochemical equivalent of /s 
> modifiers on dot-free regexps, quotes around variable names, etc.

Sweet Jesus, I bet God doesn't use strict either.

You know, that explains a lot.

-- 
Just Another Perl Hacker.


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

Date: 30 Aug 2001 15:39:05 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Why do tabs eliminate the rest of the line?
Message-Id: <slrn9ot6m9.6r5.trammell@haqq.hypersloth.net>

On 30 Aug 2001 06:54:07 -0700, Sara <genericax@hotmail.com> wrote:
> I have a statement like:
> 
>  my $beginc="
> *
> * JOB#$newjob   $today
> * $newjob       ITEM: $l{LA}    PRICE: $l USD
> ";
> 
> where TABS are inserted before $today and ITEM. When this prints I end
> up with:
> 
> *
> * JOB#30339
> * B3459
> 
> So it appears that everything after the inserted TAB characters is
> erased. Why?

I am unable to duplicate your error.  Why don't you just use \t 
to indicate a tab anyhow?

-- 
IAAMOAC.


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

Date: Thu, 30 Aug 2001 15:32:57 GMT
From: friedman@math.utexas.edu (Chas Friedman)
Subject: www.cpan.org links
Message-Id: <3b8e5c22.1802348780@news.cc.utexas.edu>

Anyone know why so many links on www.cpan.org are broken?
(About 1/3 on main page and many others on other pages.
E.g. search.cpan.org seems broken.)  Thanks,
                                     chas f


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1659
***************************************


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