[12767] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 177 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 17 17:07:12 1999

Date: Sat, 17 Jul 1999 14:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 17 Jul 1999     Volume: 9 Number: 177

Today's topics:
    Re: ActiveState's PerlScript <john@dlugosz.com>
    Re: confusing locales <thoren@csi.com>
        DBM problem: very weird! <zeng@haas.Berkeley.EDU>
        Freelance help wanted for forms project. <fetch@fetchound.com>
    Re: Future of Perl (Todd Tolhurst)
    Re: Future of Perl <gellyfish@gellyfish.com>
    Re: Linux - Apache - Perl (JT)
    Re: Local CGI with ActivePerl (Abigail)
    Re: loop problems <john@dlugosz.com>
        Mail command in Win32? arpith@hotmail.com
    Re: Mail command in Win32? (Michael Rubenstein)
    Re: Module to figure out pop3 server names? <gellyfish@gellyfish.com>
    Re: Prime Factorization <fromero@csudh.edu>
    Re: Prime Factorization <tchrist@mox.perl.com>
        pure perl solution for Blowfish, DES or IDEA? <rainer.hillebrand@muenster.de>
    Re: Question for the perl gods <john@dlugosz.com>
    Re: Question for the perl gods (Anno Siegel)
    Re: Question for the perl gods <uri@sysarch.com>
        Question: optimized method for finding the maximum valu <libertarian@mindspring.com.com>
    Re: Question: optimized method for finding the maximum  <libertarian@mindspring.com.com>
    Re: Question: optimized method for finding the maximum  <rick.delaney@home.com>
    Re: Question: optimized method for finding the maximum  (Larry Rosler)
        Regular expression question (Problems with parsing asci <toni@dse.nl>
    Re: Remove leading zeros from a string <gellyfish@gellyfish.com>
        sending mail with perl on WinNT/95? <trice@americasm01.nt.com>
    Re: sending mail with perl on WinNT/95? <libertarian@mindspring.com.com>
    Re: Where to post scripts <dchender@esn.net>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sat, 17 Jul 1999 12:17:45 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: ActiveState's PerlScript
Message-Id: <9FF2C0C1A22215C2.9455712366CB0F67.734DBEDD68349B33@lp.airnews.net>

What I have seen on PerlScript is centered around ASP.  I've found one site
that gives some basic advise on client-side Perl scripting, but it doesn't
cover the caveats and implementation details.

James Tolley <jtolley@bellatlantic.net> wrote in message
news:3TRj3.134$w36.18558@typhoon1.gnilink.net...
> I agree that the amount/value of available documentation is seriously
> deficient. There's enough to get you half way there, but then you've got
to
> get the rest of the way on your own...
>
> O'Reilly, are you listening?
>
> John M. Dlugosz <john@dlugosz.com> wrote in message
> news:EC86E2A5FF614A3A.ECF99CE076EA6184.7A15896E850CD86F@lp.airnews.net...
> > Is there a newsgroup for this, or any other information to be had?
> >
> > I've been using it, and have discovered a lack of documentation, and
some
> > weird problems.
> >
> > For example, why does the File::Find module not work,
> > and why does any use of $main::document crash Perl?
> >
> > --John
> >
> >
> >
>
>




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

Date: Sat, 17 Jul 1999 22:15:02 +0200
From: "Thoren Johne" <thoren@csi.com>
Subject: Re: confusing locales
Message-Id: <eMxocEJ0#GA.334@nih2naac.compuserve.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:7mq8lf$jki$1@lublin.zrz.tu-berlin.de...

> That's a pretty happy-go-lucky attitude towards character sets, but
> it's what we get.

ah well...

regardless of all the cute LC_CTYPE parameters, they are reduced to:

english, russian, other

knowing that makes a programmers life much easier ;)

gruß
thoren

--
8#X






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

Date: Sat, 17 Jul 1999 12:55:51 -0700
From: Zeng <zeng@haas.Berkeley.EDU>
Subject: DBM problem: very weird!
Message-Id: <Pine.SOL.4.05.9907171241150.17372-100000@haas.Berkeley.EDU>

The following looks a simple algorithm but the %tmp is a bit complex.
Notice I put two identical print statements in the middle? The weird
thing, at least to me, is that those two printout for @Keys don't always
produce the same results. The second (KEY2) always is longer if they are
different. After hours debugging, this weird phenomena depends on the 
'some_subroutine'. i.e. if I get rid of the 'some_subroutine' (and let
$$u=$n), it works fine. But since these two print statements hang on
together, why should these two printouts be different, whatever that
'some_subroutine' does, is simply beyond me. Any help/comments would be
appreciated.

(if it helps, the 'some_subroutine' does NOT deal with the %tmp at all.
But my frustration, no matter what that subroutine does, why does it have
an impact on the printouts for two adjacent printout statements?)

Thanks.  
    dbmopen %tmp,  "tmp",  0644 || die "Can't open file ";
    dbmopen %rmp,  "rmp",  0644 || die "Can't open file ";

    while (($y, $a) = each %rmp) {
        ($n, $t, $g) = split($y);

        $u = &some_subroutine;

	@Keys = keys %{$tmp{$u}};
	print "KEY1,  @Keys \n";
	@Keys = keys %{$tmp{$u}};
	print "KEY2,  @Keys \n";

        $tmp{$u}{$t}{$g} = $a;
     }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bin Zeng
Tel: (510) 643-1411
Fax: (510) 643-1412



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

Date: Sat, 17 Jul 1999 09:17:39 -0800
From: Tomh <fetch@fetchound.com>
Subject: Freelance help wanted for forms project.
Message-Id: <932231863.13843@www.remarq.com>


Hi,

Have a perl/cgi create forms project I need a freelancer to
do.

Further details can be had by Email and WWW.

Thanks for your time.

Tom Hicks
tomh@fetchound.com



Sent from RemarQ http://www.remarq.com/?z The Internet's Discussion Network
The fastest and easiest way to search and participate in Usenet - Free!


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

Date: Sat, 17 Jul 1999 17:22:40 GMT
From: toto@toto.com (Todd Tolhurst)
Subject: Re: Future of Perl
Message-Id: <3790bb45.17553692@news3.newsfeeds.com>

On Sat, 17 Jul 1999 00:30:31 GMT, Jeffrey@ix.netcom.com (Jeffrey)
wrote:
>Listen bitch, I learned a lot about how to program the Amiga computer
>and then it died in the marketplace. I don't want something like that
>to happen ever again. A language isn't fucking useful if you can't get
>a job programming in it.

   A "programmer" who can't transfer his skills from one platform or
language to another isn't very useful either.  Maybe that explains any
trouble you're having finding work.

--
Todd Tolhurst
toto@toto.com
http://www.w3xpert.com/toto/



  -----------== 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: 17 Jul 1999 09:45:48 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Future of Perl
Message-Id: <7mpjcc$2l2$1@gellyfish.btinternet.com>

On Sat, 17 Jul 1999 00:30:31 GMT Jeffrey wrote:
> On 15 Jul 1999 23:24:02 -0500, abigail@delanet.com (Abigail) wrote:
> 
>>Don't judge programming languages on their usefullness, judge them on
>>their marketable value! That'll increase the quality of code and will
>>bring us closer to world peace.
> 
> Listen bitch, I learned a lot about how to program the Amiga computer
> and then it died in the marketplace. I don't want something like that
> to happen ever again. A language isn't fucking useful if you can't get
> a job programming in it.
> 
> As for my original question, it was spurred by a comment in a CGI book
> that Java would take over and Perl would become a legacy language.
> Someone said the same thing in a message when I did a search on Deja
> News. So don't act like my question was so fucking stupid, bitch.
> 

With your highly refined social skills I think you would be wasted as a
programmer - I'd suggest a career in fast food production ... well just
so long as you can say 'Would you like fries with that' without the
Tourettes kicking in.

*PLONK*

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 17 Jul 1999 18:51:44 GMT
From: jett1not@homedot.com (JT)
Subject: Re: Linux - Apache - Perl
Message-Id: <3790cfa3.218640@24.2.0.71>

On Sat, 17 Jul 1999 04:04:35 -0400, tadmc@metronet.com (Tad McClellan)
wrote:

>: I didn't see any damned rules when I logged
>: on today so stop pretending there are any. 
>
>
>   I have never seen you, so stop pretending that you exist.
>
>
>: By all means *plonk* me!
>
>
>   You got it Toyota!
>
>
>--
>    Tad McClellan                          SGML Consulting
>    tadmc@metronet.com                     Perl programming
>    Fort Worth, Texas
"You got it Toyota!"?

Man you are a DORK!
-JT

Remove the "not" and delete the "dot" to reply
jett1not@homedot.com


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

Date: 17 Jul 1999 15:23:26 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Local CGI with ActivePerl
Message-Id: <slrn7p1pgu.c9j.abigail@alexandra.delanet.com>

Floyd Morrissette (Webdesigner@NewWebSite.com) wrote on MMCXLVI September
MCMXCIII in <URL:news:7mpn7t$9kk$1@nnrp1.deja.com>:

-- <response>
-- <quote>


*plonk*



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


  -----------== 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: Sat, 17 Jul 1999 12:30:54 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: loop problems
Message-Id: <EC971B53BB426F81.D064CCBFAEFD7918.EECD6BBDF7911BC8@lp.airnews.net>

Try writing it this way:

    while (<INFILE>) {
        if (/authenticat/) {
            push @tempauth, $_;
            foreach $tval (@tempauth) {
                foreach $kval (@cryptokeys) {
                    # do something with the two values.
                    }
                }
            }
        }

Specifically,
    * use push to add a new value to the end of the array
    * use foreach or map to iterate over all the values in an array

Yes, you are not resetting the value of $j and $k each time, so they
continue where they left off before.

James Gerard Coleman <jgc5a@j2.mail.virginia.edu> wrote in message
news:Pine.A41.4.05.9907151403070.36614-100000@node12.unix.Virginia.EDU...
> ok..  this is really confusing me..
>
> i've got this set of code:
>
> while(<INFILE>) {
>     if ($_ =~ /authenticat/) { # look and see if value exists
> $tempauth[$i++] = $_; # put values into an array
> for ($j; $j<=$#tempauth; $j++) {
>     for ($k; $k<=$#cryptokeys; $k++) {
> print "$j ";
>     }
> }
>     }
> }
>
> $#tempauth has a value of 74, $#cryptokeys has a value of ~740.  what i
> expected when i ran this loop is for the number $j(0 through 74) to be
> displayed 740 times for each value of j.   what i get instead is a few
> lines of blank space....
>
> any ideas on this one?  am i initializing the variables j and k
> incorrctly?  should they be set to "for ($k=0; etc)" ?  the probelm is
> that last time i tried that, i got an error that autoincrement wouldn't
> work on a constant...
>
> thanks in advance,
> jim
>




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

Date: Sat, 17 Jul 1999 17:56:32 GMT
From: arpith@hotmail.com
Subject: Mail command in Win32?
Message-Id: <7mqg4c$g2q$1@nnrp1.deja.com>

Hi,

I'm new to perl, and am using the Windows build. In unix there is a MAIL
function to send emails --as I read in some tutorial-- is there any
equivalent for it for a Win95 based server ?

I am trying out these CGI perl scripts with a free web server OmniHttpd,
but I guess, for the mail function I would need a mail server too right?

Any help will be appreciated.

Thanks,
Arpith.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sat, 17 Jul 1999 19:01:00 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Mail command in Win32?
Message-Id: <37a2d190.457408538@nntp.ix.netcom.com>

On Sat, 17 Jul 1999 17:56:32 GMT, arpith@hotmail.com wrote:

>Hi,
>
>I'm new to perl, and am using the Windows build. In unix there is a MAIL
>function to send emails --as I read in some tutorial-- is there any
>equivalent for it for a Win95 based server ?
>
>I am trying out these CGI perl scripts with a free web server OmniHttpd,
>but I guess, for the mail function I would need a mail server too right?
>
>Any help will be appreciated.

There's a free program named blat.  However, I've had better
success rolling my own using Net::SMTP.  These will only work if
you are sending mail through an SMTP server (almost all ISPs
provide an SMTP server, but some corporate networds do not).
-- 
Michael M Rubenstein


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

Date: 17 Jul 1999 10:15:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Module to figure out pop3 server names?
Message-Id: <7mpl3b$2lb$1@gellyfish.btinternet.com>

On Sat, 17 Jul 1999 05:51:58 GMT billy_collins@my-deja.com wrote:
> Hello
> 
> Is there a way to figure out the address of a pop3 server from only an
> email address? For instance, if I know that the email ID is
> 
>     abc@xyz.com
> 
> Can I figure out whether the Pop3 server on the xyz.com is:
> 
>     pop3.xyz.com
>     mail.xyz.com
> 

Net::DNS - also see my long post of about two months ago regarding why
you dont really want to do this.

If I find you spamming I will set fire to your pony.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 17 Jul 1999 11:03:13 -0700
From: Francisco Romero <fromero@csudh.edu>
Subject: Re: Prime Factorization
Message-Id: <3790C55B.F4B7574F@csudh.edu>



"V. Balaji" wrote:

> Francisco Romero <fromero@csudh.edu> writes:
>
> >Does anyone know how to write a perl script for finding the prime
> >factorization of a number?
>
> Do you need a perl script? What's wrong with factor(1)?
>
> One of the MTOWTDI is generally not to use perl.
> --
>
> Balaji         1 609.452.6516
> SGI/GFDL Princeton University

What is factor(1)?  Is that from perl?  Sorry for my lack of knowing.



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

Date: 17 Jul 1999 12:21:06 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Prime Factorization
Message-Id: <3790c992@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Francisco Romero <fromero@csudh.edu> writes:
:> Do you need a perl script? What's wrong with factor(1)?
:What is factor(1)?  Is that from perl?  Sorry for my lack of knowing.

http://language.perl.com/ppt/src/factor/index.html has some stuff.

--tom
-- 
"PC's are backwards ... throw them out! Linux is ok though." 
    --Rob Pike (on the subject of CR/LF etc)


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

Date: Sat, 17 Jul 1999 19:57:06 +0200
From: Rainer Hillebrand <rainer.hillebrand@muenster.de>
Subject: pure perl solution for Blowfish, DES or IDEA?
Message-Id: <3790C3F2.8AEB1E78@muenster.de>

Does anyone know a pure perl solution for Blowfish, DES or IDEA? I can't
install the known modules on the web server because I only have a ftp
access to my web server. Even if a pure perl script is rather slow it is
better than nothing.

Best regards,

Rainer


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

Date: Sat, 17 Jul 1999 12:24:38 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: Question for the perl gods
Message-Id: <8CE867BC515952CE.F3A82A2F631A45C0.81629FE69EC49944@lp.airnews.net>

That's not Perl regex syntax.  You're asking for the letters 'f','r','a','m'
then followed by any number (or none) 'e's, then "source" followed by any
number of '=' characters, followed by ".ht" with an optional 'm' but it
prefers to do without the m (and since that's the last thing it will never
involve it).

I think you are using shell globbing syntax, not regex syntax.

Extracting that part, reliably, with a regular expression is actually fairly
advanced.  See the book "Mastering Regular Expressions" for a detailed
treatment.  Or, find a parser that already breaks up the SGML syntax.

--John

hairisonFire <bottech@mediaone.net> wrote in message
news:Dg2k3.1980$jS5.150112@news2.jacksonville.net...
> Hi I am a newbie to perl, specifically the "regular expression" part.  I
am
> using OROMatcher which is a Perl5 regex class library for java.
>
> So the question I have is:
>
> I am trying to parse an html file like this :
> <html>
>
> <head>
> <meta http-equiv="Content-Type"
> content="text/html; charset=iso-8859-1">
> <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
> <title>An HTML Page</title>
> </head>
>
> <frameset cols="176,*">
>     <frame name="left" src="page1.htm" scrolling="auto"
>     marginwidth="2" marginheight="1" border="5">
>     <frame name="body" src="page4.html" scrolling="auto"
>     marginwidth="2" marginheight="1">
>     <noframes>
>     <body>
>     </body>
>     </noframes>
> </frameset>
> </html>
>
>
>
> I need to extract the page that frame src points to.  I have been trying
to
> do this with this regex statement:
>
> frame*src=\"*\.htm??
>
> I am having a terrible time getting this to work.  I have checked it
inside
> of the Visual Cafe regex search function and it works fine!! But no in my
> code?!?!
>
>
> Thanks for you help
>
>
>
>
>
>




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

Date: 17 Jul 1999 17:45:06 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question for the perl gods
Message-Id: <7mqff2$jsi$1@lublin.zrz.tu-berlin.de>

John M. Dlugosz <john@dlugosz.com> wrote in comp.lang.perl.misc:

>That's not Perl regex syntax....

 ...referring to an expression that was about 50 lines down the page.

Would you please trim what you quote to contain only what you are
going to comment on and also place your comments below what they
refer to?

Thank you.

Anno


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

Date: 17 Jul 1999 14:12:23 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Question for the perl gods
Message-Id: <x7vhbji1rs.fsf@home.sysarch.com>

>>>>> "JMD" == John M Dlugosz <john@dlugosz.com> writes:

as someone else pointed out, it would be useful if you put the quoted
stuff BEFORE your comments. it is hard to see what you are saying (and
its mostly wrong) when you have to page up and down your post.

  >> frame*src=\"*\.htm??

  JMD> That's not Perl regex syntax.  You're asking for the letters
  JMD> 'f','r','a','m' then followed by any number (or none) 'e's, then
  JMD> "source" followed by any number of '=' characters, followed by
  JMD> ".ht" with an optional 'm' but it prefers to do without the m
  JMD> (and since that's the last thing it will never involve it).

the e* part is correct, but the =* makes no sense. there is a " after
the = (unnecessarily backwhacked) which is quantified. and the ?? are
probably part of his english question, not a ?? non-greedy modifier.
(note that mjd has asked for a real world example of ?? in a regex, this
is not it)


  JMD> Extracting that part, reliably, with a regular expression is
  JMD> actually fairly advanced.  See the book "Mastering Regular
  JMD> Expressions" for a detailed treatment.  Or, find a parser that
  JMD> already breaks up the SGML syntax.

so why not tell him to use HTML::Parser?

and if the page is autogenerated or guaranteed to be in a known format
you can parse out stuff with regexes. but caveat parser!

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Sat, 17 Jul 1999 15:48:46 -0400
From: "Lee Clemmer" <libertarian@mindspring.com.com>
Subject: Question: optimized method for finding the maximum value in an array
Message-Id: <775k3.12106$FD6.49466@news2.atl>

Hello, all.

Question: What expression(s) is(are) fastest/most optimized for finding the
maximum value in an arbitrary array of numbers, in this case integers (most
likely *always* under 100) ?

I feel like this sort of function ("find max, min, average, median, mean")
would be so commonly needed that it would be included or a module would be
around to do it. Maybe I'm being a bonehead or exhibiting too much of the
Laziness and Impatience virtues and not enough Hubris?

I found a greater than/less than/ equal to function in Math::BigInt, but I
suspect that would introduce needless overhead since my numbers aren't "big"
integers.

I've looked through all my Perl references: Perl in a Nutshell, Learning
Perl, Programming Perl, Advanced Perl, and Perl Cookbook (which is
*fantastic* IMHO) I've searched online via Deja and AltaVista, and still
found no meaningful hits.

The following code works, but I *know* it is brain-dead simple and there
*must* be better ways of doing it.. I've already started re-coding with
conditionals (&& and ||)...

#!/usr/bin/perl -w
# simplistic way to find max value from array.
use strict;

my (@lengths, $first, $a, $b, $longer, $longest);
@lengths = (1, 12, 15, 7, 0, 3, 6);
# in the actual program @lengths gets created by iterations of length() on
strings grabbed via regular expressions... the number of entries in @lengths
will vary.

while (@lengths) {
 if ($longer) { $a = $longer } else {
  $a = shift(@lengths);
 }
 $b = shift(@lengths);
 if ($a >= $b) { $longer = $a } else { $longer = $b};
}
# *Needless* assignment added for *clarity* in context of program this was
pulled from :)
$longest = $longer;
print $longest;

# End of example code....

This also isn't very elegant...

Anyone want to take a crack at it?

Thanks,
Lee




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

Date: Sat, 17 Jul 1999 16:12:06 -0400
From: "Lee Clemmer" <libertarian@mindspring.com.com>
Subject: Re: Question: optimized method for finding the maximum value in an array
Message-Id: <%s5k3.12141$FD6.49703@news2.atl>

Ahhh,

I just ran across the Statistics::Descriptive module on CPAN, and it has the
desired min, max, etc!
I'm going to go play with this now and do some tests and benchmarking.

Preferred optimizations not requiring external modules are, of course,
welcome and encouraged!

Lee

--Voice in Lee's head: "Aren't those _statistical_ functions? why don't I
search for "statistics"?"




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

Date: Sat, 17 Jul 1999 20:33:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Question: optimized method for finding the maximum value in an array
Message-Id: <3790E88B.A65DEF0@home.com>

[posted & mailed]

Lee Clemmer wrote:
> 
> I just ran across the Statistics::Descriptive module on CPAN, and it has the
> desired min, max, etc!

While you're at CPAN, look for the builtin module.  It has the functions
you want.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 17 Jul 1999 13:50:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question: optimized method for finding the maximum value in an array
Message-Id: <MPG.11fa8c68d874143f989cea@nntp.hpl.hp.com>

In article <%s5k3.12141$FD6.49703@news2.atl> on Sat, 17 Jul 1999 
16:12:06 -0400, Lee Clemmer <libertarian@mindspring.com.com> says...
> Ahhh,
> 
> I just ran across the Statistics::Descriptive module on CPAN, and it has the
> desired min, max, etc!
> I'm going to go play with this now and do some tests and benchmarking.
> 
> Preferred optimizations not requiring external modules are, of course,
> welcome and encouraged!

I'm not sure what difficulty you perceive in these problems, none of 
which seems to have any algorithm more optimal than linear search.

Here are two trivial solutions, one as in-line code and one as a 
subroutine.


#!/usr/local/etc/perl -w
use strict;

my @lengths = (1, 12, 15, 7, 0, 3, 6);

my $longest = 0; # or maybe a large negative number
                 # or (as below) $lengths[0]
$longest < $_ and $longest = $_ for @lengths;
print "$longest\n";


sub max (\@) {
    my $max = $_[0][0];
    $max < $_ and $max = $_ for @{$_[0]};
    $max
}

$longest = max @lengths;
print "$longest\n";


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


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

Date: 17 Jul 1999 20:14:04 GMT
From: "Toni Cornelissen" <toni@dse.nl>
Subject: Regular expression question (Problems with parsing ascii go diagrams)
Message-Id: <01bed090$df71d580$LocalHost@default>

I've got a problem parsing ASCII go-boards in Perl.

I'll start with an introduction for the non go playing readers.
This introduction will end with the text: END OF INTRODUCTION.

Go is a board game for two players (Black and White). Alternating
the players place a stone of their colour on the board. Except
for the colour all stones are identical.

In rec.games.go positions are clarified by means of ascii diagrams.
They look something like this:

  O . . 2
  . . . .
  . . . .
  1 . . X

This means: Two stones are already on the board, a black one in the
lower right corner and a white one in the upper left corner. First a
stone placed in the lower left corner followed by a stone in the 
upper right corner.

Sometime coordinates are used to identify positions: 

    a b c 
  3 . O . 3
  2 . 1 X 2
  1 2 . . 1
    a b c 

A black stone is placed on C2, a white one on B3,
the first move is B2 and the second is A1.

Sizes of go boards vary.

I've writen a webpage (http://www.dse.nl/~toni/go/ascii2sgf/) 
that converts this ascii diagrams in a more readable/usable format.

END OF INTRODUCTION

To match a line of a ASCII go diagram,
I came up with the following code:

    /(\d{0,2})\s+((?:[\.OX\d] |\d\d)+)\s*\1/

First the line number: (\d{0,2}) 
  The number does not have to be present an can be 99 at most.
Then at lease one white space character: \s+
Followed by characters identifying a stone: ((?:[\.OX\d] |\d\d)+)
  Maximal 99 move in a board.
Eventually some white space \s*
And at last the same number the line started with.

Unfortunately the line:

    3  . X . 4 O . . 3

Does no generate:
 
    $1 = 3
    $2 = . X . 4 O 

But:

First:
    $1 = 
    $2 = 3 
And second:
    $1
    $2 = X . 4 0 . . 3 

Can someone tell me what I'm doing wrong 
and what the correct expression I should use is.

The way I read "The rules of regular expression matching" (page 60
and further of Programming Perl, Larry Wall e.a.) this is the
correct expression. I obvious read that paragraph wrong.
  
Thanks Toni
 
-- 
Toni Cornelissen            |  Fiets op 5 september mee naar Antwerpen
toni@dse.nl                 |  Voor meer informatie zie:
http://www.dse.nl/~toni/    |  http://www.dse.nl/~toni/hpv/toer/brant99/


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

Date: 17 Jul 1999 10:12:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Remove leading zeros from a string
Message-Id: <7mpku9$2l8$1@gellyfish.btinternet.com>

On Fri, 16 Jul 1999 17:22:57 +0100 Scott Pritchett wrote:
> 
> Simon Kerr <skerr@ryder.co.uk> wrote in message
> news:378f29b3.0@nnrp1.news.uk.psi.net...
>> Hi,
>>
>> I have a string, such as '00001234'.  All I want to do is remove the
> leading
>> zeros.  The length of the string can vary, so I can't just chop off the
>> first n characters.
>>
> 
> We had a similar problem with a string '07,5,10,06' where we had to remove
> the leading
> zeroes from each number and stick them in an array, we came up with :-
> 
> $x='07,5,10,06';
> @list=unpack("I*",pack("I*",(split/,/,$x)));
> print "@list\n";
> 

@list = map { $_ + 0 } split /,/, $x ;

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 17 Jul 1999 13:39:44 -0500
From: Tony Rice <trice@americasm01.nt.com>
Subject: sending mail with perl on WinNT/95?
Message-Id: <3790CDF0.D13E60F2@americasm01.nt.com>

Without a "sendmail" application, how do I send mail with Perl on Win95?



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

Date: Sat, 17 Jul 1999 13:53:50 -0400
From: "Lee Clemmer" <libertarian@mindspring.com.com>
Subject: Re: sending mail with perl on WinNT/95?
Message-Id: <nr3k3.11940$FD6.48155@news2.atl>

There are many ways of doing this.
If you're on a Win32 platform, ( as you stated you were) and you want to use
an external app, (handy
for sending files & MIME attachments) I've always liked "blat", and there
are good perl examples on the blat web site.
http://gepasi.dbs.aber.ac.uk/softw/Blat.html

The Mail::Sendmail module is excellent as well. Get it from CPAN or whatnot.
 ..or you could roll your own module...

Lee








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

Date: Sat, 17 Jul 1999 14:14:06 -0700
From: "M.A. Henderson" <dchender@esn.net>
Subject: Re: Where to post scripts
Message-Id: <3790F21D.B2874991@esn.net>

bstar.net is recently new, but I understand the freelancers there are
quite good ;)

mark@bstar.net wrote:

> Hi,
>    Can you name some sites where people post Perl/CGI scripts that
> they'd like done for them by freelance programmers?  (contract jobs)
>    I've seen http://cgi-resources.com/Jobs/, and I've made
> http://bstar.net/perljobs/, but am looking for other places that are
> really going.
> Thanks!
> Mark
> mark@bstar.net
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



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

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 177
*************************************


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