[8372] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1989 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 28 00:07:17 1998

Date: Fri, 27 Feb 98 21:00:31 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 27 Feb 1998     Volume: 8 Number: 1989

Today's topics:
    Re: "PERL" puzzle.  ANSWER! <davegates@davegates.com>
        **Perl/CGI programmers Needed - Florida** <jmorris@silcoinc.com>
        __FILE__ and __LINE__ internal Perl variables <robm@encomix.es>
    Re: __FILE__ and __LINE__ internal Perl variables (Mike Stok)
        a newbie Q <loo@algonet.se>
    Re: Calling Perl Scripts (Joe McMahon)
        Compiling 5.004_60 with threads <joeo@hpfcjoe.fc.hp.com>
    Re: Creating files on the server <webmaster@fccjmail.fccj.cc.fl.us>
        date function under NT? (Richard Rowell)
    Re: Does putting the word "newbie" as subject help? (Andrew M. Langmead)
        Expect Module for Perl? <philen@ans.net>
    Re: Give c.l.p.m. Your Tough Love - WAS: Re: dbm files (Dave Till)
    Re: Help: Perl CGI & Database <gedavis3@vt.edu>
    Re: How do I create my own perl libraries? [SEEFAQ][SEE (Joe McMahon)
    Re: How to get the encrypted password string ? <webmaster@fccjmail.fccj.cc.fl.us>
        Is it possible to limit memory taken by perl process. s <dowtorte@superman.cig.mot.com>
    Re: Killfile Triage <rone+usenet@ennui.org>
    Re: many ways but i can not find one <uri@sysarch.com>
    Re: Matching with the //o option (Bart Lateur)
    Re: Perl on Win95 not working (newbie question) and fli scott@softbase.com
        perlfaq and Perl FAQ's (Kent E. Holsinger)
    Re: Please Help: File search with wildcarded filenames <webmaster@fccjmail.fccj.cc.fl.us>
        Problems with GDBM_File under IRIX 6.4 and Perl5.004? (Joe McMahon)
    Re: QUIZ: what good is this code? (Alan Schwartz)
    Re: Searching for a string! [SEEFAQ] (Joe McMahon)
    Re: Stripping linefeeds [SEEDOC] (Joe McMahon)
    Re: stumper: fun with perl <uri@sysarch.com>
    Re: Stupid Perl file handler limitation! (Mike Stok)
    Re: Stupid Perl file handler limitation! (Andrew M. Langmead)
    Re: Stupid Perl file handler limitation! (Elf Sternberg)
    Re: time matter... (Kevin B Cohen)
        top like module out there? (John Erjavec V)
    Re: top like module out there? <david@jemez.kellogg.nwu.edu>
    Re: What does this one-liner do? (Abigail)
        Why doesn't this program print out matches? <lamber45@EGR.msu.edu>
    Re: Why PERL? [Re: Beginner in trouble] <webmaster@fccjmail.fccj.cc.fl.us>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 27 Feb 1998 15:51:00 -0700
From: Dave Gates <davegates@davegates.com>
Subject: Re: "PERL" puzzle.  ANSWER!
Message-Id: <34F7432A.7291D0A@davegates.com>

I know!  I don't know the exact translation or why but I know the
answer, and I'll post it at the very end of this message.


Kevin J. Lin wrote:
> 
> (This is a puzzle, not a real PERL question; if you don't like puzzles
> skip to the next post.  Knowlege of PERL and or Unix will be helpful,
> but not required to solve it.)
> 
> I've been porting something to PERL and am almost done.  But I've had
> some problems with it.  Here are my questions:
> 
> 1) What am I trying to port?
> 
> 2) Can you provide a line-by-line transcript of the original source?
> 
> 3) What code could I use to fill in the blanks (marked by "????????") If
> you can think of better code for any other section, I'd like to see it.
> 
> Here's the code:
> 
> ###########################################
> 
> #!/usr/bin/perl
> 
> &lv($i,my($self));
> 
> $want=&lv($u,$me);
> 
> if ($i<0){
>         $want=++$me;
> }
> 
> grep my($self)/$me;
> $want=(grep $u/$me);
> 
> if(unlink $me){
>         $want=alarm $me;
> }
> 
> $want=~ tr/$u/ /c;
> 
> if ($thinking=$u){
>         utime time, time, my($self);
> }
> 
> $want=~ tr/$u/ /c;
> 
> #o!o!o!
> 
> bless($me,$u);
> ??????????????
> ??????????????
> $want=my($u);
> 
> CLOSE(my($i)); CLOSE(my($i));
> see you before me
> if ($u eq 'IGNORE'){
>         die $i;
> }
> 
> ??????????????
> ??????????????
> while ($i>$knees){
>         --$i;
> }
> for (;$u==$u;){
>         do (anything.pl)
> }
> 
> $want=~ tr/$u/ /c;
> 
> if ($thinking=$u){
>         utime time, time, my($self);
> }
> 
> $want=~ tr/$u/ /c;
> 
> #o!o!o! (yeah)
> 
> &lv($i,my($self));
> 
> $want=&lv($u,$me);
> 
> if ($i<0){
>         $want=++$me;
> }
> 
> grep my($self)/$me;
> $want=(grep $u/$me);
> 
> if(unlink $me){
>         $want=alarm $me;
> }
> 
> $want=~ tr/$u/ /c;
> 
> if ($thinking=$u){
>         utime time, time, my($self);
> }
> 
> $want=~ tr/$u/ /c;
> 
> #o!o!o!
> 
> $want=$u;
> $want=~ tr/$u/ /c;
> 
> if ($thinking=$u){
>         utime time, time, my($self);
> }
> 
> #oo ooo ooooo
> 
> for($i=0;i<8;++i){;}
> 
> $want=~ tr/$u/ /c;
> 
> if ($thinking=$u){
>         utime time, time, my($self);
> }
> 
> $want=~ tr/$u/ /c;
> 
> if ($thinking=$u){
>         for ($i=0;i<14;++i){
>                 utime time, time, my($self);
>         }
> }
> 
> ###########################################
 


It's the song "I Touch Myself" by the DiVinyls.


> &lv($i,my($self));
> 
> $want=&lv($u,$me);

I love myself
I want you to love me

etc.

-- 
Dave Gates
davegates@davegates.com


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

Date: Fri, 27 Feb 1998 14:35:26 -0500
From: "Jim L. Morris" <jmorris@silcoinc.com>
Subject: **Perl/CGI programmers Needed - Florida**
Message-Id: <34f71514.0@207.49.135.12>

One of our clients in Boca Raton, Florida has several
permanent openings for Perl/CGI Internet Developers
with one of the fastest growing Web hosting companies
in the world.

Positions are full-time/permanent and include salary,
full benefits, and profit sharing.

Come to Florida and enjoy warm weather
year around, a low cost of living, some of the best
beaches in the U.S., and no State Income Tax!!!!!!!!!!!

Due to the immediate needs of our client we cannot consider
H-1 candidates at this time. Must be located in the U.S. or
Canada to be considered. No 3rd party calls or calls
from subcontracting organizations will be accepted..

For more info. contact: (Prefer E-mail)

Jim Morris
SILCO Software Technology, Inc.
jmorris@silcoinc.com
888-745-2646 ext. 11(toll free)
813-939-0703 (Fax)








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

Date: Fri, 27 Feb 1998 20:10:38 +0100
From: Rob Moolhuijsen <robm@encomix.es>
Subject: __FILE__ and __LINE__ internal Perl variables
Message-Id: <34F70FAE.7D52CA3E@encomix.es>

Please take a look at the next piece of Perl code:
-----------------------------------------------------------
sub trace
{
    my ($filename, $lineno, $message) = @_;

    print "$filename, $lineno: $message\n";
}


# My perl code
trace(__FILE__, __LINE__, "Message one");

# My perl code
trace(__FILE__, __LINE__, "Message two");

# My perl code
trace(__FILE__, __LINE__, "Message three");
-----------------------------------------------------------

As you can see the first two parameters of the subroutine "trace" are
always repeated.
Is there a more elegant way to make a define in Perl just like in C?
For example:

#define   TRACE(message)   trace(__FILE__,  __LINE,  message)


Thanks for any ideas,

Rob




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

Date: 27 Feb 1998 20:45:15 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: __FILE__ and __LINE__ internal Perl variables
Message-Id: <6d78kr$4ln@news-central.tiac.net>

In article <34F70FAE.7D52CA3E@encomix.es>,
Rob Moolhuijsen  <robm@encomix.es> wrote:

># My perl code
>trace(__FILE__, __LINE__, "Message one");
>
># My perl code
>trace(__FILE__, __LINE__, "Message two");
>
># My perl code
>trace(__FILE__, __LINE__, "Message three");
>-----------------------------------------------------------
>
>As you can see the first two parameters of the subroutine "trace" are
>always repeated.
>Is there a more elegant way to make a define in Perl just like in C?

You can use the caller function e.g.

#!/usr/local/bin/perl

sub trace {
  my $message = shift;
  my ($file, $line) = (caller)[1,2];

  print  "$file $line: $message\n";
}


trace 'foo';
trace 'bar';
trace 'baz';

__END__

might do what you want.  caller is documented in the perlfunc man page.

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@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 27 Feb 1998 22:02:37 +0100
From: "Thommy Lundgren" <loo@algonet.se>
Subject: a newbie Q
Message-Id: <6d79be$j8h$1@zingo.tninet.se>

I've made a script which update my page. Anyway, I've ran the script on 2
servers. on the first 1 everything is fine, it takes my form-input and write
it to a file but with my second server it doesn't write my file.. I know
this a newbie question =)
here the script:

#!/usr/local/bin/perl5.003

$database = "database.txt";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;}
open(FILE,"<$database");
@line=<FILE>;
close FILE;
open(FILE,">$database");
print FILE "$FORM{'rubrik'}<br>$FORM{'medelande'}";
foreach(@line){ print FILE $_; }
close FILE;

/Whop




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

Date: Fri, 27 Feb 1998 15:40:59 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Calling Perl Scripts
Message-Id: <joe.mcmahon-2702981540590001@prtims.stx.com>

In article <6cq2ve$ebr$1@nnrp2.dejanews.com>, amerar@unsu.com wrote:

>Hello,
>
>From within an HTML document, how do I can a Perl script when no form or
>button is involved?
>
>For example, say I have a homepage:
>
><BODY>
>  ... HTML CODE HERE ...
>
>  I want to call the perl script here
>
> ... MORE HTML CODE ...
>
></BODY>
>
>How can I call the script unconditionally everytime the page is loaded?

Generate the whole page dynamically from the perl script - the link to
your page should link to a CGI script that prints the top part, does
whatever it does, and then prints the bottom part.

 ---  Joe M.


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

Date: 27 Feb 1998 12:37:23 -0700
From: Joe Orth <joeo@hpfcjoe.fc.hp.com>
Subject: Compiling 5.004_60 with threads
Message-Id: <yb6d8g8hma4.fsf@hpfcjoe.fc.hp.com>


I'm not sure that this is exactly the right place to be posting this
but here goes.

I am attempting to compile perl5.004_60 on HPUX 10.20 loaded with the
posix threads DCE extentions.  I have followed the instruction in
README.threads:

    Add -DUSE_THREADS -D_REENTRANT -DDEBUGGING to ccflags and cppflags
    Add -lpthread to libs
    Change optimize to -g

These are the LinuxThreads instructions, but they looked fairly
generic.  (I also ran Configure like so: sh ./Configure -drs -Dcc=gcc) 


The error message that gcc gives me is:

% make
        `sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
          CCCMD =  gcc -DPERL_CORE -c -DUSE_THREADS -D_REENTRANT -DDEBUGGING -D_HPUX_SOURCE -I/usr/local/include -I/opt/gnu/include -g
miniperlmain.c: In function `main':
miniperlmain.c:38: incompatible type for argument 2 of `pthread_mutex_init'
*** Error exit code 1

Stop.

Which I don't understand since the second argument  for
pthread_mutex_init is NULL (I think, not being much of a hard core C
programmer) and from all of the documents I can find, this is a legal
value. 

If anybody can help me, I would vastly appreciate it.  If I need to
post this in another forum, then please let me know where.

BTW, I am attempting to use gcc version 2.7.2.1


Thanks in advance,

Joe Orth



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

Date: Fri, 27 Feb 1998 12:04:30 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Creating files on the server
Message-Id: <34F6AAA1.88E9E0F@fccjmail.fccj.cc.fl.us>

The only way to be sure is run your CGI suid to root and change the file
owner/group and/or permissions inside the script...

You can just try 'chown' and/or 'chmod' inside and see if the user
nobody has enough previledges to do it on it's own...

HTH,
Bill


Steve Gilliard wrote:

> I have a perl program that creates individual
> files on the server for each user that enters
> data.  I moved this script from one site that had
> no problems with creating the individual files
> with my login name on the server.  Since I
> switched to another UNIX server the files are now
> being created with the owner of "nobody".  Is
> there a simple way for me to change my program so
> that it will create the files with the ownership
> that I have for my directories ?
>
> Any help is greatly appreciated.
>
> Steve
>
> *remove the x after com to send email.





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

Date: Fri, 27 Feb 1998 19:20:32 GMT
From: rrowell@shreve.dot.net (Richard Rowell)
Subject: date function under NT?
Message-Id: <34f810b1.44808320@news.shreve.net>

Anytime I call this function under NT, the command prompt simply asks
me to input the new date.  What I need is for it to return today's
date within the program without prompting me for anything.  Is their
possibly another way to do this?  I'm developing under NT because my
RedHat CD hasn't arrived yet, but the script will eventually run under
Unix(Solaris?) so I hope to find a platform independent solution.

Please forgive the rudimentary question, believe it or not I GREPed
the manpages, read a FAQ or two, and bought Learning Perl, and
Programming Perl, but...

_______________
Richard Rowell
rrowell@shreve.net

Delphi, Perl, C++, Visual Basic, ADA, ASM:  Not any single language is the be-all end-all of programming.  Each language does something well. They are all simply tools.  Successful programmers learn not to use a hammer to tighten screws, or a wrench to pound nails.


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

Date: Fri, 27 Feb 1998 21:10:55 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Does putting the word "newbie" as subject help?
Message-Id: <Ep22u7.1FE@world.std.com>

Geert Roovers <Geert.Roovers@POBoxes.com> writes:

Subject: Re: Does putting the word "newbie" as subject help?

Probably not. Some of the more knoledgable users who hang around here
have stated that they killfile anything with "newbie" in the
subject. The person who I am thinking of is much more comfortable with
the word "novice." (Although I'm not sure I'd say they are much more
comforatable with the actual "novices" than they are at real live
"newbies".)

The common answer that you hear around here is that you are much
better off writing a subject line that is an short, accurate
description of what you want. Some guidelines are available at:

<URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>

>In some HTML-file, the user can click a button, so that it sends an
>e-mail. To this e-mail, there should be a number attached. This number
>is the follow-number, so I already made a little script that fetches the
>last number from a file, increase it, and write it back to the file. 

You should probably perform this action in the script that actually
sends the email. As you read it, increment it, and write it, save a
copy, and use that in your e-mail messages.

Unfortunately, you are getting yourself into some issues like
concurrency and locking that are beyond what you find in beginners
textbooks about programming. You might want to take a look at the
information at the following URLs and if you don't understand them,
find someone who can help you.

<URL:http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq5/
How_can_I_lock_a_file_.html> 
<URL:http://www.stonehenge.com/merlyn/WebTechniques/col04.html>
-- 
Andrew Langmead


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

Date: Fri, 27 Feb 1998 14:04:29 -0500
From: Phillip Lenhardt <philen@ans.net>
Subject: Expect Module for Perl?
Message-Id: <Pine.GSO.3.95.980227140135.17496A-100000@earn.aa.ans.net>

I don't see a perl module for expect on CPAN. I assume it would be in
"/CPAN-local//modules/by-category/09_Language_Interfaces", but I also
looked around elsewhere, to no avail.

If it doesn't exist, is anyone working on it? If no one is working on it,
is there some reason why I shouldn't bother to do it myself?

	-phil

--
In the long run, we are all dead.                      philen@ans.net



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

Date: 27 Feb 1998 15:38:29 -0500
From: davet@angel.uunet.ca (Dave Till)
Subject: Re: Give c.l.p.m. Your Tough Love - WAS: Re: dbm files
Message-Id: <6d7885$7ac@angel.uunet.ca>

In article <34f82d22.9225840@news.mmc.org>,
Jeffrey Drumm <drummj@mail.mmc.org> wrote:
>>But the fact is that just as it annoys tchrist and his imitators to see
>>the same dumb questions posted over and over again, it annoys me (and
>>probably a few others as well) to see six identically worded comebacks
>>making fun of the questioner (none of which gives the answer the
>>questioner is obviously seeking). If the "greater good" we're seeking is
>>to improve the signal-to-noise ratio of the group, I humbly submit that
>>we'd be better off just answering the damn question.
>
>Six replies with fishes is just as much noise as six replies with fishing
>instructions.  At least the latter will do just a little bit to keep those
>same folks from coming back for another unearned meal.

I think it makes sense for Perl experts to tell people to look
things up in the FAQ or in documentation provided with the Perl
distribution -- for precisely the reasons you describe in your post.

But I see no reason to be sarcastic or condescending (I am not accusing
you or anyone in particular of these crimes, BTW).  Two wrongs *don't* make
a right.

Also, in my experience, attempting to try to get an entire newsgroup user
community to follow a prescribed set of rules is like trying to drain the
ocean.  If you want a newsgroup in which the only topics that are
discussed are those that are not covered in the FAQ or in the Perl docs,
the only practical solution is a moderated newsgroup (IMHO).

>But belittling seems to either get their attention or make them go away.

An analogy:  if somebody cuts you off when you're out on the highway,
honking the horn and yelling obscenities at them probably reduces the
probability of the driver's repeating that behaviour.
But does that make honking and yelling the right thing to do?

I don't like the idea of using rudeness as a form of negative
conditioning.  It seems so... uncivilized, somehow.  Again, your mileage
may vary.  (Cultural stereotypes may apply - I am, after all, a
Canadian. :-))


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

Date: Fri, 27 Feb 1998 15:27:18 -0500
From: "Gerald Davis" <gedavis3@vt.edu>
Subject: Re: Help: Perl CGI & Database
Message-Id: <6d77n6$h4c$1@solaris.cc.vt.edu>


>sub SetValue {
>   local($DBName);
>   local($DBField);
>   local($DBValue);
>   local($DBdir);
>   local ($DBpag);
>   $DBName = $_[0];
>   $DBField = $_[1];
>   $DBValue = $_[2];
>   $DBdir = $DBName.".dir";
>   $DBpag = $DBName.".pag";
>   open(DBdir,">>$DBdir");
>   open(DBpag,">>$DBpag");
>   flock $DBdir, $LOCK_EX;
>   flock $DBpag, $LOCK_EX;
>   dbmopen(%DATABASE, $DBName, 0600);
>   $DATABASE{$DBField} = $DBValue;
>   dbmclose(%DATABASE);
>   flock DBdir, $LOCK_UN;
>   flock DBpag, $LOCK_UN;
>   close (DBdir);
>   close (DBpag);
>   return 1;
>}
>
Don't flock $LOCK_UN just close the file it will then release the lock after
the file closes automaticly.  Removes 2 lines of code & is safer.  I know
this works in Perl5 but not sure about Perl4

Jerry





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

Date: Fri, 27 Feb 1998 15:43:23 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: How do I create my own perl libraries? [SEEFAQ][SEEMAN]
Message-Id: <joe.mcmahon-2702981543230001@prtims.stx.com>

In article <34f4f844.524144494f47414741@radiogaga.harz.de>,
MARTIN@RADIOGAGA.HARZ.DE wrote:

>Joe McMahon (joe.mcmahon@gsfc.nasa.gov) wrote:
>[...]
>: one of the default places Perl looks for modules is in the same directory as
>: the one where the program resides.
>
>No. perl looks for modules in the current working directory, not in the
>one where the program resides.
Right. I elided '.' into that and thereby made it incorrect.

 --- Joe M.


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

Date: Fri, 27 Feb 1998 03:24:27 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: How to get the encrypted password string ?
Message-Id: <34F630C0.AC4473@fccjmail.fccj.cc.fl.us>

Look to www.cpan.com Search on Security.
There are modules which will help you with what you
want to try and do :-)

HTH,
Sneex :-)

Baher M. Safwat wrote:

> I use Solaris 2.5.1 on Sun Ultra1 ,
> when using the perl function to get the password of a certain user
> it return the "x" from the /etc/passwd  file instead of the encrypted
> string from the /etc/shadow
>
>         :
>         :
> ($encstring) = (getpwnam("username"))[1];
> $salt = substr($encstring,0,2);
> $encpass = substr($encstring,2);
>         :
>
> what is the correct usage ?!
> or which function to use instead?
>
> thanks





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

Date: Fri, 27 Feb 1998 15:16:14 -0600
From: Edward Dowtort <dowtorte@superman.cig.mot.com>
Subject: Is it possible to limit memory taken by perl process. since I need to start about 200 at once.
Message-Id: <34F72D1E.98263F39@superman.cig.mot.com>

This is a multi-part message in MIME format.
--------------27DCA5DD07BB0403FEFE5CB2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I'm posting this for a friend, so blame him for the mile long subject
line and post replies rather than e-mail:

Hi all,

I was wondering if there is a a way to limit memory taken up by a perl
proccess on startup since I need to start about 200 of them at once.

If that's not possible is there another way to be able to execute
multiple scripts from a single perl process? Something like a Perl
Server, (ala Emacs Server)

My perl is dynamically linked, but everytime I start a perl process
which just sleeps, the memory reported by vmstat (Solaris 2.5.1),
shows ~200k decrease in physical memory and ~844k in swap.

Of course, if nothing like this exists, time to redesign this.

Thanks

Mark Komosa

--------------27DCA5DD07BB0403FEFE5CB2
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Edward Dowtort
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Edward Dowtort
n:              Dowtort;Edward
org:            Motorola
adr:            1475 W. Shure Drive;;IL75-D220;Arlington Heights;IL;60004;USA
email;internet: dowtorte@superman.cig.mot.com
title:          System Administrator
tel;work:       847-632-6661
note:           Ram Pager (alpha) - 17878
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------27DCA5DD07BB0403FEFE5CB2--



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

Date: 27 Feb 1998 11:31:12 -0800
From: st. paul's wort <rone+usenet@ennui.org>
Subject: Re: Killfile Triage
Message-Id: <rone.FriFeb27113022PST1998.28265@ennui.org>

In article <34f577a9.4190412@news.omen.net.au>,
peter caffin <nospam_synic@omen.net.au> wrote:
>When reasoned discussion fails, be an arsehole, eh?

Well, i tried mailing you, but it bounced.

rone
and respect my followup-to header next time, punk
-- 
The finest day that i ever had
Was when i learned to cry on demand


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

Date: 27 Feb 1998 13:48:45 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: many ways but i can not find one
Message-Id: <x7btvs28aa.fsf@sysarch.com>

Myles Barrett Williams <a@b.c.d> writes:

> ~arthur <star@sonic.net> writes:
> 
> try: print (" " x $i).$x."\n";
>  
> > i do not know printf (and can not find the man page)
> 
> There is an entry for printf in the "perlfunc" section of the manual.
> It refers you to the entry for sprintf.

also try

printf "%${i}\n", $x

which will account for the length of $x in the indent.

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: Fri, 27 Feb 1998 20:42:36 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Matching with the //o option
Message-Id: <34fb24f7.7023094@news.tornado.be>

Uri Guttman <uri@sysarch.com> wrote:

>sub make_regex_sub {
>	my( $regex ) = @_ ;
>	return eval "sub { \$_[0] =~ /$regex/ }" ;
>}

>this has many problems (like / in the regex) but illustrates the idea.

Yes, I've seen this in the source of several modules.

My main objection is that it's just a horrible, ugly, and terribly
complicated hack. For instance: you're postponing syntax checking to
runtime. 

I would like a clean (and simple!) support in the core language. The
Python approach, as described in Earl Hood's reply, looks a nice
alternative.

	Bart.


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

Date: 27 Feb 1998 19:52:53 GMT
From: scott@softbase.com
Subject: Re: Perl on Win95 not working (newbie question) and flip /'s problem
Message-Id: <6d75il$2mh$1@mainsrv.main.nc.us>

Barry Phillips (sb67@dial.pipex.com) wrote:

> However whenever I run any 'module' rouintes I get:-
> undefined subroutine &main::fileparse

I'm not surprised that you are having troubles with modules.  Many
modules you encounter and might want to use are not installed in the
Win32 Perl distribution.  Does this come with it? Most of the modules I
see mentioned are optional things you can download and install from
CPAN. I don't know if fileparse is one or not. I don't use modules,
because they suffer from exponential moduleitis.  Module writers use
other modules which use other modules which use other modules, until
you need all of CPAN installed on your hard disk to do anything.  One
module I downloaded wanted me to download and install other modules
just to install it! Most of the time, it is faster to write what you
need yourself, or cut and paste canned code. Many modules also are
UNIX-specific and don't run as-is on Win32.

> use win32;

Isn't this Win32? Perl is case sensitive.

> I have to read a file and get a dos pathname, how can I flip the \'s.
> or make the \'s double ones ?

tr will hook you up.

Scott


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

Date: 27 Feb 1998 15:42:19 -0500
From: kent@darwin.eeb.uconn.edu (Kent E. Holsinger)
Subject: perlfaq and Perl FAQ's
Message-Id: <x7u39khj9w.fsf@darwin.eeb.uconn.edu>

In the spirit of giving something back to a group that's been a big
help to me and of making it easier for everyone to search rapidly
through the FAQ's I offer perlfaq, which is derived from a script
originally posted a couple of months ago by Andrew Johnson.

Enjoy!

Kent

P.S. If anyone finds horrible (or even less than optimal) coding
practices in the script below, please don't hesitate to point them out
to me. I'm only moderately experienced, if that, with Perl and would
be delighted to learn from any mistakes I've made.

#!/usr/bin/perl -w
#
# perlfaq - Search the Perl FAQ for headers matching a Perl regular expression
# Usage:    See the POD documentation below
#
# Comments or suggestions are welcome, although I can't promise that they
# will be acted on quickly.
#
# Author:  Kent E. Holsinger
# Address: Deparment of Ecology & Evolutionary Biology
#          University of Connecticut, U-43
#          Storrs, CT 06269-3043
#          U.S.A.
# E-mail:  Kent@Darwin.EEB.UConn.Edu
#
# Copyright (c) 1998 Kent E. Holsinger
# All rights reserved. You can, however, redistribute it and/or modify it 
# under the same terms as Perl itself.
#
# Derived from a version posted to comp.lang.perl.misc by 
#    Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
#
# Some code also derived from checklinks by Jim Weirich
#    see Usage() and ManPage() for copyright details
#
#
# $Log: perlfaq,v $
# Revision 1.4  1998/02/27  20:27:21  kent
# Added POD documentation, contact information. Cleaned up formatting for
# posting to comp.lang.perl.misc.
#
# Revision 1.3  1998/02/25  18:40:35  kent
# Added option to use pager defined in Config.
#
# Revision 1.2  1998/01/21  22:04:29  kent
# Changed to use Getopts::Std, Config. Minor reformatting.
#
# Revision 1.1  1998/01/21  21:31:59  kent
# Initial revision
#
#

use strict;
use Config;
use vars qw($opt_f $opt_h $opt_H $opt_l);
use Getopt::Std;

getopts('fhHl') or die Usage();

ManPage() if $opt_H;
Usage() if $opt_h;

defined($Config{privlib}) or 
    die "Could not determine perlpath from configuration information\n
         Notify your system administrator\n"; 
my $faqdir = $Config{privlib} . '/pod';

my $pager  = $Config{pager} if $opt_l && defined($Config{pager});
my $pattern=$ARGV[0];

opendir(FAQDIR,$faqdir) || die "can't open $faqdir: $!";
my @faqs=grep /faq/,readdir FAQDIR;
close FAQDIR;

my $fh = \*STDOUT;
if ( defined($pager) ) {
    open (OUTPUT, "| $pager") or die "Could not open $pager: $!";
    $fh = \*OUTPUT;
}


if ($opt_f) {
   get_faq();
} else { 
   grep_faq_heads();
}

close ($fh);

# Usage
#
# cribbed from checklinks
# Copyright (c) 1996 Jim Weirich
# All rights reserved. Permission is granted for free use or
# modification
#--------------------------------------------------------------------
# Display the usage message by scanning the POD documentation for the
# usage statement
sub Usage {
	while (<DATA>) {
		if ( /^B<[-A-Za-z0-9_.]+>/ ) {
			s/[BI]<([^>]*)>/$1/g;
			print "Usage: $_";
			last;
		}
	}
	exit 0;
}

# ManPage
#
# cribbed from checklinks
# Copyright (c) 1996 Jim Weirich
# All rights reserved. Permission is granted for free use or
# modification
#--------------------------------------------------------------------
# Display the man page by invoking the pod2man (or pod2text) script
# on self.
sub ManPage {
        my $pager = $Config{pager} if defined($Config{pager});
	if ( $ENV{'TERM'} =~ /^(dumb|emacs)$/ ) {
		system ("pod2text $0");
	} else {
		system ("pod2man $0 | nroff -man | $pager");
	}
	exit 0;
}


# grep_faq_heads
#--------------------------------------------------------------------
# Display FAQ filename and headers matching grep pattern.
sub grep_faq_heads {
    foreach my $faq (@faqs) {
        open(FAQ,"$faqdir/$faq") or die "can't open $faq: $!";
        while (<FAQ>) {
            print $fh "$faq:$_" if /^=head.*?$pattern/;

        }
        close FAQ;
    }
}

# get_faq
#--------------------------------------------------------------------
# Display entire FAQ entries for headers matching grep pattern.
sub get_faq {
    my($n);
    foreach my $faq (@faqs) {
        open(FAQ,"$faqdir/$faq") or die "can't open $faq: $!";
        while (<FAQ>) {
            $n=1 if /^=head.*?$pattern/;
            $n=0 if /^=head(?!.*?$pattern)/;
            print $fh $_ if $n;
        }
        close FAQ;
    }
}    
__END__

=head1 NAME

perlfaq - Search the Perl FAQ for headers matching a Perl regular expression

=head1 SYNOPSIS

B<perlfaq> [B<fhHl>] [I<Perl regular expression>]

=head1 DESCRIPTION

I<perlfaq> will search the Perl FAQ and return the filename and
headers (optionally the FAQ text) matching a Perl regular expression.

=head1 OPTIONS

=over 6

=item B<-h> (help)

Display a usage message.

=item B<-H> (HELP ... man page)

Display the man page.

=item B<-f> (full)

Display the comments following the FAQ header in addition to the FAQ
header itself.

=item B<-l> (less)

Display using the system pager, assuming it's defined in Config.

=head1 AUTHOR

Kent E. Holsinger <C<Kent@Darwin.EEB.UConn.Edu>>

Derived from a version posted to comp.lang.perl.misc by 
Andrew Johnson <C<ajohnson@gpu.srv.ualberta.ca>>.

Some code also derived from checklinks by Jim Weirich
see Usage() and ManPage() in source for copyright details.

=head1 LIMITATIONS

Text is printed in POD format rather than being piped through pod2text
or pod2man or reformatted using Pod::Text. Depends on installation of
FAQ in $Config{privlib} . "/pod";

=cut

__END__


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

Date: Fri, 27 Feb 1998 12:07:29 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Please Help: File search with wildcarded filenames
Message-Id: <34F6AB55.A5A75BA4@fccjmail.fccj.cc.fl.us>

You really might wish to research user Shell at http://www.perl.com :-)
It will point you in the right direction...

HTH,
Bill

Jay Yang wrote:

> I am a newbie Perl user. The problem is about file search with
> wildcarded filenames.  For example,
> to search 'abc.*' in /home/1234/,
>
> I tried
>
> $name = 'abc.*';
> @files = $name;
>
> and it didn't work.



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

Date: Fri, 27 Feb 1998 15:30:28 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Problems with GDBM_File under IRIX 6.4 and Perl5.004?
Message-Id: <joe.mcmahon-2702981530280001@prtims.stx.com>

We've got a big Perl application which runs fine under IRIX 6.2/Perl5.002,
but does NOT run properly under IRIX6.4 with either Perl5.004 or 5.004_57.

Principle problem we're seeing is GDBM_File refusing to open an existing
GDBM file, reporting that the file does not exist. Worse, it doesn't
always do it; when it's creating a file, it works fine. (No hints in any
of the FAQs.)

We tried perl5.002, but that was worse; the GDBM_File module kept telling
us that we were giving it bad parameters, even though the call was exactly
the same as it was on the IRIX6.2 system.

I'd appreciate any insights from IRIX6.4'ers who are getting along fine. 

 --- Joe M.


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

Date: 27 Feb 1998 20:54:25 GMT
From: alansz@araw.mede.uic.edu (Alan Schwartz)
Subject: Re: QUIZ: what good is this code?
Message-Id: <6d7961$5b7q$1@piglet.cc.uic.edu>

Uri Guttman  <uri@sysarch.com> writes:
>
>in the spirit of the stumper, i have an educational quiz. the code below
>has a useful purpose. it is a modification of one of my favorite perl
>idioms.  see if you can explain exactly what it does and what use it can
>be. the initial array values are just example data, the real data would
>be up to the application.
>
>@array = qw( a b c d ) ;
>
>@array{ @array } = ( [ @array ] ) x @array ;
>

Spoiler warning


1) What it does (I think):

   Creates a hash %array with keys in the list @array. Each key's
   value is the same anonymous reference to the elements of @array.

   @array{ @array } is a hash slice (i.e., equivalent to
	($array{a},$array{b},$array{c},$array{d}) in the example)
  
   ( [ @array ] ) is a list with one element -- an anonymous reference
   to the elements of @array. The "x @array" copies it 4 times
   (because @array in a scalar context is "4", its length).

2) What's the use?

   I'm stumped. :) But here are some thoughts:

   Simply doing @array{ @array } = 1; would be sufficient
   to make determining wither X is in @array as easy as:
	print "yes" if $array{X};
   This is a neat idiom for this that I hadn't thought of, but
   I'll assume that there's something even more useful about the
   right-hand side of the assignment.

   So why is it valuable to have all the hash values be
   the same anonymous ref to a list of the hash keys?
   Note that the list may include duplicates, and is thus
   different than keys %array. Note that it's not \@array,
   but an anonymous ref to the elements. These are both
   probably relevant to the usefulness, but my brain isn't
   yet sufficiently flexible to figure out how.

Looking forward to enlightenment. :)


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
         Alan Schwartz                  | Disclaimer: I represent no one
        <alansz@uic.edu>                |
Asst. Prof. of Clinical Decision Making | Life is what happens to you while
University of Illinois at Chicago       | you're busy making other plans
Department of Medical Education         |          - J. Lennon
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   
   



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

Date: Fri, 27 Feb 1998 15:50:10 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Searching for a string! [SEEFAQ]
Message-Id: <joe.mcmahon-2702981550100001@prtims.stx.com>

In article <34F6FF82.B51CB9E5@bigsky.net>, "Keith L. Miller"
<miller@bigsky.net> wrote:

>I'm trying to search an arary for a specific string but not having much
>luck.  For instance, when I search for camel I get camels and when I
>search for big I get bigsky, bigdaddy, etc.
>
>Does anyone know how to get this particular job done?
>
>Thanks!

/^string$/  # ^ start of string, string literal, $ end of string.

You need to read the stuff on regular expressions in much more detail. Try
perldoc perlre, very close to the top.

 --- Joe M.


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

Date: Fri, 27 Feb 1998 16:11:50 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Stripping linefeeds [SEEDOC]
Message-Id: <joe.mcmahon-2702981611510001@prtims.stx.com>

In article <00YI.8848$pf.884826@news.internetMCI.com>, "Norman Bunn"
<norman.bunn@mci.com> wrote:

>My problem is that each entry has a linefeed at the end, so instead of:
>
>John.Doe@mci.com
>
>I'm getting:
>
>John
>.Doe@mci.com
>
>Any help on removing the LF?

chomp() will remove it if it is there, and leave the string alone if it is
not. That linefeed is actually what Perl calls a "newline". Check back
over perldoc perlop and you'll see much more of interest to you re
newlines.


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

Date: 27 Feb 1998 13:25:50 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: stumper: fun with perl
Message-Id: <x7g1l429ch.fsf@sysarch.com>

Dan Boorstein <danboo@negia.net> writes:


>    summary: write a script which prints "foo\n" when run interactively
>             but "bar\n" when run from a file.
> 
> qualifiers: 1. the same perl interpreter must be used for both trials.
>             2. no command-line switches, parameters or arguments may be
>                used aside from the script name.
>             3. the script cannot refer to its own filename through $0,
>                __FILE__ or other methods (that would be too easy).
>             4. the script may not reference external sources including,
>                but not limited to, modules, libraries, databases or
>                shell commands.
>             5. the script must assume that its environment is identical
>                between trials, aside from the manner in which it is
>                invoked of course.
>             6. and most importantly, have fun. :)
> 

you should add no -t since this works fine:


print ( -t STDIN ? "foo\n" : "bar\n" ) ;

> cat foo4.pl
#!/usr/local/bin/perl
print ( -t STDIN ? "foo\n" : "bar\n" ) ;
You have mail in /var/mail/uri
> perl < foo4.pl 
bar
> perl foo4.pl 
foo
> 

do i get a prize?

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: 27 Feb 1998 19:48:24 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Stupid Perl file handler limitation!
Message-Id: <6d75a8$253@news-central.tiac.net>

In article <6d70od$tps$1@nnrp1.dejanews.com>,  <li_sen@yahoo.com> wrote:
>What's up with Perl?  I ran some tests and found that Perl hits a limit of
>about 62 files before it chokes!  That is, I open files until I can't anymore
>(The code is below)and the script stops at 61 files.  Shouldn't this be a
>system limitation and not a Perl limitation?  I'm running Solaris 2.6 with
>128MB of RAM.
>
>The relevance of this limit is that I can' open more than 60 or so DBM files
>at any one time.  I need more than that for the application I'm writing!
>
>Many thanks for anyone who can give me an answer/workaround for this problem!

Perl may be running into a per process limit on the number of open file
handles e.g.

solaris% limit
cputime         unlimited
filesize        unlimited
datasize        2097148 kbytes
stacksize       8192 kbytes
coredumpsize    unlimited
descriptors     64
memorysize      unlimited

so by the time you've used up 3 for stdin, stdout and stderr you have 60
left if you havce the same per process limits as me.

man limit

may give you some useful pointers to help remedy the situation, perl can
only make use of the resources the OS lets it have.

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@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 27 Feb 1998 20:52:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Stupid Perl file handler limitation!
Message-Id: <Ep21yy.ALr@world.std.com>

li_sen@yahoo.com writes:

>What's up with Perl?  I ran some tests and found that Perl hits a limit of
>about 62 files before it chokes! 

As it was already mentioned, it is probably a system limit rather than
a built in perl limitation. For standard file to be accessed via the
open() function maybe the FileCache module may be of use to you.

Unfortunately, FileCache isn't designed to work with tied DBM
files. Maybe you can do something similar, though. Make a subclass of
of the module tieing the DBM file to a hash, and inside it open and
close the files as needed.

-- 
Andrew Langmead


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

Date: 27 Feb 1998 21:01:09 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: Re: Stupid Perl file handler limitation!
Message-Id: <6d79il$qe$1@brokaw.wa.com>

In article <6d70od$tps$1@nnrp1.dejanews.com> li_sen@yahoo.com writes:

>What's up with Perl?  I ran some tests and found that Perl hits a limit of
>about 62 files before it chokes!  That is, I open files until I can't anymore
>(The code is below)and the script stops at 61 files.  Shouldn't this be a
>system limitation and not a Perl limitation?  I'm running Solaris 2.6 with
>128MB of RAM.

	Yah, so?  How many descriptors does your Unix support?  On 
Solaris, at least, try typing 'limit'.  I get:

cputime         unlimited
filesize        unlimited
datasize        2097148 kbytes
stacksize       8192 kbytes
coredumpsize    unlimited
vmemoryuse      unlimited
descriptors     64 

	Look like after STDIN, STDOUT, and STDERR, you should have 61 
descriptors free and... it looks like you're hitting the 61-descriptor
limit.  There are ways to increase it.  It is a system limitation that
has nothing to do with Perl or how much memory you have.

The solaris FAQ says:

3.43) How can I increase the number of file descriptors per process?

    In 2.3 in earlier this requires poking the kernel.
    In Solaris 2.4+, this can be accomplished by adding the
    following lines to /etc/system:

        * set hard limit on file descriptors
        set rlim_fd_max = 4096
        * set soft limit on file descriptors
        set rlim_fd_cur = 1024

    Raising the soft limit past 256 may confuse certain applications,
    especially BCP applications.  Raising the limit past 1024 may
    confuse applications that use select().

    Programs using stdio or even library calls that use stdio may break
    when they have more than 256 files open as that is the stdio limit.
    Programs using many filedescriptors should try and reserve a number
    of low numbered file descriptors for use by stdio.

	There are also ways of dealing with the limit by creating a
least-recently-used array of your available descriptors, managing,
opening and closing your DBMs as necessary.  But that would require
a little more work.

		Elf

--
It is forbidden to laugh again               Elf M. Sternberg
We maim our joys or hide them                www.halcyon.com/elf
Horses are made of chromium steel
And little fat men shall ride them.  - T.S. Eliot


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

Date: 27 Feb 1998 14:39:43 -0500
From: kcohen@julius.ling.ohio-state.edu (Kevin B Cohen)
Subject: Re: time matter...
Message-Id: <6d74pv$h71@julius.ling.ohio-state.edu>

if you've got to do something for a "computers and art" course, how
about some perl poetry?  see wall, christiansen, and schwartz (1996),
"programming perl," p. 552.

kevin


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

Date: 27 Feb 1998 18:54:27 GMT
From: jev@pconline.com (John Erjavec V)
Subject: top like module out there?
Message-Id: <6d7253$ikh$1@bell.pconline.com>

I am trying to get some output from the top command from remote sites.  I
have tried just grabbing the output from the top command into a vairable,
and then grabbing the information that I needed.  The problem is that top
is curses based, and I am having trouble stripping out the formatting.  The
question I have is, is there any module or script out there that implements
the top command with output in a text format, or even top-like information?
I am trying to grab the load average (which I can parse from uptime), and
also the %CPU used, and the top hogs of CPU on the system.  I am trying to
do this entirely in perl (for parsing and speed reasons, among others), but
any ideas would be appreciated.  (This will be used to get some baseline
readings for remote sites, so that when we are having problems, we can tell
how it usually looks.)  Thanks.

-JEV
-- 
John Erjavec V	PGP fingerprint:
jev@pconline.com	7593 1B5A AE11 C0FE BA09  EB5E 8DE9 D2E5 BF5B 87AD


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

Date: Fri, 27 Feb 1998 14:58:11 -0600
From: david <david@jemez.kellogg.nwu.edu>
To: John Erjavec V <jev@pconline.com>
Subject: Re: top like module out there?
Message-Id: <Pine.HPP.3.95.980227144833.2031A-100000@jemez.kellogg.nwu.edu>

[ posted and mailed ]

On 27 Feb 1998, John Erjavec V wrote:

> I am trying to get some output from the top command from remote sites.  I
> have tried just grabbing the output from the top command into a vairable,
> and then grabbing the information that I needed.  The problem is that top
> is curses based, and I am having trouble stripping out the formatting.  The
> question I have is, is there any module or script out there that implements
> the top command with output in a text format, or even top-like information?
> I am trying to grab the load average (which I can parse from uptime), and
> also the %CPU used, and the top hogs of CPU on the system.  I am trying to
> do this entirely in perl (for parsing and speed reasons, among others), but
> any ideas would be appreciated.  (This will be used to get some baseline
> readings for remote sites, so that when we are having problems, we can tell
> how it usually looks.)  Thanks.

I don't know if a module with this capability exists, but the most recent
copy of The Perl Journal (http://www.tpj.com) had a SWIG tutorial in which
they created a Top interface to Perl.  You may want to look into that.

David



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

Date: 27 Feb 1998 20:57:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: What does this one-liner do?
Message-Id: <6d79b3$66k$1@client3.news.psi.net>

Mark Conty (mconty@year.grain.cargill.com) wrote on 1641 September 1993
in <URL: news:34F6E066.5BD0@year.grain.cargill.com>:
++ Yeah, but if it's supposed to reflect the expression to the right of
++ the assignment, and that expression renders a scalar value, then the
++ assignment should be of that [scalar] value, not of some subordinate
++ expression that just happens to be a list.  In the case of the example
++ from the man page, $x should be neither 2 nor 3, but 1 !

Nope. ($a) = (7, 8, 9) is *not* a scalar assignment. It's a list
assignment. It just happens to have a side effect, setting $a to 7.
The result of the assignment is the list (7, 8, 9).

Now, the assignment to $x forces scalar context, setting $x to 3.

Just for fun, compare:

     $x =        (7, 8, 9);                  # 9
     $x =  ()  = (7, 8, 9);                  # 3
     $x = ($a) = (7, 8, 9);                  # 3
          ($a) = (7, 8, 9); $x = ($a);       # 7
     $x =  $a  = (7, 8, 9);                  # 9
     $x = @{[($a) = (7, 8, 9)]}              # 1


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Fri, 27 Feb 1998 15:10:38 -0500
From: David Lee Lambert <lamber45@EGR.msu.edu>
Subject: Why doesn't this program print out matches?
Message-Id: <Pine.GSO.3.96.980227150505.21638A-100000@area51>

I'm trying to write a perl program (to be run from with procmail,  perhaps
with perl -e) which scans an E-mail message and tries to find out everyone
who is responsible for it.  Here's what I've tried:

#!/opt/bin/perl
while (<>) { 
	if (      

/^(From|(Errors|Reply)-To|(X-)?Sender):.*(([a-zA-Z0-9_.+-]{2,40})@([a-zA-Z0-9-]{1,26}\.)+(a-z){2,3})/o
 ) { print "$4, " ; } ; } ;


My problem is that it doesn't actually print anything.  Any help?


-- 
David Lee Lambert   MHm 16x20   Hack Programmer and Student
Admin of lmert.dyn.ml.org           http://lmert.dyn.ml.org
My web pages are at http://web.egr.msu.edu/~lamber45
E-mail: m/lamber45\100(egr|pilot)\.msu\.edu/



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

Date: Fri, 27 Feb 1998 03:22:07 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Why PERL? [Re: Beginner in trouble]
Message-Id: <34F63033.557F3098@fccjmail.fccj.cc.fl.us>

I told my wife SEX was the Software Exchange :-)
We have had many happy computing years together :-)

Bill

Martien Verbruggen wrote:

> In article <3506ba5c.121585458@news.cent.com>,
>         me@here.com (steve) writes:
> > that ain't nothing,  my wife asked me what SEX was.
>
> Well, as long as you were able to explain it..
> --
> Martien Verbruggen                  |
> Webmaster www.tradingpost.com.au    | The gene pool could use a little
> Commercial Dynamics Pty. Ltd.       | chlorine.
> NSW, Australia                      |





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

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

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