[12962] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 372 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 4 20:07:18 1999

Date: Wed, 4 Aug 1999 17:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 4 Aug 1999     Volume: 9 Number: 372

Today's topics:
    Re: => only in hash initialization? (WAS: mySQL & Perl  (Larry Rosler)
    Re: [offtopic]RE:Quot St and the Jeop Gm (Ben Coleman)
    Re: [offtopic]RE:Quot St and the Jeop Gm <llornkcor@llornkcor.com>
        Cant seem to turn off cashing??? <codeman@gol.com>
    Re: CGI.pm Example (Abigail)
    Re: CHMOD files under NT?? psdsp@my-deja.com
        Denver Perl Mongers August Meeting (Chris Fedde)
    Re: Get Executables path <mattk@cybersurf.net>
        hash ???- sort/changing keys. bhaskaracharya@my-deja.com
        Help getting Perl to work on Windows 98 <the.werners@mcleodusa.net>
    Re: How make .pl files executable? Is there a compiler? <henryf@sminter.com.ar>
    Re: how to substitute strings in a newly created file (Larry Rosler)
    Re: Jeoparder's Jest <uri@sysarch.com>
    Re: Jeoparder's Jest feinster@my-deja.com
        Newbie has <FILE> Problem - please help <rlarson@monmouth.com>
    Re: Newbie has <FILE> Problem - please help (Larry Rosler)
    Re: Newbie has <FILE> Problem - please help (elephant)
    Re: Perl counter muckup (Abigail)
    Re: Perl Penetration Data (Abigail)
    Re: Perl Penetration Data <tchrist@mox.perl.com>
        Processor Usage <dgerstma@pinnaclestudios.com>
    Re: reading in multiple unknown files and writing to it (Larry Rosler)
        regexp can be your friend <belg4mit@mit.edu>
    Re: regexp can be your friend <uri@sysarch.com>
    Re: regexp can be your friend (Larry Rosler)
        Regular expression for matching an e-mail address. (Daniel Doreika)
    Re: Regular expression for matching an e-mail address. (Larry Rosler)
    Re: Regular expression for matching an e-mail address. <makkulka@cisco.REMOVETHIS.com>
    Re: Regular expression for matching an e-mail address. <tchrist@mox.perl.com>
    Re: Repetition in RE substitutions (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 4 Aug 1999 15:03:09 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: => only in hash initialization? (WAS: mySQL & Perl -> Something simple)
Message-Id: <MPG.12125874eedc520a989dce@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <19990804204428.54651.qmail@hotmail.com> on Wed, 04 Aug 1999 
16:44:28 EDT, Perl King <perlking@hotmail.com> says...
> Alex Farber <alex@kawo2.rwth-aachen.de>
> >Perl King wrote:
> > > ObPerl: Use the => operator only in hash initialization.
> >
> >why?
> 
> => ist entsprechen-zum Bediener. Es soll nicht als "phantastisches
> Komma" verwendet werden und kann Fehler verursachen, wenn Sie auf diese 
> Weise verwendet werden:
> 
> open PW => '/etc/passwd'; # Vorausgehenproblem!
> 
> An gängige Praxis und verwenden an passen sich => Bediener nur in
> der Durcheinander-initialisierung.
> 
> Perl König

That's just one opinion.  Saying it in German only makes it less 
accessible.

And now that you have started a new thread by loosing the References 
header, let's rename it (without the typo this time :-) as Matthew 
Bafford has done.

There are 33 messages in the thread in comp.lang.perl.moderated.  Please 
let's not repeat them all here.

http://x34.deja.com/[ST_rn=ps]/getdoc.xp?AN=499000536&search=thread

This seems like a classic case of TMTOWTDI, in this case involving 
nothing but taste and judgment, on which we can all differ.

De gustibus non disputandum est.

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


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

Date: Wed, 04 Aug 1999 23:04:59 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: [offtopic]RE:Quot St and the Jeop Gm
Message-Id: <37a8c6e5.94535665@news.mindspring.com>

On Wed, 4 Aug 1999 14:18:42 -0700, lr@hpl.hp.com (Larry Rosler) wrote:

>In article <37a8a3e6@cs.colorado.edu> on 4 Aug 1999 14:34:46 -0700, Tom 
>Christiansen <tchrist@mox.perl.com> says...
>> 1) There are no HTML docs on perl.com that you can access.
>> 2) HTML is the opiate of the masses.  Learn to use real tools.
>> 3) Your message was illegal: it was missing a mandatory header.
>
>Huh???
>
><URL:http://www.perl.com/cgi-bin/pace/pub/doc/manual/html/pod/perl.html>

Larry, please adjust your sarcasm detector.  It appears to be
malfunctioning.

Ben
-- 
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA


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

Date: 04 Aug 1999 17:39:54 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: [offtopic]RE:Quot St and the Jeop Gm
Message-Id: <aes715f9.fsf@wind.localdomain>


>> 1) There are no HTML docs on perl.com that you can access.
>> 2) HTML is the opiate of the masses.  Learn to use real tools.
>> 3) Your message was illegal: it was missing a mandatory header.

1) True, I acquiesce,. stick foot promptly in mouth....I meant
   www.perl.com. Nothing against your site. I didn't realize that there is
   a difference.
2) personal choice, one man's trash is another man's treasure.
3) hmmm... so much for cut and paste in emacs.

><URL:http://www.perl.com/cgi-bin/pace/pub/doc/manual/html/pod/perl.html>

>Maybe we are existing in parallel universes.

or perhaps I need more sleep, trying to find hidden answers in the
FAQ's, an' all.



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

Date: Thu, 5 Aug 1999 07:34:19 +0900
From: "Scott" <codeman@gol.com>
Subject: Cant seem to turn off cashing???
Message-Id: <7oaf5g$h5o$1@nn-tk001.ocn.ad.jp>

Dear Sir/Madame,

I am working on a project in Japan at the moment and
live in Tokyo. I am having trouble with the code as it
keeps going to the cache and I want it to refresh on the
first time around.

I was wondering if you had any ideas about how I could
achieve the effect of it not going to cache. I have tried
quite a few things.

Scott

#!/perl/bin/perl.exe -w

#print "<Meta HTTp-equiv=\"Pragma\" Content=\"No-cache\";
print "Content-type: text/html\n";
#Cache-Control: must-revalidate
#Cache-Control: max-age=3600
print "Cache-Control: no-cache\n\n";


#print "Pragma: no-cache\n\n";
#print "Pragma: no-cache \n\n";
#Content-type: text/html Pragma: no-cache
#use CGI qw(:standard);
#print header(-expires=>'-1d');
#print header(-Refresh=>'1';);
#use CGI;$query = new CGI;
#print $query->header(-expires>'now');
#print "<Meta Http-equiv=\"Pragma\" Content=\"No-cache\">"
#print "Pragma: no-cache\n\n";
#&NoCache;   # defaults to text/html
local(*FORM_DATA)=@_;
local($request_method,$query_string,@key_value_pairs,$key_value,$key,$value)
;
$netmarketprice="OFF";
$highwatermark="OFF";
etc;








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

Date: 4 Aug 1999 17:08:06 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CGI.pm Example
Message-Id: <slrn7qhed2.tec.abigail@alexandra.delanet.com>

Geoff Halliwell (geoffrey.halliwell@Sun.COM) wrote on MMCLXIV September
MCMXCIII in <URL:news:37A87DBD.8446A25C@Sun.COM>:

Stealth emails are a sign of bad taste, or plain dumbness.

\\ Abigail wrote:
\\ > 
\\ > So, what's $! set to?
\\ > 
\\ 
\\ $! returns "Bad File Number" when you submit and entry,
\\ and returns nothing when you try to view the guestbook.


Did you check the return value of open? Did you open the file in the
correct mode? Did you check your system manuals when EBADF occurs?



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 04 Aug 1999 21:57:30 GMT
From: psdsp@my-deja.com
Subject: Re: CHMOD files under NT??
Message-Id: <7oad04$34g$1@nnrp1.deja.com>

In article <7o9mpj$l29$1@pegasus.csx.cam.ac.uk>,
  "rezn8" <saxbourne@yahoo.com> wrote:
> How do you set CHMOD settings under NT, I am running Apache for NT.
>
>
chmod() will execute as expected in Perl for Win32. However, it may not
have the results you want.

UNIX-style security for files is not applicable to files on Win32
systems. Win32 systems inherit from DOS four possible file
attributes: archived (A), read-only (R), hidden (H), and system (S).
These can be checked and set with the
Win32::File::Get/SetAttributes().

Windows NT systems using NTFS can also have more specific permissions
granted on individual files to users and groups. For
builds 300 and above, and the Perl Resource Kit for Win32, you can use
the Win32::FileSecurity module to maintain file
permissions.

Please check www.activestate.com/support/faqs/ for further
information on Windoze perl.


Hope that helps.
Deva



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


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

Date: Wed, 04 Aug 1999 22:37:59 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Denver Perl Mongers August Meeting
Message-Id: <bh3q3.4964$Pt1.1849@wormhole.dimensional.com>
Keywords: Denver Perl Mongers 

  Denver Perl Mongers Next Meeting:
  Another Location Change:

    This time we are meeting in south Denver (Parker?):

           Advanced Computer Systems for Printers
           6890 S. Tucson Way, Suite #205.
           Contact: Bruce Langlois
                    303-792-9779

           Monday, August 16, 6:30pm

   Directions
     * I-25 (North from C-470 or South from anywhere else) to
     * Arapahoe road.
     * East on Arapahoe to Revere Parkway.
     * South on Revere Parkway to Briarwood Ave.
     * East (and south, it curves around and turns into Tucson Way) on
     * Briarwood 1 building past the TCI building.

chris

-- 
    Chris Fedde
    303 773 9134


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

Date: Wed, 04 Aug 1999 17:06:04 -0700
From: Matt Kennedy <mattk@cybersurf.net>
Subject: Re: Get Executables path
Message-Id: <37A8D56C.2EED1A5C@cybersurf.net>

Try: 
###
use Cwd;

$cwd = getcwd();
###

Matt Kennedy

Thomas Schmickl wrote:
> 
> How can I determine (In the _BEGIN_ of the script-execution)
> in which directory the executet perl-script is ?
> 
> Ciao, thomas.


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

Date: Wed, 04 Aug 1999 23:09:36 GMT
From: bhaskaracharya@my-deja.com
Subject: hash ???- sort/changing keys.
Message-Id: <7oah77$6bm$1@nnrp1.deja.com>



hi
i want to sort this hash of hashes

$hash = {
	  a10_msblck => {name => black},
	  a5_mrjoe => { name=> joe},
	  a15_msblck => {name => black},
	  b10_me => {name = me},
	  default => {name = default}
	};

i read the faq but note that a5 has to come before a10
and default has to come at d. the faq solution prints out
as a10,a15,a5,b10,default.



also how can i change the keys alone of a hash from an array
without building another hash??

my @new_keys = qw ( 1 2 3 4);
my @old_keys = keys (%hash);

thanks
-bhaskar


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


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

Date: Wed, 4 Aug 1999 17:56:42 -0500
From: "Kevin and Andrea Werner" <the.werners@mcleodusa.net>
Subject: Help getting Perl to work on Windows 98
Message-Id: <fu3q3.58$F22.711@newsfeed.slurp.net>

I cannot get Perl to run my CGI scripts under Windows 98. I can run Perl
scripts from the command line, and I can use PerlScript in ASP pages.
However, if I call a .pl file from the Address bar, Perl locks up. I have
the correct settings in my Registry's script map (I think), and I have
correctly set up my virtual directory (for Execute but not Read).

Incidentally, something similar happens when I try to run PHP3 scripts.
Instead of PHP crashing, however, I get an "HTTP/1.1 500 Server Error"
message.

This really is frustrating me because I am sure that at one time I had Perl
running just fine. However, for some reason I had to rebuild my system and
everything went to hell.

Any help would be appreciated.

Thanks!




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

Date: Wed, 04 Aug 1999 19:06:01 -0300
From: Matias Gorfinkiel <henryf@sminter.com.ar>
Subject: Re: How make .pl files executable? Is there a compiler?
Message-Id: <37A8B949.1F338717@sminter.com.ar>

If you are running a unix you have the perlcc that makes your .pl a binary. I
don't know under Win.

Good Luck
Sebastian.
Dimitrio wrote:

> Hi,
> How do I make my .pl files into .exe files?  Or into unix executables (even
> better)?
>
> Please some one help me with this one,
> Marcos.



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

Date: Wed, 4 Aug 1999 15:20:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how to substitute strings in a newly created file
Message-Id: <MPG.12125c71a7d46e3b989dcf@nntp.hpl.hp.com>

In article <37A8AA26.6C865241@ccrs.nrcanDOTgc.ca> on Wed, 04 Aug 1999 
17:01:26 -0400, Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> says...
> I'm writing a script to make files of directory listings.  However, I'd
> like to strip the extensions off all files listed in the new file, but
> can't seem to get the syntax correct:
> 
> #!/public/bin/perl -w

use strict;
 
> opendir FLTCOR, "fltcor" or die "can't open directory: $!";

OK.  So why don't you do that on the file-open below also?

> @rsps = grep !/^\.\.?$/, readdir FLTCOR;
> closedir FLTCOR;
> 
> open(RSP, ">rsp.list");
> print RSP "@rsps";

Don't you want one or more newlines in there?  You will have spaces, 
though.

> while (<>)
> {
> s/.*txt.*//g; # extension to be removed is ".txt"
> }
>  
> The script seems to run into infinity at this point, the file is
> created, however.

You are asking for input at that point, from any files named in the 
argument list or from STDIN.  No wonder it waits a long time.

Even if the loop were meaningful, the regex is not.  You say you want to 
strip off all extensions, and you have to do that before writing the 
output file.  So:

  s/(.)\.[^.]+$/$1/ for @rsps;

That leaves alone filenames without extensions, such as '.login' or 
'foobar.'.

Yes, gurus, the regex could be written with positive look-behind, but so 
what?  And I am assuming filenames without newlines.  Let's not get 
carried away.  I have never seen anyone knowingly name a file with a 
newline.  What a neat way to screw up an `ls`, no?

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


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

Date: 04 Aug 1999 18:06:41 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Jeoparder's Jest
Message-Id: <x7btcni4jy.fsf@home.sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:

  TC> In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
  TC> :I am liking Uri's EVENing OTTers more and more.

  TC> No reason to reveal the joke.  If they don't get it, no need
  TC> to hit them over the head with it.

but i thought finding out the meaning of those words and your puns was
the question? who do think you are, alex trebek?

uri

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


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

Date: Wed, 04 Aug 1999 22:09:18 GMT
From: feinster@my-deja.com
Subject: Re: Jeoparder's Jest
Message-Id: <7oadm5$3qs$1@nnrp1.deja.com>

The question is:
Whats the answer to life, the universe and everything?



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


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

Date: Wed, 04 Aug 1999 19:21:36 -0400
From: Eric Larson <rlarson@monmouth.com>
Subject: Newbie has <FILE> Problem - please help
Message-Id: <37A8CB00.119B137F@monmouth.com>

Hi -

I am trying to use file i/o in the following fashion, but have
problems with it. I'm looking for suggestions as to what I am doing
wrong, or how I can trace down what I am doing wrong.

When I run the following, most of the time the first $line works like it
was in
list more and reads in the ENTIRE FILE. Any subsequent attempt to read
that file comes up giving me $line as undef, to no great surprise. What
really frosts my butt is that sometimes 
it runs as if $line was scalar and gives me the result I think it
should. On the EXACT
SAME FILES.

Why?????

My Code:

sub procfiles {

  @filelist=qw(one tow free etc foobar);

  while (@filelist) {
   $thisfile = shift(@filelist);

   FILE   = open($thisfile) || next;
   OUTPUT = open($thisfile . "_static.html");

   $line = <FILE>;
   chomp $line;

   print OUTPUT "blah blaf <HTML> " . $line . "Yadd Yadda Yadda</HEAD>";

   $line = <FILE>;
   chomp $line;

   print OUTPUT "more nonsense" . $line; 

   while ($line=<FILE>) {
     chomp $line;
     print OUTPUT $line;
  }
    
   print OUTPUT "</BODY>";
   close(FILE);
   close(OUTPUT);
 }

}


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

Date: Wed, 4 Aug 1999 16:51:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie has <FILE> Problem - please help
Message-Id: <MPG.121271f0dabc516b989dd4@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37A8CB00.119B137F@monmouth.com> on Wed, 04 Aug 1999 19:21:36 
-0400, Eric Larson <rlarson@monmouth.com> says...
> I am trying to use file i/o in the following fashion, but have
> problems with it. I'm looking for suggestions as to what I am doing
> wrong, or how I can trace down what I am doing wrong.
 ... 
>    FILE   = open($thisfile) || next;
>    OUTPUT = open($thisfile . "_static.html");

perldoc -f open

What you have is more like C, nothing like Perl.

And by the way, once you figure out how to open the file, don't forget 
to deal with failure.  You have done that on the first line, but not the 
second. 

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


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

Date: Thu, 5 Aug 1999 09:57:37 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Newbie has <FILE> Problem - please help
Message-Id: <MPG.12137e7c9b14110a989be0@news-server>

Eric Larson writes ..
>When I run the following, most of the time the first $line works like it
>was in
>list more and reads in the ENTIRE FILE. Any subsequent attempt to read
>that file comes up giving me $line as undef, to no great surprise. What
>really frosts my butt is that sometimes 
>it runs as if $line was scalar and gives me the result I think it
>should. On the EXACT
>SAME FILES.
>
>Why?????

probably because you're messing with $/ outside the function .. try 
adding

  local $/ = "\n";

as the first line in your function

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 4 Aug 1999 18:45:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl counter muckup
Message-Id: <slrn7qhk4e.tec.abigail@alexandra.delanet.com>

Richard Lawrence (ralawrence@my-deja.com) wrote on MMCLXIV September
MCMXCIII in <URL:news:7o9gmh$cri$1@nnrp1.deja.com>:
'' 
'' I have written a small webpage counter (no big deal) in Perl and yet
'' every so often it resets itself (well, it reset itself today and had
'' been going for about 7 months before then). I've come to the not-so-
'' unreasonable conclusion that its my perl that is at fault. Could anyone
'' point me to what I've done wrong that makes this counter currently
'' unreliable please?

Perhaps your counter is too small, and you need a bigger one?  ;-)

But it looks like you made a mistake while opening the file the second
time. You first wipe out the data, then attempt to lock it. Perhaps it's
better to do the locking first, then override data?




Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 4 Aug 1999 17:54:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Penetration Data
Message-Id: <slrn7qhh46.tec.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXIV September
MCMXCIII in <URL:news:37a88297@cs.colorado.edu>:
** 
** Vendor Name:        Compaq Computer Corporation
** OS Name/Version:    VMS 6.2
** Perl version:       5.004_03
** Status:             On Freeware CD included as part of OS
**                     distributionkit. Also included as part of the
**                     Netscape FastTrackserver install kit distributed
**                     with VMS 7.2.
** Since when:         1995


According to perlhist, 5.004_03 dates from September 1997.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 4 Aug 1999 16:58:39 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Penetration Data
Message-Id: <37a8c59f@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    abigail@delanet.com writes:
:According to perlhist, 5.004_03 dates from September 1997.

Well, the question wasn't well worded, so the answers are 
funny.  What I *meant* was 

    What is the currently shipped version of Perl?

    When did the company first start shipping any version
    of Perl at all?

--tom
-- 
"... my dear old friend. I wish to God there were more automata in the world
 like you." - Charles Darwin to T H Huxley, letter, 1882.


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

Date: Wed, 04 Aug 1999 16:59:46 -0700
From: Derek Gerstmann <dgerstma@pinnaclestudios.com>
Subject: Processor Usage
Message-Id: <37A8D3F2.F01A80E7@pinnaclestudios.com>

What is the most efficient way to determine the percent of processor
usage on a given machine?  I'm currently running off of an SGI 8
processor Origin server running Irix 6.4, and need to be able to grab
processor usage for all proccessors at any given time.  I've fooled
around with redirecting 'top' to a file, and parsing that in, but I was
wondering if there are any mechanisms directly in perl that would
give me access to the amount of cpu usage being taken up by a
given process, or are there better mechanisms in unix that I should
be using?  Thanks in advance.





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

Date: Wed, 4 Aug 1999 15:01:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: reading in multiple unknown files and writing to it
Message-Id: <MPG.1212580572c90084989dcc@nntp.hpl.hp.com>

In article <37A8AA00.E5FD18F3@ebay.sun.com> on Wed, 04 Aug 1999 14:00:48 
-0700, Biju Abraham <biju.abraham@ebay.sun.com> says...
> Try this...

Error 1:  no 'use strict;' (and presumably no '-w').

> $dirname = ".";
> opendir(DIR,$dirname);

Error 2:  No check on failure to open.

> @files = grep(/.*\.dat/, readdir(DIR));

Errors 3-5:  The user asked for /\.txt$/; the '.*' is meaningless; for 
Windows/NT systems this should be case-insensitive (/i).

> foreach $file (@files) {
>         open(FILEHD,">$file");

Error 6:  No check on failure to open.

>         seek (FILEHD,0,0);

Error 7:  Useless.  Where do you think the file will be positioned?

>         printf(FILEHD "Written");

Errors 8 and 9:  Don't use 'printf' when you mean 'print'.  No newline 
to create a proper text file.

>         close (FILEHD);
> }
> 
> Biju
> quyluu@my-deja.com wrote:

Error 10:  Jeopardy-style complete quote of question after response.

For 9 lines of code, that's a considerable achievement!

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


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

Date: Wed, 04 Aug 1999 19:21:15 -0400
From: Jerrad Pierce <belg4mit@mit.edu>
Subject: regexp can be your friend
Message-Id: <37A8CAEB.26275078@mit.edu>

IS it possible, with a single RE, to replace the first occurence of a substring
within a string IFF the substring occurs multiple times?

PS> Please (b)cc me with any replies, thanks!


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

Date: 04 Aug 1999 19:36:05 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regexp can be your friend
Message-Id: <x7907ri0ey.fsf@home.sysarch.com>

>>>>> "JP" == Jerrad Pierce <belg4mit@mit.edu> writes:

  JP> IS it possible, with a single RE, to replace the first occurence
  JP> of a substring within a string IFF the substring occurs multiple
  JP> times?

yes.

  PS> Please (b)cc me with any replies, thanks!

post here, read here. but since you are from the tute i will give you a
fish.

perl -pe 's/(ab)(.*\1)/xx$2/'

i tried a lookahead version but it doesn't seem to work:

perl -pe 's/(ab)(?=\1)/xx/'

maybe ilya could exlain why? and i am sure he has new tricks which can
do this too.

uri

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


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

Date: Wed, 4 Aug 1999 16:48:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regexp can be your friend
Message-Id: <MPG.1212713421660627989dd3@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37A8CAEB.26275078@mit.edu> on Wed, 04 Aug 1999 19:21:15 -
0400, Jerrad Pierce <belg4mit@mit.edu> says...
> IS it possible, with a single RE, to replace the first occurence of a substring
> within a string IFF the substring occurs multiple times?

'multiple' means > 1?

Look for 'positive look-ahead' in perlre.

    s/\Q$substring\E(?=.*\Q$substring\E)/whatever/s;
 
> PS> Please (b)cc me with any replies, thanks!

Done. 

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


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

Date: Wed, 04 Aug 1999 22:13:50 GMT
From: daniel@fabric.com (Daniel Doreika)
Subject: Regular expression for matching an e-mail address.
Message-Id: <37a8babe.101714222@news.earthlink.net>

I remember reading somewhere many months ago a really good regular
expression for matching e-mail address.  Now I need to use it, and I
can not seem to find it anymore.  Can someone please provide me with
the best possible regular expression for matching an e-mail address?
Thank you.



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

Date: Wed, 4 Aug 1999 15:56:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regular expression for matching an e-mail address.
Message-Id: <MPG.121264dd18bc4359989dd1@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37a8babe.101714222@news.earthlink.net> on Wed, 04 Aug 1999 
22:13:50 GMT, Daniel Doreika <daniel@fabric.com> says...
> I remember reading somewhere many months ago a really good regular
> expression for matching e-mail address.  Now I need to use it, and I
> can not seem to find it anymore.  Can someone please provide me with
> the best possible regular expression for matching an e-mail address?

It is on page 316 of 'Mastering Regular Expressions' by Jeffrey Friedl.  
It is 6598 bytes long.

Are you quite sure that is what you want to do?  Or should you maybe 
read perlfaq9:

How do I check a valid mail address?

You can't, at least, not in real time. Bummer, eh? 

 ...

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


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

Date: Wed, 04 Aug 1999 16:03:18 -0700
From: Makarand Kulkarni <makkulka@cisco.REMOVETHIS.com>
Subject: Re: Regular expression for matching an e-mail address.
Message-Id: <37A8C6B5.B6BCA2E8@cisco.REMOVETHIS.com>

[Daniel Doreika wrote..]
> Can someone please provide me with
> the best possible regular expression for matching an e-mail address?

The Regular Expression is
/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/
I will leave it to you to decide if this is the best one.

--


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

Date: 4 Aug 1999 17:40:29 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Regular expression for matching an e-mail address.
Message-Id: <37a8cf6d@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    daniel@fabric.com (Daniel Doreika) writes:
:I remember reading somewhere many months ago a really good regular
:expression for matching e-mail address.  Now I need to use it, and I
:can not seem to find it anymore.  Can someone please provide me with
:the best possible regular expression for matching an e-mail address?
:Thank you.

Try:

    $addr =~ /^tchrist\@.*\bperl.com$/i

I find that it works admirably for me.

And try the FAQ.

--tom
-- 
Quid quid latine dictum sit, altum viditur.


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

Date: 4 Aug 1999 18:56:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Repetition in RE substitutions
Message-Id: <slrn7qhkoc.tec.abigail@alexandra.delanet.com>

Don Blaheta (dpb@cs.brown.edu) wrote on MMCLXIV September MCMXCIII in
<URL:news:7o9khm$9ku@cocoa.brown.edu>:
{} I've run into something of a difficulty with s///g matches: how exactly
{} do I replace things that are repetitions (*, +, or {m,n}) in the
{} pattern?
{} 
{} Here's an example.  Say I have a lot of text, in which occur serial
{} numbers of the form \d+(-\d+)* .  I need to go through and remove the
{} hyphens from these numbers, without removing the hyphens from the rest
{} of the text.  Conceptually, what I want is something like
{} 
{} 	s/(\d+)(?:-(\d+))*/$1($2)*/g

So, you want to remove all the hyphens that have a digit in front, and
a digit behind them?  With 5.005, it's easy:

        s/           # If we have
          (?<=\d)    # a digit preceeding
          -          # a hypen
          (?=\d)     # and a digit following it
         //gx;       # then delete the hyphen.

And with pre-5.005:

        s/           # If we have
          (\d)       # a digit and
          -          # a hypen
          (?=\d)     # and a digit following it
         /$1/gx;     # then keep only the digit.


It's important to have a zero-width look ahead for the digit following 
the hyphen, as we want to be able to "reuse" it, for cases like '5-5-5'.


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 372
*************************************


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