[6850] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 475 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 14 10:17:49 1997

Date: Wed, 14 May 97 07:00:29 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 14 May 1997     Volume: 8 Number: 475

Today's topics:
     ANNOUNCE: Xforms4Perl 0.7 <martin@nitram.demon.co.uk>
     Re: array of arrays (Mike Stok)
     Re: Array of Lists <rootbeer@teleport.com>
     Re: Array of Lists (Bernie Cosell)
     Re: Basic question -"Do you set execute bits"? (Mike Stok)
     Re: Definition of $<digit> in perlvar.pod (David Alan Black)
     don't read this if your time is of any value <ephidryn@ix.netcom.com>
     Re: Finding a pattern in a file (Chipmunk)
     how do i remove the stupid content header!? <rmadole3@4state.com>
     Re: inclu-OR in regex (Eric Bohlman)
     Ingres data on the Intranet deepa@ril.com
     Re: Ingres data on the Intranet <rheisner@worldnet.att.net>
     Re: Is perl too slow? (Andrew M. Langmead)
     Re: Need help for CGI/Perl... (michael morrell)
     oraperl on solaris 2.5/oracle 7.3 <swu@probe.att.com>
     Re: perl is a microcosm of computer language theory (Tim Goodwin)
     Re: Randal Schwartz (Tung-chiang Yang)
     Re: Randal Schwartz (Paddy Spencer)
     Re: Randal Schwartz (Chris Russo)
     Re: Randal Schwartz (I R A Aggie)
     Solaris 2.4 utmp and lastlogin (Brain Dead)
     Re: sort files in order of size <merlyn@stonehenge.com>
     Re: speed up "STDOUT" ? (kim Tan)
     Re: speeding up a regex (Tad McClellan)
     Re: speeding up a regex (Justin C Lloyd)
     Re: Timing Out While waiting for user input <marclang@draz.cs.washington.edu>
     Re: Timing Out While waiting for user input (I R A Aggie)
     Re: Timing Out While waiting for user input (Tim  Smith)
     Undump (continued) <sarah@ecl.wustl.edu>
     Re: unlink vs. system("rm...") (Andrew M. Langmead)
     Week numbers <bjorn.w.nilsson@edt.ericsson.se>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 14 May 1997 13:58:20 GMT
From: Martin Bartlett <martin@nitram.demon.co.uk>
Subject: ANNOUNCE: Xforms4Perl 0.7
Message-Id: <5lcgds$kg$1@nadine.teleport.com>

ANNOUNCING The availability of version 0.7 of Xforms4Perl, an extension
to
Perl that provides access to the xforms GUI api library and,
consequently,
opens up the ability to write sophisticated X applications completely in
Perl. 

This is version 0.7 which provides access to practically the entire
xforms
api as delivered by its current public version 0.86, the two most
recent testing versions, 0.84 and 0.85, and the previous public release,
0.81. It requires Perl 5.002 or later. Various platform-specific
bugs and issues have been resolved with this release, making it a more
solid performer on such platforms as HP-UX and SGI. Name spaces are now
completely in line with CPAN standards - a script provide conversion
facilities for applications that use previous versions.

Xforms4Perl comes with a directory of demonstration programs that range
from simple api examples to full-fledged system utilities and
applications.

The package is available as a tar archive by FTP from:

        ftp.demon.co.uk /pub/perl/perl

and

        $CPAN/authors/Martin_Bartlett

named Xforms4Perl-0.7.tgz, and as a Linux RPM from

        ftp.redhat.com /pub/redhat/devel/powercd/RPMS/<platform name>

named Xforms4Perl-0.7-1.<platform name>.rpm

Xforms itself is available from 

        ftp://einstein.phys.uwm.edu/pub/xforms

and as a linux  RPM from the Red Hat location mentioned above.

For those who use David Hind's pcmcia package in Linux, xforms is the
toolkit that was used to build the cardinfo GUI panel. 

This is the version of Xforms4Perl that is required to use the Xforms
component of Randy Ray's X11:fvwm perl extension (thanks to him for
copious HP-UX testing and suggestions resulting from that).

Support is via the xforms mailing list, comp.lang.perl.modules, and
e-mail
(to the address below).

Licensed under the GNU public license. Details delivered with the
package.
 
===========================================================
    _/      _/_/_/_/
   _/_/  _/_/     _/
  _/ _/_/ _/_/_/_/      Martin John Bartlett
 _/  _/  _/     _/      (martin@nitram.demon.co.uk)
_/      _/_/_/_/
       _/
_/    _/
 _/_/
===========================================================




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

Date: 14 May 1997 11:09:01 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: array of arrays
Message-Id: <5lc6gd$nf4@news-central.tiac.net>

In article <33797A7A.371F@iil.intel.com>,
Allon Henig  <ahenig@iil.intel.com> wrote:

>	is it possible to build an array of arrays like:
>
>	@Array1= ('a','b','c');
>	@Array1= ('x','y','z');
>	push (@BIGARRAY,@Array1);
>	push (@BIGARRAY,@Array2);	

Yes, check out the perldsc (perl data structures cookbook) for some
examples.  The thing to remember is that array elements (or hash values)
can only contain a scalar, but that scalar can be (as of perl 5) a
reference to another data item.  Using [] to create an anonymous copy of a
list and return a reference to it I can do this in the perl debugger:

  DB<1> @Array1= ('a','b','c'); @Array2= ('x','y','z');

  DB<2> push @BIGARRAY, [@Array1]

  DB<3> push @BIGARRAY, [@Array2]

and use the X command to get BIGARRAY "pretty printed"

  DB<4> X BIGARRAY
@BIGARRAY = (
   0  ARRAY(0x140172308)
      0  'a'
      1  'b'
      2  'c'
   1  ARRAY(0x1401723f8)
      0  'x'
      1  'y'
      2  'z'
)

>	now, how do I print $BIGARRAY[0] data (which ofcourse must be:
>		'x' 'y' and 'z') ???

you can use the @ symbol to dereference a reference to an array, as I'm
too lazy to remember how tightly dereferencing binds compared to indexing
I use {} around the thing I'm dereferencing (the perlref manual page
covers this in more detail)

  DB<5> print "it's @{$BIGARRAY[0]}"
it's a b c
  DB<6> print "1,2 is $BIGARRAY[1][2]"
1,2 is z

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 12 May 1997 08:00:24 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "William D. Reardon" <wdr1@midway.uchicago.edu>
Subject: Re: Array of Lists
Message-Id: <Pine.GSO.3.96.970512075833.2793A-100000@kelly.teleport.com>

On Sun, 11 May 1997, William D. Reardon wrote:

> 	I'm trying to create a data structure that is just an array of
> lists.  Just to get something to get started, I tried doing something
> like this:
> 
> for $v (1 .. $vxs) {
> 	$array[$v] =  (3,2,1) ;	
> }

You have to use references; read perlref(1), which will tell you to use
square brackets where you have parens around the list. perllol(1) and
perldsc(1) may also be helpful. Hope this helps! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Tue, 13 May 1997 03:31:05 GMT
From: bernie@fantasyfarm.com.net (Bernie Cosell)
Subject: Re: Array of Lists
Message-Id: <3378dc2e.106917166@news.infoave.net>

wdr1@midway.uchicago.edu (William D. Reardon) wrote:

} 	I'm trying to create a data structure that is just an array of
} lists.  Just to get something to get started, I tried doing something
} like this:
} 
} for $v (1 .. $vxs) {
} 	$array[$v] =  (3,2,1) ;	
} }
} 
} The above, however, just creates an array with each element equal to
} 1.  What am I doing wrong here?  I read the Lists of Lists thing, but
} I'm still stumped.

The problem is that you have your 'contexts' a bit confused [and that's a
key concept in perl so you gotta get it straight].  Look at the assignment:
    $array[$v] = (3,2,1) ;
The left hand side is a *scalar*, so the right hand side will be evaluated
in _scalar_context_.  But the right hand side is a list... a quick trip to
the reference book [if you happen not to know it] and you'll see that a
list evaluates to its last element in scalar context [AND NOTE: that is
true for neither arrays nor hashes --- you can go look up what they do in
scalar context].  Anyhow, so the list (3,2,1) evaluates to the scalar '1',
and that's what gets assigned.

What you wanted was "a scalar that names a list".  That is, in perl-speak,
a *reference* to a list.  In perl you use a different syntax for that: you
use square brackets instead of parens.  And so:
     $array[$v] = [ 1, 2, 3 ] ;
will do what you expected and make the [scalar!] v'th entry of $array be a
reference to the list.

  /Bernie\
} 
} Thanks,
} -Bill
} 
} 
} -- 
} William Reardon    		 		       wdr1@midway.uchicago.edu
}  	      http://student-www.uchicago.edu/users/wdr1/
} 		     Elegance counts towards credit.
} 

-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: 12 May 1997 10:37:03 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Basic question -"Do you set execute bits"?
Message-Id: <5l6rsf$5bn@news-central.tiac.net>

In article <33765AA6.96@byte-back.com>,  <brennan@byte-back.com> wrote:
>I am trying to get a perl script to run on a web server (not my
>server).  I have written the basic "hello" perl to test to see if I
>could get it to work.  I get a "500 server error", I then wrote a perl
>that returned a complete header and got a "Document contains no data"
>error.  I have run the script locally and it works great.  The webmaster
>for this site tells me that I have to set the bit execute on the script
>for it to work.  I think that he doesn't know what he is talking about,
>since the script is just a text file.  Do you have to set the execute
>bit on a perl script? or (This is what I think) is the problem likely to
>be on the server pathway?  I just really need to know about the execute
>bit thing.

On a unix system you do need the script to be readable and executable by
the user-id which is used by the web server for CGI scripts.  You might
want to check out Tom Christiansen's list of common problems with CGI
scripts which happen to be written in perl (and their solutions) at

  http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html

(amogst other CPAN sites.  The master CPAN site is at ftp.funet.fi under
/pub/languages/perl/CPAN)

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 13 May 1997 19:14:58 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Definition of $<digit> in perlvar.pod
Message-Id: <5laeji$29h@pirate.shu.edu>

Hello -

Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:

>>         perl -e '$_="abcd"; /(?:(b)|(c))+/; print "$1:$2:$3:$4\n"'
>>         :c::
>> 
>>         perl -e '$_="bcde"; /(?:(b)(c)|(d)(e))+/; print "$1:$2:$3:$4\n"'
>>         :c:d:e

>my understanding is that the results should be
>        :c::  and  ::d:e

>but it would seem that re-entry of the enclosing parentheses only
>resets $1 and nothing higher---which is why your first example
>appears to work correctly, but the second example doesn't as it
>fails to reset $2. (I've checked similar constructs with several
>sets of parentheses, and it seems $1 is the only one reset)

I think what's happening in the second example is that (b) is
re-entered when the engine hits the 'd' in the string, but since
that causes the left-hand alternative to fail, the engine jumps 
over the (c) (the success of which now doesn't matter), without
re-entering it and without resetting $2 (which was 'c' after the
match of 'bc').

In the following variant, where the success of (c) is not related to
the success of (b), both fail and $1 and $2 are both reset:

perl -e '$_="bcde"; /(?:(b)|(c)|(d)(e))+/; print "$1:$2:$3:$4\n"'
::d:e


David Black
dblack@icarus.shu.edu


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

Date: Wed, 14 May 1997 05:51:58 -0700
From: ephidryn hydrochloride <ephidryn@ix.netcom.com>
Subject: don't read this if your time is of any value
Message-Id: <3379B56E.2991@ix.netcom.com>

im just learning perl but a task came to me already.
ris it possible to get HTML documents from every link
an HTML page. Kinda like a tree effect    |
                                          |
                                         / \
                                        /   \
                                       /     \
                                      /\     /\
                                     /  \   /  \
i would like to store every file with it's orginal
name. unfortuanatly the number of documents would 
make it impossible to do this by hand.

thanks for reading this silly inquiry.

ill be pleased to hear from you.

flame mail and suggestions ---+
                              |
                              |
                             \ /
                              '
               mailto:ephidryn@ix.netcom.com


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

Date: 14 May 1997 05:07:53 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Finding a pattern in a file
Message-Id: <5lbhb9$3ie$1@dartvax.dartmouth.edu>

In article <JD-1105972330580001@fwk103102.res-hall.nwu.edu>
JD@anon.com (*) writes:

> Hello - you seemed comfortable with Perl so I was wondering if you could
> answer a question of mine.  I have a field in a form where one could type
> a copyright symbol or a registered symbol ( ascii:  %A )  I have a
> function called fix that translates most annoying sequences HOWEVER the
> sequence used in HTML for the registerd symbol is &reg; and the perl
> script translates %A as blank spaces.  Any idea why? - thanx - piggy

Quite a delay between this message appearing in my In Box and it
appearing in the newsgroup...

I'm not familiar with the representation %A for the registered symbol.
But if that is, as you say, a valid representation, there's probably a
bug in the fix function.  Could you provide us with the code for it?

Chipmunk


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

Date: 12 May 1997 20:22:31 GMT
From: "Robert Madole" <rmadole3@4state.com>
Subject: how do i remove the stupid content header!?
Message-Id: <01bc5f12$ec19dfe0$d08eced0@rmadole3.4state.com>

i have perl 5.003 for win32 on my NT system.  it automatically prints the
content header and i don't get a chance to put something else in that first
line.  what do i do?



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

Date: Wed, 14 May 1997 09:59:58 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: inclu-OR in regex
Message-Id: <ebohlmanEA613y.8r3@netcom.com>

alex (alex.t.silverstein@bender.com) wrote:
: I want to match the letters a b and c in a string at least once
: but in any order. The part I don't get is how to say "in any order"
: in a regex (I can't seem to find this explained well in 
: "Learning Perl"). I tried the following:

/(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/

You can factor it a bit, though that may make it less readable.



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

Date: 14 May 1997 12:36:32 GMT
From: deepa@ril.com
Subject: Ingres data on the Intranet
Message-Id: <5lcbkg$6l0$1@bilbo.reference.com>


We have huge databases on Ingres. We wish to put some
web applications which will be able to query the Ingres
database.

Can anyone make any suggestions.
We are using the Apache Web Server. Using perl extensively
for CGI development.

Thanks in advance.

-deepa


--

Posted using Reference.COM                         http://www.reference.com
Browse, Search and Post         Usenet and Mailing list Archive and Catalog.

InReference, Inc. accepts no responsibility for the content of this posting.


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

Date: Wed, 14 May 1997 06:48:22 -0400
From: "Robert H. Eisner" <rheisner@worldnet.att.net>
To: deepa@ril.com
Subject: Re: Ingres data on the Intranet
Message-Id: <33799876.6C83@worldnet.att.net>

deepa@ril.com wrote:
> 
> We have huge databases on Ingres. We wish to put some
> 
> web applications which will be able to query the Ingres
> 
> database.
> 
> Can anyone make any suggestions.
> 
> We are using the Apache Web Server. Using perl extensively
> 
> for CGI development.
> 
> Thanks in advance.
> 
> -deepa
> 

Trifox has a product, VORTEXperl.  It talks to multiple RDBMS.
It uses Perl Sockets so there is no need to re-build the Perl
runtime.  

Please see http://www.trifox.com for details.

The beta version is available on our FTP server:

 ftp://ftp.trifox.com/pub/products/perl/vtxperl.tar

Trifox has also offers, VORTEXjdbc and VORTEXjava.  They talk to
multiple RDBMS.

Check out the following URL for information on VORTEXjava:

  http://www.trifox.com/vortex/vtxjava.html

Check out the following URL for information on VORTEXjdbc:

  http://www.trifox.com/vortex/vtxjdbc.html


Regards,

Bob Eisner
408-369-2392


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

Date: Wed, 14 May 1997 12:34:48 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is perl too slow?
Message-Id: <EA68A0.M1F@world.std.com>

no_spam_please@fi.muni.cz (Jan "Yenya" Kasprzak) writes:
>	Well, the above does explain why the code is slower than
>code using builtin sort, but this also apply to the other programming
>languages in that test. The question in not "Why that code is slow",
>but "Why that Perl code is slower than Elisp or Java code".
>Note that he does not measure "the fastest sorting algorithm in those
>languages", but "how fast are loops, string compares, etc. in those
>languages".

There is a file of quotes from Larry Wall at
<http://www.perl.com/CPAN/misc/lwall-quotes>. One of them says:

    Q. Why is this so clumsy?
    A. The trick is to use Perl's strengths rather than its weaknesses.
            --Larry Wall in <8225@jpl-devvax.JPL.NASA.GOV>

If you are going to be writing qsort functions all day, and need them
to run extremely quickly, you probably shouldn't use perl, java or
emacs lisp.

The advantage in perl, (and many other languages) is that they have
much higher level constructs than simple comparisons and loops. If you
make use of them, not only will you very likely write your program
quicker (see the section on "Programmer Efficiency" in the camel
book.) but your program will be spending more time in each statement,
and less having the interpreter move around from statement to
statement. Since this "benchmark" is not a good example of common perl
code, its results are entirely unimportant.

Of course, if it makes you feel any better, you can speed up the code
by about 8% if you just change all of the conditional and looping
blocks (things like: while($A[$I] lt $X) { $I++;}) to their statement
modifier equivilents ($I++ while $A[$I] lt $X;).
-- 
Andrew Langmead


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

Date: 12 May 1997 20:09:32 GMT
From: morrell@tiac.net (michael morrell)
Subject: Re: Need help for CGI/Perl...
Message-Id: <5l7tds$h45@news-central.tiac.net>

In article <5l76n4$ap5@horus.mch.sni.de>, T.Wende@mail-me.com says...
>
>Hi *.*,
>
>Is anybody there, who can tell me what the error-message
>------------------------------------------------------------------------------
------------------------------------------------
>500 Server Error
>
>The server encountered an internal error or misconfiguration and was
>unable to complete your request.
>
>Please contact the server administrator, webmaster@sporthaus.com and
>inform them of the time the error occurred , and
>anything you might have done that may have caused the error.
>
>Error: HTTPd: malformed header from script
>/usr/local/etc/httpd/htdocs/sport/cgi-bin/formmail.cgi 

malformed header usually refers to a simple problem, the
correct header is not being output FIRST

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

Note, it has to be FIRST before <HTML> or anything else,
and make sure there are 2 line feeds after it.

mike






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

Date: 12 May 1997 20:40:17 GMT
From: "Chi-Sharn Wu" <swu@probe.att.com>
Subject: oraperl on solaris 2.5/oracle 7.3
Message-Id: <01bc5f14$3f8cada0$061e1587@ccpnotes.mt.att.com>

Hi:

 My project plans to move to solaris 2.5 and oracle 7.3 in the
near future. Does any one have experience in building oraperl
(perl 4) on such configuration?  Thanks for any info.

Chi-Sharn Wu
swu@jolt.att.com


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

Date: 14 May 1997 13:16:25 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: Re: perl is a microcosm of computer language theory
Message-Id: <5lcdv9$fm2@tube.news.pipex.net>

> 6.  functional programming (Perl 5, closures) a la Lisp

Hardly!  Perl's closures are useful, but they're no substitute for first
class functions.

Tim.
-- 
Tim Goodwin | "I'm a west coast kinda guy, I'm not even sure
UUNET, UK   | where Washington is.. :-)" -- Jordan Hubbard


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

Date: Mon, 12 May 1997 19:53:13 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Randal Schwartz
Message-Id: <tcyangEA338p.7L5@netcom.com>

He/she wants to catch everyone's attention by using Randal's name in
the subject :)

==========================
Craig Berry (cberry@cinenet.net) wrote:

: "This is a question for Janet Reno.

: "My local city council has passed a new zoning law, and I need to 
: determine if building a spare bedroom onto the back of my house is 
: allowed under the new rules."

: Isomorphic requests, those two.  Why are you asking Randal (specifically) 
: this question?

--
Tung-chiang Yang                       tcyang@netcom.com

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.clever.net/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: Wed, 14 May 1997 12:47:57 GMT
From: paddy.spencer@parallax.co.uk (Paddy Spencer)
Subject: Re: Randal Schwartz
Message-Id: <863613921.148928@red.parallax.co.uk>

tcyang@netcom.com (Tung-chiang Yang) kirjoittanut::

: He wanted to put the label "Randal Inside" on his script :)
                              ^^^^^^^^^^^^^
Given that Randal has

: print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
: ## legal fund: $20,495.69 collected, $182,159.85 spent; just 476 more days
: ## before I go to *prison* for 90 days; email fund@stonehenge.com for details

at the end of his post, I'm not sure he'll approve of the concept...

-- 
Paddy Spencer        Parallax Solutions Ltd (http://www.parallax.co.uk/)
No-one ever said to van Gogh, "Paint 'A Starry Night' again, man!" 
                                                        -- Joni Mitchell



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

Date: Tue, 13 May 1997 13:25:30 -0700
From: crusso@alink.net (Chris Russo)
Subject: Re: Randal Schwartz
Message-Id: <crusso-1305971325300001@buzz.alink.net>

In article <5la767$a9n@news-central.tiac.net>, mike@stok.co.uk wrote:

>In article <hf38l5.f53.ln@localhost>, Tad McClellan <tadmc@flash.net> wrote:
>>Michael Lauzon (ce940@torfree.net) wrote:
>>: This is a question for Randal Schwartz.
>>
>>
>>Well, then you delivered it the wrong way.
>
>>Individual communications should use an individual communication medium
>>such as email.
>
>Maybe that's why he said
>
>>: appreciate it if you would take a look at it, though I will need to email 
>>: it to you...and for that I will need your email address.  I would really 

Yeah, obtaining Randal's email address is really difficult.  You actually
have to read some random day's worth of clpm postings.  Yikes! :)

Based on the ubiquitous availability of Randal's email address, Tad's
point still holds:  The wrong medium was chosen for the initial contact.

Anyway,

Chris Russo

----------------------------------------------------------------------
Chris Russo                          A-Link Network Services, Inc.
crusso@alink.net                     Bolo me
http://www.alink.net/~crusso


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

Date: Wed, 14 May 1997 09:25:05 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Randal Schwartz
Message-Id: <fl_aggie-ya02408000R1405970925050001@news.fsu.edu>

In article <5la767$a9n@news-central.tiac.net>, mike@stok.co.uk wrote:

[about email]

+ Maybe that's why he said

+ >: appreciate it if you would take a look at it, though I will need to email 
+ >: it to you...and for that I will need your email address.  I would really 

Oh, like we hardly ever see Randal around here... ;)

James - and its not like he posts under a munged 'From:', either...

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Mon, 12 May 1997 18:27:17 GMT
From: aam@netcom.com (Brain Dead)
Subject: Solaris 2.4 utmp and lastlogin
Message-Id: <aamEA2z9H.1HG@netcom.com>

To All,

I need to be able to read utmp/wtmp files and /var/adm/lastlogin. I've 
read all the man pages and other relevant docs ad nauseum, but it hasn't 
helped.

If I could get a script to read them with C, that'd be great; what I'd 
*really* like is to be able to read them with perl.

Here's one of my many attempts that don't work:

---------------------------------
     #include <utmp.h>
        int y;
        extern utmpname;

main()
{
     /*   fopen(WTMP_FILE, "r"); */
        for (y = 1; y < 2; y++) {
                (void)printf("%40d\n", (int)utmpname);
                return (0); }
}
-------------------------------------

TIA,
Roman (aam@netcom.com)


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

Date: 14 May 1997 05:18:47 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: sort files in order of size
Message-Id: <8cpvuunt5k.fsf@gadget.cscaper.com>

>>>>> "Vivek" == Vivek Rao <vrao@roma.physics.uiuc.edu> writes:

Vivek> How can I list all files (relative path name) 
Vivek> in a directory and its subdirectories in order of size. 

    #!/usr/bin/perl
    # show files by descending size, starting at directories
    # named as arguments
    use File::Find;
    find (sub {$size{$File::Find::name} = -s _ if -f;}, @ARGV);
    for (sort {$size{$b} <=> $size{$a}} keys %size) {
      printf "%10d %s\n", $size{$_}, $_;
    }

Perl is your friend.  Get Perl.  Use Perl.  I whipped this up in about
three minutes (including testing).

Just another Perl hacker,
-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Wed, 14 May 1997 12:10:40 GMT
From: kimtan@lucent.com (kim Tan)
Subject: Re: speed up "STDOUT" ?
Message-Id: <5lc9r9$83a@nntpa.cb.lucent.com>

Thanks for everyone who replied to my post, that is exactly what
I wanted to do. Also want to followup on the post for those who might
be interested :
what I found out is that using  the pipe, the program does seems to be
block buffered instead of line buffered. I tried as suggested , ie. cprogram
vs cprogram | cat, and for that with the pipe, it displayed "page by page"
instead of line by line. And the time for the first page to appear is a 
differnce of about 7 seconds for my program, which means that the initial
performance will get a hit if not turning out the buffering within the 
Cprogram. Will talk to the cprogram developer to check it out.

In article <3378A390.62A6@corp.airmedia.com>, Paul S R Chisholm 
<psrc@corp.airmedia.com> wrote
>Then ..
>
>if (! open(CPROG, "cprogram |") {
>    die "cannot read from cprogram: $?\n";
>}
>while (<CPROG>) {
>    do something;
>}
>
>You'd better ensure that cprogram doesn't buffer its output when writing
>to a pipe. The simplest way to do this is to run:
>
>$ cprogram
>
>in one window and:
>
>$ cprogram | cat


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

Date: Mon, 12 May 1997 07:55:20 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: speeding up a regex
Message-Id: <ov37l5.ip.ln@localhost>

Justin C Lloyd (lloyd@cs.fsu.edu) wrote:
: Just me again, responding to my own message.  After weeks of thinking about
: this, I finally post a question and then come up with something.  I changed

:    $_->[5] =~ /^($first|$firstinit)?\s+($middle\s+)?$last$/

: to

:    $_->[5] =~ /^$firstinit/ && /^($first|$firstinit)?\s+($middle\s+)?$last$/
:             
:              \________________/

: and that sped it up tremendously.
           ^^^^^^^^^^^^^^^^^^^^^^^

But it isn't doing the same thing!

Starting with the correct letter is required by the new way. It was
optional with the first one, so the first one is spending time trying
to match against a bunch more strings...


: I would, however, still appreciate any advice people may have.  You can never
: learn too much...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 14 May 1997 12:05:05 GMT
From: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: Re: speeding up a regex
Message-Id: <5lc9ph$7b1$1@news.fsu.edu>

Justin C Lloyd (lloyd@cs.fsu.edu) wrote:
[snip, snip]

No need to quote myself! :)

I am truly grateful for all of the informative posts and e-mails, both for
teaching me new stuff (which I promptly read or re-read in Camel v2), and for
pointing out some mistakes.

Thanks to my own persistance staying up nights reading through the Camel v2,
and with everyone's help, my program is now blindingly fast, especially when
compared to my first very naive approach.  At first, it would take
approximately *2 seconds* to process a single student on a roster.  So imagine
a roster of 20-30 students (and we even have some with 70).  And now, the
program can process roughly 30 rosters with an average of 25 students per
roster in about 3-3.5 seconds!  Thats a speedup of over 400 times!

Here are some of the changes/suggestions that were made:

1) checking a much simpler regex (first name only) before trying a complex one
   (first name or initial, an optional middle initial, and a last name)

2) using eval and /o to speed up the regex checks (several people suggested
   this)

3) rearranging the layout of the password file in memory.  now, instead of
   simply having an array of references to arrays (from calls to getpwent), it
   is now a hash whose indices are uppercased last names and the values are
   the references to arrays. (Thanks to Owen Taylor!)


One question, though.  Why did using (?:) over () in my regexes seem to *slow*
it down instead of speed it up?  The original regex was

   /^($first|$firstinit)?\s+($middle\s+)?$last$/io

and using

   /^(?:$first|$firstinit)?\s+(?:$middle\s+)?$last$/io

only went slower.  I was befuddled by that one.


Thanks again for all the wonderful help and advice!  My Perl knowledge keeps
advancing by leaps and bounds with such guides as CPAN, Camel v2, MRE by
Jeffrey Friedl, and so forth, but y'all always astound me.

JcL

-- 
Justin C. Lloyd ______________________________________________________________
Graduate Teaching Assistant                phone: 904/644-0559
Department of Computer Science             email: lloyd@cs.fsu.edu
Florida State University                   www:   http://www.cs.fsu.edu/~lloyd

                               P + L = :)


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

Date: Mon, 12 May 1997 18:57:00 GMT
From: Marc Langheinrich <marclang@draz.cs.washington.edu>
Subject: Re: Timing Out While waiting for user input
Message-Id: <qyjsozssemb.fsf@draz.cs.washington.edu>

Brian Haney <bhaney@elvis.turner.com> writes:

> What I am trying to accomplish is asking a user for input. If they 
> do not enter input within a specific amount of time, the program will
> continue.
> 
> A general algorithm would be:
> 
> if (wait 60 sec for user input) {
>    take user input;
> } else { # no user input after 60 sec
>    do other code;
> }
> 
> Thanks,
> Brian
> -- 
> Brian Haney                              Brian.Haney@turner.com
> Turner Broadcasting System, Inc.
> One CNN Center, 11 South                 
> Box 105366                              
> Atlanta, GA 30348                          FAX : (404) 588-6000
try alarm()

(see 'perldoc -f alarm' for an example)


*hth*

marc
---
Marc Langheinrich                  Department of Computer Science & Engr.
office phone: (206) 543-5129       University of Washington, Box 352350, 
email: marclang@cs.washington.edu  Seattle, WA 98195-2350, USA
www: http://www.cs.washington.edu/homes/marclang/


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

Date: Mon, 12 May 1997 16:19:51 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Timing Out While waiting for user input
Message-Id: <fl_aggie-ya02408000R1205971619510001@news.fsu.edu>

In article <qyjsozssemb.fsf@draz.cs.washington.edu>, Marc Langheinrich
<marclang@draz.cs.washington.edu> wrote:

+ (see 'perldoc -f alarm' for an example)
 
+ *hth*

Ordinarily, I'm thrilled to learn something new. In this case:

$ perldoc -f alarm
Unknown option: f
perldoc [-h] [-v] [-u] PageName|ModuleName|ProgramName...
    -h   Display this help message.
    -t   Display pod using pod2text instead of pod2man and nroff.
    -u   Display unformatted pod text
    -m   Display modules file in its entirety
    -v   Verbosely describe what's going on.

[and so on]

Now, do I have an old version of perldoc??

James

-- 
Consulting Minister for Consultants, DNRC

To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 12 May 1997 11:35:34 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Timing Out While waiting for user input
Message-Id: <5l7ntm$ovm@web.azstarnet.com>

In article <33770C5D.50E7@elvis.turner.com>,
Brian Haney  <bhaney@elvis.turner.com> wrote:
>What I am trying to accomplish is asking a user for input. If they 
>do not enter input within a specific amount of time, the program will
>continue.

You might want to check out the Term::ReadKey module which includes
facilities for doing this type of thing.

ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/Term/

Tim



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

Date: Mon, 12 May 1997 10:32:30 -0500
From: Sarah Burcham <sarah@ecl.wustl.edu>
Subject: Undump (continued)
Message-Id: <Pine.SOL.3.95.970512102416.6039L-100000@joplin.ecl.wustl.edu>

Okay, okay, the failure to get core files was shell limits setting my
coredumpsize to 0.  Bad hair day. <sigh>

But the other question is still valid:  What is better:  Recompiling
perl with GNU Emacs unexec or using TeX undump?  I already know about the
compiler... I just wanted some advise on these two choices.

// Sarah Elizabeth Burcham
// Engineering Computer Laboratories
// sarah@ecl.wustl.edu





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

Date: Wed, 14 May 1997 11:32:54 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: unlink vs. system("rm...")
Message-Id: <EA65Eu.EA5@world.std.com>

abigail@fnx.com (Abigail) writes:

>True, but note that 'rm -f' will always succeed; that's what the -f
>is doing. unlink however may fail, when you don't have permission to
>delete it, or when it doesn't exist.

>unlink and rm -f just aren't comparable. Unless you choose to ignore
>return values anyway; then it hardly matters.

"rm -f" will always report success. That isn't the same as "rm -f"
will always succeed.

You're just choosing a different way of ignoring return code of the
underlying unlink() system call.

-- 
Andrew Langmead


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

Date: Wed, 14 May 1997 15:50:43 +0200
From: Bjvrn Nilsson <bjorn.w.nilsson@edt.ericsson.se>
Subject: Week numbers
Message-Id: <3379C333.4721@edt.ericsson.se>

Hi again!

The second post on this matter. I need to get the current week number
given a date. The peculiarity is that in contrast to the american
system, where the 1'st of January always render week # 1, I'm using the
Swedish week number system, of which I'm not certain of the rules. (The
1'st of Jan could be week 52, week 53 or week 1.

Any insight in this matter is appreciated.

Cheers again

Bjvrn (No, I'm not the swedish chef, barf barf barf :-)


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

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

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