[6321] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 943 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 13 18:31:28 1997

Date: Thu, 13 Feb 97 15:00:21 -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           Thu, 13 Feb 1997     Volume: 7 Number: 943

Today's topics:
     Re: + 1 = 3 ??? (Jot Powers)
     Re: [Q] Finding matching line based on surrounding line (Dave Thomas)
     Re: Commercial success stories using perl. - Thanks to  <stevev@dynamicweb.com>
     Re: Counting values within a file (Dave Thomas)
     Re: Does Perl free SV's created in an XSUB? (Ilya Zakharevich)
     Escaping \u in a string (Marc Philips)
     Re: Escaping \u in a string (Nathan V. Patwardhan)
     Globbing not working in perl5.003 under os/2? <ivan@protein.bio.msu.su>
     Re: Globbing not working in perl5.003 under os/2? (Ilya Zakharevich)
     How to open an HTTP connection with PERL ? (Mihai Crasneanu)
     Re: How to open an HTTP connection with PERL ? (Nathan V. Patwardhan)
     OPEN HTTP connection with PERL\Win ? (Mihai Crasneanu)
     Re: OPEN HTTP connection with PERL\Win ? (Nathan V. Patwardhan)
     Re: Perl NT <shackle@winternet.com>
     Perl, win32::internet and how to connect to several ser (Repo)
     PerlXS <murray@reston.ans.net>
     Re: PerlXS (Michael Fuhr)
     Re: Randal trashed yet again--*sigh* (Nathan V. Patwardhan)
     Reading files in a directory and printing to one txt fi mohawk@swceweb.com
     Re: regexp's in XEmacs vs. Perl <ctdean@cogit.com>
     Re: regexp's in XEmacs vs. Perl <hniksic@srce.hr>
     Re: REQ: Getting the amount of files in a certain direc <alan@groucho.che.jhu.edu>
     Re: script for notifying sys adm that disc is full <tchrist@mox.perl.com>
     Re: subtle (to me) RE problem (Jeffrey)
     Using Perl to get LAst Modified Dates <benoitb@detroitedison.com>
     Very memory-intensive Perl script can not exit <frishman@mips.biochem.mpg.de>
     Re: Very memory-intensive Perl script can not exit (Ilya Zakharevich)
     W95: 127.0.0.1 without dial up or network card? (John Bokma)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 13 Feb 1997 19:23:12 GMT
From: jot.feb97@tmp.medtronic.com (Jot Powers)
Subject: Re: + 1 = 3 ???
Message-Id: <5dvpn0$o15@gazette.medtronic.com>

In article <3302DC01.2963@mediascape.de>, Christian Bruegmann <chr@mediascape.de> writes:
>this is the way my perl solves a small addition
>
>[$g = 0; $p = 6.50;] <== Coming from a database - Doing a print makes me
>sure of the content....
>
>$g = $g + $p;
>
>==> $g = 6.5000000005215406418

You need to tell us more about your perl.  Try reducing your case to
the smallest example that can duplicate the problem, because I can't
duplicate it.  Observe:

node127% perl -de 1
Stack dump during die enabled outside of evals.
 
Loading DB routines from perl5db.pl patch level 0.94
Emacs support available.
 
Enter h or `h h' for help.
 
main::(-e:1):   1
  DB<1> $g = 0; $p = 6.50
 
  DB<2> $g = $g + $p
 
  DB<3> p $g
6.5
  DB<4> q
node127% perl -v
 
This is perl, version 5.003 with EMBED
        built under solaris at Oct 16 1996 14:39:16
        + suidperl security patch

-- 
Jot Powers  jot.feb97@tmp.medtronic.com
Unix System Administrator, Medtronic Micro-Rel
"Subtlety is the art of saying what you think and getting out of the way
before it is understood."




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

Date: 13 Feb 1997 19:33:32 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: [Q] Finding matching line based on surrounding lines
Message-Id: <slrn5g6qv7.i2l.dave@fast.thomases.com>

On 13 Feb 1997 16:42:29 GMT, Eric D. Carter <ecarter@a-lincoln.hnet.uci.edu> wrote:
> 
> while (<>) {
> 	if /Name:(.*)/ {
> 		$name = $1;
> 	}
> 	elsif /Number:(.*) {
> 		$number = $1;
> 	}
> }
> 
> The line I'm looking for follows the format:
> -	<12/34/56> 
> where the numbers can be any date.  The problem is that
> I need to know whether the pattern matched is under the
> name or number or whatever.

Why not just remember the last match type, and then do whatever you need to
depending on it when you match the date:

 $last = 'unknown';
 while (<>) {
 	if /Name:(.*)/ {
 		$name = $1;
		$last = 'name';
 	}
 	elsif /Number:(.*) {
 		$number = $1;
		$last = 'number';
 	}
	elsif m#^-\s+<(\d\d/\d\d/\d\d)># {
	  ${ $last . "_date" } = $1;    # sets $name_date or $number_date
	}
 }
 
Just a thought

Dave



-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Thu, 13 Feb 1997 16:30:42 +0000
From: Steve Vanechanos <stevev@dynamicweb.com>
Subject: Re: Commercial success stories using perl. - Thanks to all who replied
Message-Id: <330341B2.6F0C@dynamicweb.com>

This is a multi-part message in MIME format.

--------------5BC671527C2A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Many thanks to all you "perl heads" out there that replied with your 
insights and experiences.

Attached is a press release summarizing the success of your (and mine) 
efforts. 

Now the real fun begins ... our goal: to make DynamicWeb Enterprises a 
smashing commercial success in the field of electronic commerce 
solutions by utilizing the talent, level of commitment and energy of the 
people and work ethic of the language that makes perl "perl".

I hope I can look forward to the continued support (both voluntary and 
professionally) of you "perl heads" out there in "perl land".
 

-- 
Steve Vanechanos                        www.dynamicweb.com
President                               stevev@dynamicweb.com
DynamicWeb Enterprises, Inc.            voice: 201-244-1000
271 Rt 46 West, Fairfield, NJ 07004     fax: 201-777-7428

--------------5BC671527C2A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dw_press21397.html"

<BASE HREF="http://www.dynamicweb.com/dw_press21397.html">

<html>

<head>

<title>DynamicWeb - DynamicWeb Press Gallery</title>
</head>

<body bgcolor="#FFFFFF" alink="#EE0000" #ffffff>

<p align="center"><img src="/images/translogo.gif"
alt="DynamicWeb" transaction systems> <br>
<br>
<img src="/images/news2.gif" alt="News"> </p>

<hr>
<h3>DynamicWeb &#153; Enterprises Secures Firm Commitment to Underwrite Secondary Offering of Common Stock</h3>
<center><b><i>Proceeds to Strengthen Company's Position in Electronic Commerce Industry</i></b></center><br><br>

<b>Fairfield, NJ, February 13, 1997</b> -- DynamicWeb Enterprises, Inc., ("the Company": NASD - Bulletin Board: DWEB) today announced it has received a firm commitment from an investment banking firm to underwrite a secondary offering of the Company's common stock having gross proceeds of at least $6,000,000. The shares of common stock to be offered will be registered under the Securities Act of 1933, as amended.  The offering will be made only by means of a prospectus meeting the requirements of such Act, and is scheduled to take place in June 1997.
<p>
Net proceeds from the offering will be used for research and development of new electronic commerce technologies, sales and marketing of the Company's products and services, and for other general corporate purposes.
<p>
Located in Fairfield, New Jersey, DynamicWeb Enterprises, Inc. <a href= http://www.dynamicweb.com>http://www.dynamicweb.com</a> develops and markets electronic commerce software and services.  The company uses traditional EDI methods and its patent-pending Internet technology to enable companies to realize the full  business potential of EDI by increasing compliance and penetration with trading partners.<br>

<center><img src="/images/ovallogo.gif"
alt="DynamicWeb: home of NetCat Online Ordering Suite" border="0"></a></center>





<center>
   
        <h5><a href="dw_press.html"
        target="_top">Back</a> | <a href="index.html"
        target="_top">Home</a></h5>
   
    

</center>

<center>
    
        <center><td><h5>Copyright 1997, DynamicWeb &#153; Enterprises<br>
        Comments to <a href="mailto:sales@dynamicweb.com">sales@dynamicweb.com</a> <br>
        Last Update : Thu Feb 13, 1997 08:55:01 EDT </h5>
        </center>
    


</body>
</html>


--------------5BC671527C2A--




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

Date: 13 Feb 1997 19:25:33 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Counting values within a file
Message-Id: <slrn5g6qg7.i2l.dave@fast.thomases.com>

On Thu, 13 Feb 1997 09:12:56 +0000, Darryl Caldwell <darrylc@eznet.com> wrote:
> I would like to learn how to count multiple occurences of 
> text within a
> file.
> 
> If a file contains:
> 
> 
> camel
> iguana
> penguin
> cat
> penguin
> cheetah
> camel
> 
> I would like to append text underneath this that says:
> 
> Total
> =============
> camel           2
> iguana          1
> penguin         2
> cat             1
> cheetah         1

Maybe something like:

my %count;

while (<>) { 
   print;
   chomp; 
   $count{$_}++;
}



print "\nTOTAL\n=====\n";
for (sort keys %count) {
  printf "%-20s %d\n", $_, $count{$_};
} 




-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 13 Feb 1997 20:21:34 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Does Perl free SV's created in an XSUB?
Message-Id: <5dvt4e$bu6$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tim Lewis 
<tcl@caesun.msd.ray.com.CLIP.THIS.PART>],
who wrote in article <3303388A.1AA8@caesun.msd.ray.com.CLIP.THIS.PART>:
> I've been creating some XSUB's for a C library, and I have a question
> about variables created in the XSUB.  The man pages perlxs, perlguts,
> etc. didn't make this very clear, and there doesn't seem to be a whole
> lot in the FAQ about it. 
> 
> In my XSUB I create a hash, fill it, and return a reference to the hash
> on the argument stack.
> 
> My code is similar to the following:
> 
> void
> OneNTwo(o, t)
> 	char* o
> 	char* t
> 	PPCODE:
>   		SV *one;
> 		SV *two;
> 
> 		HV *HV_rtn;
> 
> 		HV_rtn = newHV();
> 
> 		one = newSVpv(o, 0);
> 		two = newSVpv(t, 0);
> 
> 		hv_store(HV_rtn, "ONE", 3, one, 0);   
> 		hv_store(HV_rtn, "TWO", 3, two, 0);
> 
> 		XPUSHs(sv_2mortal(newRV((SV *)HV_rtn)));

Friends do not let friends use newRV like this. This macro is for
internal perl usage, and not appropriate for most the tasks of
XSUBs. In newer Perl's use newRV_noinc. In older ones decrement the
refcnt of HV_rtn after your XPUSHs.

Ilya


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

Date: Thu, 13 Feb 1997 20:34:13 GMT
From: Marc.Philips@ping.be (Marc Philips)
Subject: Escaping \u in a string
Message-Id: <33037a59.22697977@news.ping.be>

I'm trying to open  a file on this path "test\uit"  but the the \u
gets interpreted and then it opens testIt




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

Date: 13 Feb 1997 20:51:03 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Escaping \u in a string
Message-Id: <5dvurn$htf@fridge-nf0.shore.net>

Marc Philips (Marc.Philips@ping.be) wrote:
: I'm trying to open  a file on this path "test\uit"  but the the \u
: gets interpreted and then it opens testIt

Escape the "\", so it's "\\".
$var = 'test\\uit';


--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"


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

Date: Thu, 13 Feb 1997 21:35:46 +0300
From: Ivan Adzhubei <ivan@protein.bio.msu.su>
Subject: Globbing not working in perl5.003 under os/2?
Message-Id: <33035F02.E2E@protein.bio.msu.su>

Anybody made globbing to work in %subject%? Actually, any attempts to
call system shell (via globbing, `...`, or system()) result in:

Process terminated by SIGSEGV
core dumped
SYS1808:
The process has stopped.  The software diagnostic
code (exception code) is  0005.

My perl installation is standard Perl5.003 for OS/2, PERL_SHPATH set to
C:\BIN, with sh.exe in it, and sh.exe runs Ok on its own.
Any tips appreciated.

Cheers
Ivan Adzhubei


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

Date: 13 Feb 1997 20:26:29 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Globbing not working in perl5.003 under os/2?
Message-Id: <5dvtdl$bu6$2@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ivan Adzhubei 
<ivan@protein.bio.msu.su>],
who wrote in article <33035F02.E2E@protein.bio.msu.su>:
> Anybody made globbing to work in %subject%? Actually, any attempts to
> call system shell (via globbing, `...`, or system()) result in:
> 
> Process terminated by SIGSEGV
> core dumped
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0005.

Vow! Have never seen 1808. The explanation is not that helpful:


H:\get>help 1808

SYS1808:
The process has stopped.  The software diagnostic
code (exception code) is ***.

EXPLANATION: The program generated an exception that the system cannot
resolve.  The soft ware diagnostic code allows determination of what
type of exception was generated.

ACTION: Correct the problem or try a different version of the program.

> 
> My perl installation is standard Perl5.003 for OS/2, PERL_SHPATH set to
> C:\BIN, with sh.exe in it, and sh.exe runs Ok on its own.
> Any tips appreciated.

I thought one needs forward slashes in PERL_SHPATH, but this is
probably not the reason...

Ilya

P.S. Does shell-less system() work?


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

Date: Thu, 13 Feb 1997 21:16:33 GMT
From: mihaic@usa.net (Mihai Crasneanu)
Subject: How to open an HTTP connection with PERL ?
Message-Id: <5dveos$nvb@lex.zippo.com>


	HI,
	
	My project is to use perl to get automatically web pages on the 
	Internet to be able to analyze them and generate results...
	
	Is there a way of accessing a web page and retrieving it with PERL ?
	If so, thanks to write me at a-ventura@bnp.fr
	I will obviously be very glad to get some code with it obviously...


	Arnaud Ventua
	
------------------------------------------------------------
Mihai Crasneanu                        mailto:mihaic@usa.net
Buenos Aires - Argentina



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

Date: 13 Feb 1997 20:17:13 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: How to open an HTTP connection with PERL ?
Message-Id: <5dvss9$f4d@fridge-nf0.shore.net>

Mihai Crasneanu (mihaic@usa.net) wrote:

: 	My project is to use perl to get automatically web pages on the 
: 	Internet to be able to analyze them and generate results...

I presume that working a project requires research, in which case I'll help
you research your topic: Check out http://www.dejanews.com and query for:
comp.lang.perl.misc get pages web, which gives 35 matches.  Who thought
that researching a problem wasn't easy?

You might also check out http://www.perl.com/perl/CPAN/ and search for
libwww, or LWP!  HTH!  Good luck with your project!

--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"


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

Date: Thu, 13 Feb 1997 22:38:14 GMT
From: mihaic@usa.net (Mihai Crasneanu)
Subject: OPEN HTTP connection with PERL\Win ?
Message-Id: <5dvji4$qfh@lex.zippo.com>


	Hi,

	I would like to use PERL to retrieve pages from the Web.
	I have seen a lib libwww that could be usefull to me,
	however it does not seem to work for PERL win32...
	
	Anyone can give me advises about how to solve my problem ??
	
	Thanks in advance to answer to a-ventura@usa.net.
	I am using a friend account.
	
	Arnaud Ventura	

	
------------------------------------------------------------
Mihai Crasneanu                        mailto:mihaic@usa.net
Buenos Aires - Argentina



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

Date: 13 Feb 1997 20:18:27 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: OPEN HTTP connection with PERL\Win ?
Message-Id: <5dvsuj$f4d@fridge-nf0.shore.net>

Mihai Crasneanu (mihaic@usa.net) wrote:

: 	I would like to use PERL to retrieve pages from the Web.
: 	I have seen a lib libwww that could be usefull to me,
: 	however it does not seem to work for PERL win32...

It *does* work for Win32 if you're using version 5.003_07 from 
http://www.activeware.com.


--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"


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

Date: 13 Feb 1997 19:29:39 GMT
From: David Fetter <shackle@winternet.com>
Subject: Re: Perl NT
Message-Id: <5dvq33$1fh$1@blackice.winternet.com>

DerosM@aramis.be wrote:
> Hi,

> Newbie's question...

> Is it possible to test Unix perl script on a NT machine. I have Perl 5
> for NT, but have not yet installed it.

It certainly is.  First, install your favorite UN*X on the former NT machine.
You will see amazing performance gains.  Next, install Perl as usual, and
run the scripts.

Good luck :)
-- 
            David Fetter                     600 10th Ave. SE #302
   shackle@ren.glaci.com                      Minneapolis, MN 55414 USA
  http://www.glaci.com/~shackle              +1 612 331 6009 (voice)
for(split/ /,"tsuJ rehtona lreP rekcah"){print $_=reverse(split)." ";}

The plural form of "anecdote" is "data."



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

Date: Thu, 13 Feb 1997 17:13:08 GMT
From: st.aim@a1.nl (Repo)
Subject: Perl, win32::internet and how to connect to several servers at the same time.
Message-Id: <33064b42.29621737@news.xs4all.nl>

Hello reader,

I have to check files on several servers. Do you know if this is
possible with perl and win32::internet, if so were can i find info and
examples or can you tell me? 
The only solution for me a this time is to run more than one script.
But i suppose there is a way to make more than one connection at the
time.
Can some one help me out on this one?

Thanks in advance,

Robert E Bakker

Email st.aim@a1.nl 



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

Date: Thu, 13 Feb 1997 16:56:45 -0500
From: Tom Murray <murray@reston.ans.net>
Subject: PerlXS
Message-Id: <33038E1D.6540@reston.ans.net>

Hi,

I am trying to learn how to use XS to create an extension
interface between Perl and a C library.  

I thought I would start off by following the perlXStut (Tutorial
for XSUB's).  (http://dymaxion.ns.ca/dv/perl_manual/perlxstut.html)

I followed example one to the tee.  When I got 
to the part where I ran the "perl test1.pl"  I received the following
error:

Can't find loadable object for module Test1 in @INC (./blib \
/usr/local/lib/perl5/sun4-solaris/5.003 /usr/local/lib/perl5 \
/usr/local/lib/perl5/site_perl/sun4-solaris \
/usr/local/lib/perl5/site_perl .) at Test1.pm line 18 \
BEGIN failed--compilation aborted at test1.pl line 5.


Here are the lines in question from Test1.pm:

    16  $VERSION = '0.01';
    17
    18  bootstrap Test1 $VERSION;


Can someone explain to me what the bootstrap line means?
How can a resolve the problems I am encountering?

By the way here is the perl verions I am running:

#perl -v
This is perl, version 5.003 with EMBED
        built under solaris at Sep  3 1996 12:32:55
        + suidperl security patch


Thanks in advance for your help!!

Tom
murray@reston.ans.net


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

Date: 13 Feb 1997 15:35:27 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: PerlXS
Message-Id: <5e04vf$65o@nova.dimensional.com>

 [ cc to author ]

Tom Murray <murray@reston.ans.net> writes:

>I am trying to learn how to use XS to create an extension
>interface between Perl and a C library.  

>I thought I would start off by following the perlXStut (Tutorial
>for XSUB's).  (http://dymaxion.ns.ca/dv/perl_manual/perlxstut.html)

>I followed example one to the tee.  When I got 
>to the part where I ran the "perl test1.pl"  I received the following
>error:

>Can't find loadable object for module Test1 in @INC (./blib \
-snip-

Try using "make test" to run the test script, or add this to
the beginning of the script:

    use ExtUtils::testlib;

After you add that, you can get rid of the "use lib './blib'" line
suggested by the perlxstut manpage.  As you found out, it doesn't
work.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: 13 Feb 1997 18:55:55 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Randal trashed yet again--*sigh*
Message-Id: <5dvo3r$akd@fridge-nf0.shore.net>

Clinton Pierce (cpierce1@cp501.fsic.ford.com) wrote:

:  http://pathfinder.com/@@yMtBXQUApoF4m2Oe/fortune/1997/970203/eml.html

Where was Randal mentioned in this article?

--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"


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

Date: Thu, 13 Feb 1997 14:13:08 -0700
From: mohawk@swceweb.com
Subject: Reading files in a directory and printing to one txt file
Message-Id: <330383E4.7285@swceweb.com>

I'm completely new at this and am trying to create a script to read a
bunch of files in a directory and output them to one txt file.
What it's for is a classroom type thing where a chat room is set up as a
class and I need a transcript of the session, getting just the message
and the username.
Can I get some advice as to how to proceed with this? 
thank you


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

Date: 11 Feb 1997 19:26:29 -0800
From: Chris Dean <ctdean@cogit.com>
Subject: Re: regexp's in XEmacs vs. Perl
Message-Id: <x4ybcuiu1m.fsf@carnifex.cogit.com>


Vladimir Alexiev <vladimir@cs.ualberta.ca> writes:
> In article <43evhfuov.fsf@teracorp.com> David Bakhash <dave@teracorp.com> writes:
> 
> > Does anyone know if XEmacs provides an alternate way to enter in regular
> > expressions the way Perl accepts them?
> I don't think there's any, but it's easy to write a macro to do this.

Actually it's not.  Perl goes "beyond" the "normal" regular
expressions like those found in X?Emacs.

While presumably one could do simple things like translate '\s' to
'[ \t\n\r]', it would be require significant work to get some of
the more useful Perl regexps.  Even to implement the \s translation
perfectly one would need a regular expression parser so that
[\sxyz] changes to [ \t\n\rxyz].

The real problem is that to allow things like lookaheads and stingy
matching you must drop in Perl's RE module. I used 
/Error \d+: (.*?) Line/ just today..

See http://www.perl.com/CPAN/doc/FMTEYEWTK/regexps.html for more
info.


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

Date: 13 Feb 1997 21:15:40 +0100
From: Hrvoje Niksic <hniksic@srce.hr>
Subject: Re: regexp's in XEmacs vs. Perl
Message-Id: <kigraikqx77.fsf@jagor.srce.hr>

Chris Dean <ctdean@cogit.com> writes:

> Actually it's not.  Perl goes "beyond" the "normal" regular
> expressions like those found in X?Emacs.
> 
> While presumably one could do simple things like translate '\s' to
> '[ \t\n\r]', it would be require significant work to get some of
> the more useful Perl regexps.  Even to implement the \s translation
> perfectly one would need a regular expression parser so that
> [\sxyz] changes to [ \t\n\rxyz].

Whatever are you talking about??  Haven't you ever looked at Emacs
syntax tables?  Perl \s is the same as Emacs \s-.  Emacs also has \s_,
\sw, \S<something>, etc.  Look up the regexp section of the manual.

> The real problem is that to allow things like lookaheads and stingy
> matching you must drop in Perl's RE module. I used 
> /Error \d+: (.*?) Line/ just today..

Yup.  Things like .*? are currently unavailable in Emacs.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Ask not for whom the <CONTROL-G> tolls.


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

Date: Thu, 13 Feb 1997 15:16:44 -0800
From: Alan Grossfield <alan@groucho.che.jhu.edu>
Subject: Re: REQ: Getting the amount of files in a certain directory.
Message-Id: <3303A0DC.7CD0@groucho.che.jhu.edu>

I supose it's beating a dead horse, but isn't the for loop 
unnecessary?
Replace:
>
> foreach $entry (@entries) {
>     $i++ if $entry;
> }
> 
> print("There were $i entries with a .D extension.\n");

With
$i= $#entry +1; # assuming a base 0 array
print("There were $i entries with a .D extension.\n");

Alan Grossfield
--------------------------------------------------------
|   Johns Hopkins University Medical School            |
|   alan@groucho.med.jhmi.edu                          |
|   (410) 614 - 4435                                   |
--------------------------------------------------------


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

Date: 13 Feb 1997 21:59:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: script for notifying sys adm that disc is full
Message-Id: <5e02rr$5js$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, SRI <ss51@columbia.edu> writes:
:I am looking for a script that will monitor disc activity (on IRIX and
:HP-UX sustems) and notify(e-mail) the largest few users (above a certain
:cut-off on disk usage) as well as the system administrator that the disc
:is close to full (say 95%). If this has been already done I don't want
:to re-invent the wheel.

No promises, as I've not used this in aeons, but it used to do 
what you said.

--tom

#!/usr/bin/perl 
#
# diskfull - check for "full" disks, mailing top users about the problem
# tom christiansen, 9-sep-90
#
# "full" is defined as having more than $MIN_FREE percent usesd,
# unless the file system is mentioned in the $EXCEPT file, which
# should consist of ordered pairs of filesystems and minfree values.

$MIN_FREE  = 97;	# unless in EXCEPT file, want this much free
$MIN_WHINE = 5; 	# don't whine at someone with less than this %

$EXCEPT    = '/usr/adm/etc/capacities';

chop($hostname = `hostname`);

&read_exceptions;

open(DF, "df -t 4.2|");
$_ = <DF>; 		# skip header
while ( <DF> ) {
    chop;
    ($disk, $kbytes, $used, $avail, $capacity, $mpnt) = split;
    $capacity =~ s/%//;
    if ( $capacity > (defined($Max{$mpnt}) ? $Max{$mpnt} : $MIN_FREE)) {
	&too_full($mpnt, $used, $capacity);
    } 
} 
close DF;
exit;

# ---------------------------------------------------------------------------

sub read_exceptions {
    local($fs, $min_free);
    # global $EXCEPT %Max

    if (-e $EXCEPT) {
	open EXCEPT || die "can't open $EXCEPT: $!";
	while ( <EXCEPT> ) {
	    next if /^\s*#/ || /^\s*$/;
	    chop;
	    ($fs, $min_free) = split(' ');
	    if ($fs =~ /^min_?free/i) {
		$MIN_FREE = $min_free;
	    } else {
		$Max{$fs} = $min_free;
	    } 
	} 
	close EXCEPT;
    } 
}

# ---------------------------------------------------------------------------

sub too_full {
    local($fs, $kused, $percen) = @_;
    local($_, $used, $user, $anon, @anon, @lines, @allusers, @abusers);

    open (QUOT, "/usr/etc/quot $fs|");
    $_ = <QUOT>;  # skip header

    while ( <QUOT> ) {
	push(@lines, $_);
	chop;
	($used, $user) = split(' ');
	if ($user =~ /^#/) {
	    push(@anon, $user);
	    $anon =+ $used;
	    next;
	} 
	push(@allusers, $user);
	push(@abusers, $user) 	unless $used/$kused < ($MIN_WHINE/100);
    } 
    close QUOT;
    die "couldn't run quot on $fs" if $? || $#allusers < 0;

    $rcpts = join(", ", ($#abusers < 0) ? @allusers : @abusers);

    if (0 && $anon) { # maybe someday
	print "Should remind root that $anon kbytes on $fs are used by ";
	print "defunct users ", join(', ', @anon), "\n";
    } 

    open (MAIL, "| /usr/lib/sendmail -oi -t");
    select(MAIL);

    print <<EOM;
From: the Disk Monitor Daemon ($0) <daemon>
To: $rcpts
Cc: root
Subject: $fs on $hostname is $percen% full

Each of you is taking up at least $MIN_WHINE% of the space on $hostname:$fs.
Please do what you can to reduce this.  You might consider simply removing
extraneous files, moving some files to other filesystems, compressing them, 
or backing them up on tape and then deleting them.

your friend, the daemon

PS: here are the exact totals in kilobytes for top users:

EOM

    print @lines[0..$#abusers];
    print "\n";
    close MAIL;
    select(STDOUT);
} 
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


I've got plenty of inputs and outputs.  I don't need the video. --Andrew Hume


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

Date: 13 Feb 1997 12:33:40 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: subtle (to me) RE problem
Message-Id: <JFRIEDL.97Feb13213340@tubby.nff.ncl.omron.co.jp>


[mail and post]

Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:
|> In a script which is scoring spam, I want to be able to
|> detect N or more occurances of any one of these characters:
|> 
|> 	()!%*_+=|\/,<>:~-
|> 
|> For N=7, I have
|> 
|> /([\(\)!%*_+=|\\\/,<>:~-]).*${1}.*${1}.*${1}.*${1}.*${1}.*${1}/
|> 
|> And that gives me a "nested *?+ in regexp" error. Why?

Probably because $1 from some previous match holds *, +, ? or the like.
$1 refers to some text matched by some previous (and finished) match.
Within a regex, to refer to some text already matched, use \1.

	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@omron.co.jp> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/


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

Date: 13 Feb 1997 20:18:55 GMT
From: "Brian R. Benoit" <benoitb@detroitedison.com>
Subject: Using Perl to get LAst Modified Dates
Message-Id: <01bc1986$b1cdd520$e67409a2@BenoitB.deco.com>

I need to know if there is a way to get the date last modified of files in
a directory and compare those dates to a date stored in a cookie.

One I have the list of dates I want to get a list of files that have been
modified after a certain date.

I am new to perl and don't even know where to start looking.

Thanks,
Brian R. Benoit

These are my opinions and do not reflect those of Detroit Edison


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

Date: Thu, 13 Feb 1997 21:51:33 +0100
From: Dmitrij Frishman <frishman@mips.biochem.mpg.de>
Subject: Very memory-intensive Perl script can not exit
Message-Id: <33037ED5.41C6@mips.biochem.mpg.de>

I am running a perl script which reads from disk the index of a
relatively big database. The index is stored in a hash
$hash{ENTRY_ID} = POSITION_IN_FILE;
Although on the disk the index takes only 2.5. mB, (160000 ID/POS
pairs), the hash is huge and "top" shows about 35 mB resident size and
about 55 mB virtual size. However, the program does what I want (e.g.,
finds and prints an entry from the database) pretty quickly (about 20
seconds), but then can not exit and is sleeping for a long time (about
800-1000 seconds). I made sure using the debugger that it happens
exactly on the exit statement.  Apparently something is wrong with
virtual memory/swaping, but what to do with it? I am using DIGITAl UNIX
3 on a DEC Alpha Station.

Any advice will be greatly appreciated.


-- 
Dmitrij Frishman, PhD				| Tel. +49-(0)89-8578-2664
Max-Plank-Institute for Biochemistry		| Fax. +49-(0)89-8578-2655
Martinsried Institute for Protein Sequences	| e-mail:
frishman@mips.biochem.mpg.de
Am Klopferspitz 18a, 82152 Martinsried, Germany	| WWW:
http://www.mips.biochem.mpg.de/~frishman/


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

Date: 13 Feb 1997 22:11:21 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Very memory-intensive Perl script can not exit
Message-Id: <5e03i9$p8f$2@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Dmitrij Frishman 
<frishman@mips.biochem.mpg.de>],
who wrote in article <33037ED5.41C6@mips.biochem.mpg.de>:
> I am running a perl script which reads from disk the index of a
> relatively big database. The index is stored in a hash
> $hash{ENTRY_ID} = POSITION_IN_FILE;
> Although on the disk the index takes only 2.5. mB, (160000 ID/POS
> pairs), the hash is huge and "top" shows about 35 mB resident size and
> about 55 mB virtual size. However, the program does what I want (e.g.,
> finds and prints an entry from the database) pretty quickly (about 20
> seconds), but then can not exit and is sleeping for a long time (about
> 800-1000 seconds). I made sure using the debugger that it happens
> exactly on the exit statement.  Apparently something is wrong with
> virtual memory/swaping, but what to do with it? I am using DIGITAl UNIX
> 3 on a DEC Alpha Station.

Did you try -Dm ? (Or whatever it is for debugging memory allocation...)

Ilya


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

Date: Thu, 13 Feb 97 21:53:47 GMT
From: jbokma@caiw.nl (John Bokma)
Subject: W95: 127.0.0.1 without dial up or network card?
Message-Id: <855870902.1563.0@t1nw146.caiw.nl>

How can I use the "loop back" (127.0.0.1) in Windows 95
without dail up (i.e. connecting to my ISP) and without a
network card?

I want to use sockets.

Please reply by email, I'll post a summary.

Thanks in advance,

John Bokma


-------------------------------------------------------------------
Need a Freelance Software Developer?
Castle Amber - Software Development
Grondherendijk 11c
3082 DD Rotterdam (The Netherlands)
phone:  +31 10 4291827
email :  jbokma@caiw.nl
John's Cyber World: http://www.caiw.nl/~jbokma (Java demo's,
Curriculum Vitae and more...)



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

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

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 V7 Issue 943
*************************************

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