[8694] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2311 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 13 20:07:26 1998

Date: Mon, 13 Apr 98 17:00:27 -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           Mon, 13 Apr 1998     Volume: 8 Number: 2311

Today's topics:
    Re: [Q] find largest value in key of associative array? (Jahwan Kim)
    Re: [Q] find largest value in key of associative array? <andrewf@cp.pathfinder.com>
        Apache/ModPerl Question (Jim Turner)
    Re: Bill Gates should be invited to O'Reilly's "Free So (Chris Nandor)
    Re: Bill Gates should be invited to O'Reilly's "Free So (Chris Nandor)
        Can I install perl5.004_04 myself? <eslcafe@callisto.si.usherb.ca>
    Re: editing /etc/group file (Greg Bacon)
    Re: environnemt variables <gurun@acc.umu.se>
    Re: environnemt variables <sneaker@earthling.net>
    Re: environnemt variables (Craig Berry)
        formatting localtime output <falkenl@hotmail.com>
    Re: General Rudeness, e.g. Re: Need a web login script <sonny@88net.net>
    Re: help with delimiters <danboo@negia.net>
        Hide or Encrypt perl source code <yey@cvilaser.com>
    Re: Hide or Encrypt perl source code (Gabor)
    Re: How do I format Local Date? <kgraham@s9000.furman.edu>
        i want to learn Perl. HELP! <deforest@mkl.com>
    Re: looking for a good win32 perl editor. (Jim Esten)
        make perl program start with icon <star@sonic.net>
    Re: make perl program start with icon (Frank)
    Re: make perl program start with icon (Craig Berry)
    Re: Multi-dimensional Array Access <andrewf@cp.pathfinder.com>
    Re: Numeric validation <gurun@acc.umu.se>
    Re: Numeric validation (Craig Berry)
        Perl 5.004_64 Slower??? <sneaker@earthling.net>
    Re: print <gurun@acc.umu.se>
    Re: Project involving Word <sneaker@earthling.net>
    Re: Random Banner Problem <andrewf@cp.pathfinder.com>
    Re: Remove newline (Craig Berry)
    Re: Sharing a constant between scripts <jdf@pobox.com>
        WinNT comm port foo@hotmail.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 13 Apr 1998 22:04:11 GMT
From: jahwan@lilac.engin.umich.edu (Jahwan Kim)
Subject: Re: [Q] find largest value in key of associative array?
Message-Id: <slrn6j53kq.64q.jahwan@lilac.engin.umich.edu>

On 13 Apr 1998 14:25:11 -0400, Mark-Jason Dominus <mjd@op.net> wrote:
> In article <comdog-ya02408000R1304981339320001@news.panix.com>,
> brian d foy <comdog@computerdog.com> wrote:
> >why is everyone trying to sort?
> 
> Because it leads to smaller code.
> 
[snip]

    But it takes longer in general.  So maybe should the function 'extremum'
with syntax similar to sort be implemented?  (This question popped up
before.  Was it Tom Phoenix who suggested 'extremum'?  Don't remember for
sure.)
    Or there's insufficient demand for 'extremum'  :)
    
Jahwan



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

Date: Mon, 13 Apr 1998 19:01:30 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: [Q] find largest value in key of associative array?
Message-Id: <Pine.GSO.3.95.980413185643.3796A-100000@cp.pathfinder.com>

On Mon, 13 Apr 1998, Stephen_Chan wrote:

$max = 0;
for $key (%aa) {
	if($key > $max) {
		$max = $key;
	}
}
	
> What's the fastest way to find the largest key value
> in an associative array? eg:
> 
> %aa
> 
> key		value
> ----		------
> 1		some_content_1
> 23		some_content_1
> 5		some_content_1
> 48		some_content_1
> .			.
> .			.
> N		some_content_N
> 
> In the above list, assume there's 10000 pairs and the
> 4634th key/value pair holds the largest key value of
> 34235. Do I have to manually iterate through to find it?
> 
> Thanks
> Stephen
> 
> 

-------------------------------------------------------------
Andrew F. Lee                 |                              |
Software Engineer             |  parenttime.com              |
email: andrewf@pathfinder.com |  1271 Avenue of the Americas |
Phone: (212) 522-2769         |  New York, N.Y. 10020        |
-------------------------------------------------------------
        When I say, "Ignore the man behind the curtain."   
        That is because there is no man behind the curtain.



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

Date: 13 Apr 1998 21:46:51 GMT
From: turnerj@cliffy.lmtas.lmco.com (Jim Turner)
Subject: Apache/ModPerl Question
Message-Id: <6gu14b$s2c2@quest.lmtas.lmco.com>

	I have 2 CGI scripts which work correctly under CGI.  I set them
up to use ModPerl (the ::Registry module) and they work fine (including
much faster :-)   The Problem is that I also output a "Content-type:..."
HTTP header at the top of each page, and it DISPLAYS (as if a header has
already been sent to the browser)  This would not be a problem, except that
some of my pages use frames and to  remove the frames, I include a
:Window-target=_top clause to some of my headers (which just display now and
are otherwise ignored).  Is there any way to cause the server to NOT send
a header to the browser for you so that the browser will be expecting one
(as is the case in normal CGI?)  I have tried both using and not using
CGI.pm.

Thanks in advance for any help!!!!!!!!!!!

Jim Turner
jim.turner@lmco.com



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

Date: Mon, 13 Apr 1998 22:08:09 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <pudge-1304981807570001@dynamic283.ply.adelphia.net>

In article <3532586F.301661F1@hayamasa.demon.co.uk>, Ben Bullock
<ben@hayamasa.demon.co.uk> wrote:

# Russ Allbery wrote:
# > 
# > In comp.lang.perl.misc, Ben Bullock <ben@hayamasa.demon.co.uk> writes:
# > 
# > > OK, it's not a computer program.  But it is a document in
# > > machine-readable form.  The distributed Perl documents were offered as
# > > examples of free documentation, but in the case of the Perl FAQ they are
# > > not free.
# > 
# > Sure they are. 
# 
# I am using the word free in a specific sense.  I posted an
# explanation of what I meant.  In that sense they are not free.
# In some other sense of the word free they might be, but in my
# sense of the word, which I posted a careful explanation of, they
# aren't.

Your definition is bogus. They are free, they are simply not public domain.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Mon, 13 Apr 1998 22:13:15 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <pudge-1304981813060001@dynamic283.ply.adelphia.net>

In article <slrn6j4kog.4hf.wnoise@puree.ugcs.caltech.edu>,
wnoise@ugcs.caltech.edu wrote:

# Not to put too fine a point on it, but while information does not long
# to be free, it is a useful approximation to consider it as if it did.

Apologies, but I rarely consider it useful to consider something as true
that which is not.

# The information that is most widely replicate tends to last the
# longest.  If information is not widely replicated, it tends to die
# out.  The upshot is that we see the information that does "want to be
# free".  This is just another case of evolution in action, complete with
# mutations, competition, parasites, symbionts, and widely varied
# ecosystems.

Can evolution really be applied to something that is completely inactive,
that has no driving force of its own, such as information?  Even amoebas
move around of their own power.  This just makes not a shred of sense to
me.

# In a similar way, uni-cellular creatures do not have any
# "desire" to reproduce and avoid being eaten, but nevertheless it is a
# very good way of understanding their behaviour.  If they didn't behave
# that way, they wouldn't be around.

Unicellular creatures may not have desire as we know it, but they
certainly have some sort of inherent drive to survive.  They move toward
that which keep them alive, and shirk away from perceived threats. 
Information does no such thing.  It sits in a leather binding or on a
floppy disk and does nothing one way or another to survive or prevent
extinction.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Mon, 13 Apr 1998 23:28:57 GMT
From: John Taylor-Johnston <eslcafe@callisto.si.usherb.ca>
Subject: Can I install perl5.004_04 myself?
Message-Id: <32FE55CB.706F@callisto.si.usherb.ca>

My server doesn't have the extension modules I need from CPAN to run
"use Net::SMTP;"

I know where to find them

http://www.perl.com/CPAN-local/modules

Can I install perl myself, with the modules, under my public_html
directory (UNIX SERVER), and then call my version of perl with my
scripts using this syntax:

#!/home/mycode/perl

Instead of

#!/usr/local/bin/perl

WHAT AM I GETTING MYSELF INTO?

Please respond by email.


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

Date: 13 Apr 1998 21:04:55 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: editing /etc/group file
Message-Id: <6gtuln$65j$5@info.uah.edu>

In article <6gtj26$dta$1@nnrp1.dejanews.com>,
	jtaylor@snet.net writes:
: I am trying to write a little script that will update the group file with a
: new user. I thought about reading in the whole line and apending to it, then
: writing it out. I also thought about just prepending the new user's name to
: the begining of the list.

    my $user = "luser";
    my @groups = qw( lp user other );

    for (@groups) {
        my($group,$passwd,$gid,$members) = getgrnam $_;

        unless (defined $group) {
            warn "Group `$_' does not exist!\n";
            next;
        }

        if ($members eq "") {
            $members = $user;
        }
        else {
            $members .= " $user";
        }
        $members =~ tr/ /,/;

        print join(":", $group, $passwd, $gid, ""), $members, "\n";
    }

Of course, you'll probably want to run through /etc/group line by line
searching for each group you want to change.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Tue, 14 Apr 1998 00:02:09 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: environnemt variables
Message-Id: <35328B61.767D8A62@acc.umu.se>

Get lost Abigail. 
I can't think of a single message from you where you haven't been rude
to a person. 
Also I can't remeber a single message where you have ever given help to
anyone.

Why bother? Sick or something!


/Niclas

Abigail wrote:
> 
> Francois-Xavier.bor@bde.espci.fr (Francois-Xavier.bor@bde.espci.fr) wrote
> on MDCLXXXV September MCMXCIII in <URL: news:6goe0s$9av$1@pinot.ext.jussieu.fr>:
> ++ hi !
> ++
> ++ i would like to call a perl script each time someone looks my webpage
> ++ (in order the perl script get the IP adress of everyone; that way , i
> ++ would be able to write a hitcounter script ). my problem is not so
> ++ much the perl script (Randal Schwartz give its own on line if i need
> 
> Then why ask here?
> 
> ++ help) but what should i put in my html page to call the perl script. I
> ++ am looking something like <Applet> but for perl instead for java.
> 
> Ask in an HTML group.
> 
> Abigail
> --
> perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: Mon, 13 Apr 1998 22:37:03 GMT
From: Bill 'Sneex' Jones <sneaker@earthling.net>
Subject: Re: environnemt variables
Message-Id: <35329205.2C72CFFA@earthling.net>

Francois-Xavier.bor@bde.espci.fr wrote:

> i would like to call a perl script each time someone looks my webpage
> (in order the perl script get the IP adress of everyone; that way , i
> would be able to write a hitcounter script ).

 One way that I do that is -

<img src=/cgi/xRegEx.cgi>

You have to return a gif, a single pixel.

Another, better way, is to have the cgi be the page itself.  If you're
into SSI, then
utilizing CGI as a file type isn't any more dangerous :-)

HTH,
Sneex :-)

--
__________________________
Bill Jones...............|
Sneaker's Nest...........|
Chasecreek Systemhouse...|





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

Date: 13 Apr 1998 22:59:25 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: environnemt variables
Message-Id: <6gu5cd$bhc$2@marina.cinenet.net>

N i c l a s O l o f s s o n (gurun@acc.umu.se) wrote:
: Get lost Abigail. 
: I can't think of a single message from you where you haven't been rude
: to a person. 
: Also I can't remeber a single message where you have ever given help to
: anyone.
: 
: Why bother? Sick or something!

The original poster (like so many others) committed an error similar to
entering a library and asking where the frozen foods section was located. 
Is it truly so rude to redirect such a person to the supermarket next
door, rather than simply ignoring them and letting them wander around
without hope of success? 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 13 Apr 1998 22:32:30 GMT
From: "Lee Falkenhagen" <falkenl@hotmail.com>
Subject: formatting localtime output
Message-Id: <01bd672c$25e18300$915c5093@lfalkenhagen.dhs.state.tx.us>
Keywords: localtime

I need to set the localtime output to be:

YYYYMMDD

and as

YYYYMMDD HHminmin

if you just return localtime, it truncates the leading zero for the month
and date.

Is there anyway to put it in there besides doing a "if less than 10, add
'0' to string" routine?

Thanks


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

Date: Mon, 13 Apr 1998 17:43:30 -0500
From: sonny <sonny@88net.net>
Subject: Re: General Rudeness, e.g. Re: Need a web login script
Message-Id: <35329511.20645BEC@88net.net>

I initiated this thread, and I was a frequent reader of clp.misc and sometime
participant from '93-'96.  I stopped reading the newsgroup because I didn't have
the time or use perl as much as I did when I was a sys admin/ data coolie.  I
recently started reading clp.misc because I wanted to do some <ahem> CGI stuff,
and I was very dismayed to find that the wonderfully helpful and cooperative
newsgroup that I remembered no longer existed.  Too bad, but I guess its true that
you can never go home

sonny

Stuart McDow wrote:

> tmornini@netcom.com (Tom Mornini) writes:
> >
> > It does amaze me how some people, who understand everything
> > technical, understand so little socially.
> <SNIP>
> Comes with the territory. I don't know of any newsgroups where
> rudeness isn't pervasive. Some are better than others, but rudeness is
> everywhere in the Usenet. Those who cannot handle rudeness shouldn't
> be reading the Usenet at all. That may suck, but that's the way it is.
>
> Part of the problem here in clpm is that some of us miss the halcyon
> days of early comp.lang.perl, when most of the questions were
> pertinent, not FAQs, and at least posters had made *some* sort of
> effort to solve the problem on their own before posting. Oh, and those
> were the days before the world-wide-web came into existance, too. I
> think a lot of people don't realize that perl was around a long time
> before the web was. At any rate, now we're frustrated with what
> clp.misc has become.

<SNIP>



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

Date: Mon, 13 Apr 1998 15:52:00 -0400
From: Dan Boorstein <danboo@negia.net>
To: scott@rappahannock-web.com
Subject: Re: help with delimiters
Message-Id: <35326CE0.7EC7FCAB@negia.net>

scott wrote:
> 
> why does this work?
> ($log,$name,$connect,$transmit,$receive,$protocol) = split /:/, $line;
> 
> and this wants to return the number of items in $line?
> ($log,$name,$connect,$transmit,$receive,$protocol) = split (/:/, $line);
> 

could you post a bit of code that demonstrates this behavior? as far as i
can see, these should behave identically.

-- 
dan boorstein


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

Date: Mon, 13 Apr 1998 16:02:34 -0600
From: Ye Ye <yey@cvilaser.com>
Subject: Hide or Encrypt perl source code
Message-Id: <35328B7A.37C1@cvilaser.com>

I am trying to write a system utility using Perl, 
is there a way that I can hide or encrypt my source
code, but still able to run it?

Thanks for any suggestions.

Ye


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

Date: 13 Apr 1998 23:26:34 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Hide or Encrypt perl source code
Message-Id: <slrn6j5820.89f.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Ye Ye <yey@cvilaser.com> wrote :
# I am trying to write a system utility using Perl, 
# is there a way that I can hide or encrypt my source
# code, but still able to run it?

The best way to hide it would be to not write it at all.  Then it
would be hidden in your brain. :)


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

Date: Mon, 13 Apr 1998 17:09:18 -0400
From: kevin graham <kgraham@s9000.furman.edu>
To: Chocolate <poohba@io.com>
Subject: Re: How do I format Local Date?
Message-Id: <35327EFE.530D453E@s9000.furman.edu>

Use neither. (localtime) will return a list of this data. Take a look at
perlfunc for the order. All the ata you're looking for is there.

 ..kg..


Chocolate wrote:
> 
> How do I format the $ENV{'LOCAL_DATE'} so that it will be:
> $day $date $month $year
> or can I format the /usr/bin/date?


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

Date: Mon, 13 Apr 1998 19:55:22 -0400
From: "bernie" <deforest@mkl.com>
Subject: i want to learn Perl. HELP!
Message-Id: <6gu8g7$h7v$1@news0-alterdial.uu.net>

i have been into the Internet for a while but, only have learned HTML.
 i thought that i chould expand my learning to Perl but, i don't know how to
get started.
if anyone knows of any sites that could help me or books  please tell me, i
would be very greatful.




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

Date: 13 Apr 1998 17:04:06 -0500
From: jesten@earth.execpc.com (Jim Esten)
Subject: Re: looking for a good win32 perl editor.
Message-Id: <6gu24n$55k@newsops.execpc.com>

James (jamesht@idt.net) wrote:
: Hello all,

: I'm ready to pull my hair out.

: Any suggestions?

: jamesht@idt.net

Several good ones out there - my favorite is UltraEdit 
and using the Perl dictionary file for the syntax 
coloring... user defined menu options for running scripts
and running syntax checks, etc easy to set up...

Not the full blow IDE which is to be available from 
ActiveState shortly, but a pretty friendly way to work.

Jim


-- 
Jim Esten
WebDynamic
jesten@wdynamic.com  http://wdynamic.com


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

Date: Mon, 13 Apr 1998 03:37:10 -0800
From: ~arthur <star@sonic.net>
Subject: make perl program start with icon
Message-Id: <3531F8E1.4BB5@sonic.net>

Hi, 

How can one get a Perl program to start off of an Icon on the desk top.

~arthur
star@sonic.net

"All David Blacks are great"


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

Date: Mon, 13 Apr 1998 22:52:28 GMT
From: FHeasley@chemistry.com (Frank)
Subject: Re: make perl program start with icon
Message-Id: <353596de.32538319@news.halcyon.com>

On Mon, 13 Apr 1998 03:37:10 -0800, ~arthur <star@sonic.net> wrote:

>Hi, 
>
>How can one get a Perl program to start off of an Icon on the desk top.
>
>~arthur
>star@sonic.net
>
>"All David Blacks are great"

You double click on the icon.
;-)

(this is a Windows question - try asking in a windows group.)


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

Date: 13 Apr 1998 23:02:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: make perl program start with icon
Message-Id: <6gu5ia$bhc$3@marina.cinenet.net>

~arthur (star@sonic.net) wrote:
: How can one get a Perl program to start off of an Icon on the desk top.

Details depend strongly on which 'desktop' (OS/GUI) you're talking about, 
of course.  But basically, just create a new program icon or shortcut or 
whatever whose command line is 'perl /path/to/your/app'.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Mon, 13 Apr 1998 18:12:04 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: Multi-dimensional Array Access
Message-Id: <Pine.GSO.3.95.980413180833.18549C-100000@cp.pathfinder.com>

On 10 Apr 1998, Jonathan Feinberg wrote:

> Jerome Bradenbaugh <jerome.bradenbaugh@firstunion.com> writes:
> 
> > @morestuff = ([1,2,3,4], [5,6,7,8], [9,10,11,12]);
> > 
> > Does anyone know the syntax for accessing the last element of each of
> > the sub arrays (in this case, the 4, 8, or 12)?
> 
> One rather compressed way:
> 
>    print "$r->[-1]\n" while $r = shift @morestuff;
> 
> Of course, that eats @morestuff.  You could therefore
> 
>    foreach $r (@morestuff) { print "$r->[-1]\n" }
> 
> -- 
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY

Or .... the ever popular reference:  

for $array_ref (@morestuff) {
	print " [ @$array_ref ] \n";
}

-------------------------------------------------------------
Andrew F. Lee                 |                              |
Software Engineer             |  parenttime.com              |
email: andrewf@pathfinder.com |  1271 Avenue of the Americas |
Phone: (212) 522-2769         |  New York, N.Y. 10020        |
-------------------------------------------------------------
        When I say, "Ignore the man behind the curtain."   
        That is because there is no man behind the curtain.



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

Date: Mon, 13 Apr 1998 23:40:53 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: Numeric validation
Message-Id: <35328665.94A7F543@acc.umu.se>

Craig Berry wrote:
> Why did the emailed suggestion make sense to you, but not this faq
> entry?

Maybe because not everyone in this newsgroup is a Perl God?
Regex falls under "easy to write, hard to read".
Hell, I'm pretty used to unix man pages but I really have to say that
perl has the worst I've seen in years. Written by hackers, for hackers,
more of the "hard to write, should be hard to read"-type..

Also suggests some of you go to comp.lang.vrml and take a course in news
communication done the way it should be done.


/Niclas


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

Date: 13 Apr 1998 22:55:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Numeric validation
Message-Id: <6gu551$bhc$1@marina.cinenet.net>

N i c l a s O l o f s s o n (gurun@acc.umu.se) wrote:
: Craig Berry wrote:
: > Why did the emailed suggestion make sense to you, but not this faq
: > entry?
: 
: Maybe because not everyone in this newsgroup is a Perl God?
: Regex falls under "easy to write, hard to read".
: Hell, I'm pretty used to unix man pages but I really have to say that
: perl has the worst I've seen in years. Written by hackers, for hackers,
: more of the "hard to write, should be hard to read"-type..

OK, here's an opportunity to contribute to the Perl community.  You seem
to be suggesting that the Perl FAQ in general, and the section in perlfaq4
covering numeric validation in particular, is hard to read.  How would you
rewrite it to be both more useful and still reasonably succinct?  Perhaps
you version could replace the current one! 

: Also suggests some of you go to comp.lang.vrml and take a course in news
: communication done the way it should be done.

Just went over there and it looked a touch more chaotic (!) but still 
quite similar to c.l.p.m -- what aspect of c.l.v do you find superior?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Mon, 13 Apr 1998 23:52:45 GMT
From: Bill 'Sneex' Jones <sneaker@earthling.net>
Subject: Perl 5.004_64 Slower???
Message-Id: <3532A3C3.638880C0@earthling.net>

Given the following code -

#!perl -w
use strict;
use diagnostics;

my $string = "This is a simple string.";
my $retStr = '';
my $chopAmt = 4;

$retStr = substr(reverse($string), 0, (0 -  $chopAmt));
$retStr = reverse($retStr);

print "$retStr\n", (0 - $chopAmt), "\n";


Why is it SO SLOW???

Is perl 5.004_64 slower???
__________________________
Bill Jones...............|
Sneaker's Nest...........|
Chasecreek Systemhouse...|




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

Date: Mon, 13 Apr 1998 23:11:24 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: print
Message-Id: <35327F7C.D87F20DD@acc.umu.se>

Kelby Valenti wrote:
> How do you do the following?
> I have a variable $One = "abc" , for example.
> 
> I want to:
> print "$Oned";
> 
> This thinks that my var name is $Oned, I just want it to print the var and
> then the letter.
> 
> If you could help i'd greatly appreciate it.
> Thank you,
>     Kelby

print $One."d";

-- 
Niclas Olofsson           Umee University, Sweden
Pedagoggrdnd 1A-210       Student, Dep. of Computing Science
907 30 Umee               mailto:gurun@acc.umu.se
                          http://www.acc.umu.se/~gurun
--
"En seglare ber inte om medvind, han ldr sig segla"


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

Date: Mon, 13 Apr 1998 22:25:13 GMT
From: Bill 'Sneex' Jones <sneaker@earthling.net>
Subject: Re: Project involving Word
Message-Id: <35328F3E.1142B627@earthling.net>

Anirvan Chatterjee wrote:

> This is wrong. There are thousands of valid criticisms of Microsoft;
> this just happens not to be one of them. Go to www.microsoft.com, and
> search for things like "word file formats" in their developer
> resources area;

I have developer access and I got the following message from a search-

The search for the exact phrase word file formats in the category, Full
Site Search, found no
                     matching records.

Oops.
Sneex :-)

--
__________________________
Bill Jones...............|
Sneaker's Nest...........|
Chasecreek Systemhouse...|





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

Date: Mon, 13 Apr 1998 17:58:54 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: Random Banner Problem
Message-Id: <Pine.GSO.3.95.980413175056.18549B-100000@cp.pathfinder.com>

On Fri, 10 Apr 1998, Jeremy Hill wrote:

Ok, you have gif's and jpg's in ./images

opendir(DIRH, "./images") or die $!;
@files = readdir(DIRH;
close(DIRH);

now, the interesting bit ...

$seed = ($$); # or whatever
srand($seed);
$randval = int rand();
$randval %= $#files + 1;  # picket fence problem ... add 1 or not???
return $files[$randval];


I think that's reasonable ...

> Someone Please help me!
> 
> I need a way to display random banners on a web page
> whenever someone goes to the page.  I thought that
> I could just say
> 
> <img src="MyScript.cgi">  
> 
> where MyScript.cgi would return the name of the
> banner.  I don't need any banner rotation, I just
> want a random banner each time the page is loaded
> or re-loaded.  Any help would be GREATLY appreciated.
> Thanking you in advance,
> 
> Jeremy Hill
> 
> P.S. I can handle everthing as far as choosing
> a random banner from a certain directory. I just
> need to know how to feed it to the web page.  And,
> I would rather not use server-side-includes.
> 
> 

-------------------------------------------------------------
Andrew F. Lee                 |                              |
Software Engineer             |  parenttime.com              |
email: andrewf@pathfinder.com |  1271 Avenue of the Americas |
Phone: (212) 522-2769         |  New York, N.Y. 10020        |
-------------------------------------------------------------
        When I say, "Ignore the man behind the curtain."   
        That is because there is no man behind the curtain.



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

Date: 13 Apr 1998 23:10:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Remove newline
Message-Id: <6gu60v$bhc$4@marina.cinenet.net>

Robert C. Rogers (agator@imaxx.net) wrote:
: I am trying to replace "|\n" with just "|", effectively removing
: the newline for those lines that end with a "|".  The code that
: I am attempting to use is as follows:
: 
: #!/usr/bin/perl

No -w ?  Almost always a good idea to use it.

: while (<STDIN>){
:    $tmp = <STDIN>;

Do you realize you're ignoring all the even-numbered lines (0, 2, 4, 
etc.)?  The <STDIN> in the while conditional reads a line into $_; the 
first line in the block then immediately reads the following line into 
$tmp.  Almost certainly not what you want to do.

:    $tmp =~ s/\|\n/\|/g;

No need to escape | on the replacement side, and the 'g' option is 
meaningless given that reading line-by-line will cause at most one of 
your search pattern to exist.

:    print $tmp;
: }
: 
: 'taint working.  What gives?  Thanks in advance.

Here's how I'd do it, if the file were very large:

  while (<STDIN>) {
    s/\|\n/|/;
    print;
  }

 ...and if the file were fairly small:

  undef $/;
  $file = <STDIN>;
  $file =~ s/\|\n/|/g;
  print $file;

HTH!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 13 Apr 1998 17:08:40 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Sharing a constant between scripts
Message-Id: <67kde5nb.fsf@mailhost.panix.com>

Robert Goheen <rsgoheen@pobox.com> writes:
> Andrew M. Langmead wrote:
> > The constant pragma accepts a list as an argument.
> > 
> > use constant LIST => qw(foo bar baz);
> > 
> > but lists don't get inlined the way scalars do.
> 
> Not to show any more ignorance than I already have, but I'm not certain
> if I completely understand what you mean by this last statement.  Could
> you perhaps elaborate a bit for me?

perlsub has this to say on inlining:

   Functions with a prototype of () are potential candidates for
   inlining. If the result after optimization and constant folding is
   either a constant or a lexically-scoped scalar which has no other
   references, then it will be used in place of function calls made
   without & or do.

In other words, if you define

   sub ONE_PLUS_TWO () { 1 + 2 };

And then

   printf "%d\n", ONE_PLUS_TWO;

Then, at compile-time, that invocation of the function ONE_PLUS_TWO is
replaced by the constant 3, saving the creation and destruction of a
stack frame, etc.  In other words, a tremendous win in run-time
efficiency.  The "use constant" pragma is currently implemented in
just that way, namely with subroutine definitions.  Perl does not
inline constant functions that return list values.

Please do read both perlsub and the docs for "use constant."

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Mon, 13 Apr 1998 16:05:13 -0700
From: foo@hotmail.com
Subject: WinNT comm port
Message-Id: <35329A29.23389C2A@cory.eecs.berkeley.edu>

Is there a way for perl running on WinNT to read data from the PC's
comm port?

Thanks
-Thomas
tjordan@cory.eecs.berkeley.edu


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 2311
**************************************

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