[7525] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1152 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 9 15:07:14 1997

Date: Thu, 9 Oct 97 12:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 9 Oct 1997     Volume: 8 Number: 1152

Today's topics:
     Compressing English Speech ? (code included) ssjaaa@hang-spam.uta.fi
     Coping with backslashes in Win32 Perl? <egodeath@geocities.com>
     Re: cpan modules and isp (Jason Gloudon)
     HELP: Is there a 'cb' for perl? <secdevc2@nortel.ca>
     Re: HELP: Is there a 'cb' for perl? <barnett@houston.Geco-Prakla.slb.com>
     Re: HELP: Is there a 'cb' for perl? (Faust Gertz)
     inheriting filehandles from Win32::Process::Create <reiter@research.att.com>
     Re: Lists of lists in Perl 4 (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: map in void context (was Re: $x = $y || $z - danger (Terry Michael Fletcher - PCD ~)
     Re: Module for dealing with INN spools. <rootbeer@teleport.com>
     Re: Perl Installation Question (Abigail)
     Perl script to delete old mail <dcradler@mods.com>
     perl scripts hangs while starting httpd server within o (Harald Falkenberg)
     regexp: matching at least n chars out of a string of le gtuckerkellogg@genetics.com
     Re: regexp: matching at least n chars out of a string o <barnett@houston.Geco-Prakla.slb.com>
     script for reading mail and saving it <ajb@plaza.ds.adp.com>
     striphtml gmichel@nais.com
     Re: Wanted: Wall/Schwartz book (1st ed) <flimm@ph-cip.uni-koeln.de>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 09 Oct 1997 21:34:15 +0300
From: ssjaaa@hang-spam.uta.fi
Subject: Compressing English Speech ? (code included)
Message-Id: <ptr3emaokew.fsf@uta.fi>


        Hi [ Please CC too if you can]

        I have a cellular phone where I can send the incoming email
        text as a short message. The maximum message size is 160
        characters, so I wanted to shorten the english text as much as
        possible.

        Please if you have more English language compress ideas, post
        them here or give your comments about the existing script.
        The esctipt must be Perl 4 compatible.

        Is there some English grammar rules I could take advantage
        of? Right now the ones I put there are only my experiences.

        Cheers!
        jari



#!/usr/local/bin/perl
#----------------------------------------------------------------------
sub ShortenEnglishText  {
    # DESCRIPTION
    #
    #   Compress english text by using simple substitutions
    #   and deletions.
    #
    # INPUT
    #   $line   line to compress.
    #
    # RETURN
    #

    local( $f ) = "$lib.Compress";
    local($_) = @_;

    local( $from, $to );

    local( %WORD_XLATE ) =          # Full word translations
    (
        "something" , "s'ng",
        "anything"  , "a'ng",
        "arguments" , "args",
        "work"      , "wrk",
        "project"   , "prj",
        "member"    , "mbr",
        "everytime" , "when",
        "managed"   , "mged",
    );


    # ........................................................ words ...
    # Delete whole words that are not essential.
    #

    s/\b(a|the|of|will|would|N\.B.)\b//ig;


    for $from ( keys %WORD_XLATE )
    {
        $to = ${WORD_XLATE};
        s/\b$from\b/$to/ig;
    }

    s/ing\b/ng/ig;

    # ..................................................... suffixes ...
    #   frequency = freq, acceptance = accept
    #   distance = dist
    #
    s/u?[ae]nc[ye]\b//ig;

    #   management, establishement
    #
    s/ement\b/nt/ig;

    #   allocation = allocatn
    #
    s/ion\b/n/ig;


    # ................................................. &multi-chars ...
    s/ph\b//ig;                 # paragraph --> paragra
    s/ph/f/ig;                  # photograph --> fotogra


    # .................................................. simple rules ...
    s/([0-9])+(st|nd|th)/$1/ig;  # get rid of 1st 2nd ...
    s/\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]+\b/$1/ig;

    #   "This is the end. And new sentence."  We can leave out the period.
    #
    s/\.\s+([A-Z])/$1/g;

    #   place :  here
    #   see - else
    #
    s/\s[-;:]\s//;

    #   we don't need these, note the deleted nouns. This also
    #   kills "my" --> "m" but you can guess the 'm' from the context
    #
    #
    s/[uy!#\$'\"*|\\^]//ig;

    s/(.)\1/$1/ig;              # Any double char to one char

    $_;
}



while (<>)
{
    print &ShortenEnglishText($_);

}

# end


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

Date: Thu, 09 Oct 1997 13:18:42 -0400
From: Steve Harvey <egodeath@geocities.com>
Subject: Coping with backslashes in Win32 Perl?
Message-Id: <343D11F2.4C1E@geocities.com>

I'm writing some maintainance scripts using Win32 Perl for our Netware
servers, which means I have to dereference all the backslashes when
referring to directory paths (i.e. I have to use '\\\\fs1\\sys\\foo'
instead of just '\\fs1\sys\foo')

My problem is with a subroutine which parses a list of pathnames,
read from a user-maintained text file.  The program chokes if I don't
dereference the backslashes, and I'd rather not make the
(perl-illiterate) users have to deal with the ugly syntax.  In other
words, if the program reads a line from the file:

        \\fs1\sys\foo

and assigns it to $pathname, I'd like to be able to do something like

        $pathname =~ tr/'\'/'\\'/;

in order to end up with the value '\\\\fs1\\sys\\foo' which the rest of
the program can digest for purposes of evaluation, output, etc...  I
have tried myriad combinations of weird quotes, but I have been unable
to get the substitute/translate/etc. operators to recognize the single
backslash in the original string for what it is.

Suggestions?


   Thanks,
     Steve


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

Date: 9 Oct 1997 18:13:48 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: cpan modules and isp
Message-Id: <61j6ss$b3f$1@daily.bbnplanet.com>

David Turley (dturley@rocketmail.com) wrote:
: Can anyone give me a hint on how one would use perl modules, that are not
: part of the standard distribution, without direct access to perl on the
: server. If we are stuck with using an ISP for web hosting, are we out of
: luck since we don't have access to perl's path configuration?

Did you look at the perlrun manpage ? PERLLIB and use lib, may solve 
your problem.

Jason Gloudon


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

Date: Thu, 09 Oct 1997 13:27:19 -0400
From: Anton Fernando <secdevc2@nortel.ca>
Subject: HELP: Is there a 'cb' for perl?
Message-Id: <343D13F7.41C9@nortel.ca>

hi there,
	I am looking for a perl beautifier similar to 'cb' for 
C. Any comments? does such thing exist?

Thankx

Anton Fernando
secdevc2@nortel.ca


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

Date: Thu, 09 Oct 1997 13:18:26 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: HELP: Is there a 'cb' for perl?
Message-Id: <343D1FF2.5981@houston.Geco-Prakla.slb.com>

Anton Fernando wrote:
> 
> hi there,
>         I am looking for a perl beautifier similar to 'cb' for
> C. Any comments? does such thing exist?
> 
Yes.  It does exist.  You can get it from www.perl.com, but I forget
where I was when I found it.

It works pretty well.  I haven't used it much yet, however.

:)

p.s. It's called "pb".  It was listed in its entirety in another posting
earlier today.....


-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
* Schlumberger Geco-Prakla   (281) 596-1434 (Office Number)            *
* 1325 S. Dairy Ashford      (281) 596-1807 (Fax)                      *
* Houston, TX 77077                                                    *
------------------------------------------------------------------------


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

Date: Thu, 09 Oct 1997 18:43:19 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: HELP: Is there a 'cb' for perl?
Message-Id: <343f23d4.1680924@news.wwa.com>

On Thu, 09 Oct 1997 13:27:19 -0400, Anton Fernando
<secdevc2@nortel.ca> wrote:

>hi there,

Hey, it's Freddie "Boom Boom" Washington! 

>	I am looking for a perl beautifier similar to 'cb' for 
>C. Any comments? does such thing exist?

I don't know what 'cb' is, but my guess is that your question is
similar to this Frequently Asked Question.

-------------Now is the time we quote from the FAQ-------------

Is there a pretty-printer (formatter) for Perl? 

There is no program that will reformat Perl as much as indent will do
for C. The complex feedback between the scanner and the
parser (this feedback is what confuses the vgrind and emacs programs)
makes it challenging at best to write a stand-alone Perl
parser. 

Of course, if you simply follow the guidelines in the perlstyle
manpage, you shouldn't need to reformat. 

Your editor can and should help you with source formatting. The
perl-mode for emacs can provide a remarkable amount of help
with most (but not all) code, and even less programmable editors can
provide significant assistance. 

If you are using to using vgrind program for printing out nice code to
a laser printer, you can take a stab at this using
http://www.perl.com/CPAN/doc/misc/tips/working.vgrind.entry, but the
results are not particularly satisfying for sophisticated
code. 

-------------Now is the time we quote from the manpages-------------

NAME 

perlstyle - Perl style guide 

DESCRIPTION 

Each programmer will, of course, have his or her own preferences in
regards to formatting, but there are some general guidelines
that will make your programs easier to read, understand, and maintain.


The most important thing is to run your programs under the -w flag at
all times. You may turn it off explicitly for particular portions
of code via the $^W variable if you must. You should also always run
under use strict or know the reason why not. The use
sigtrap and even use diagnostics pragmas may also prove useful. 

Regarding aesthetics of code lay out, about the only thing Larry cares
strongly about is that the closing curly brace of a multi-line
BLOCK should line up with the keyword that started the construct.
Beyond that, he has other preferences that aren't so strong: 

     4-column indent. 

     Opening curly on same line as keyword, if possible, otherwise
line up. 

     Space before the opening curly of a multi-line BLOCK. 

     One-line BLOCK may be put on one line, including curlies. 

     No space before the semicolon. 

     Semicolon omitted in ``short'' one-line BLOCK. 

     Space around most operators. 

     Space around a ``complex'' subscript (inside brackets). 

     Blank lines between chunks that do different things. 

     Uncuddled elses. 

     No space between function name and its opening parenthesis. 

     Space after each comma. 

     Long lines broken after an operator (except ``and'' and ``or''). 

     Space after last parenthesis matching on current line. 

     Line up corresponding items vertically. 

     Omit redundant punctuation as long as clarity doesn't suffer. 

Larry has his reasons for each of these things, but he doesn't claim
that everyone else's mind works the same as his does. 

Here are some other more substantive style issues to think about: 

     Just because you CAN do something a particular way doesn't mean
that you SHOULD do it that way. Perl is designed to
     give you several ways to do anything, so consider picking the
most readable one. For instance 

         open(FOO,$foo) || die "Can't open $foo: $!";

     is better than 

         die "Can't open $foo: $!" unless open(FOO,$foo);

     because the second way hides the main point of the statement in a
modifier. On the other hand 

         print "Starting analysis\n" if $verbose;

     is better than 

         $verbose && print "Starting analysis\n";

     because the main point isn't whether the user typed -v or not. 

     Similarly, just because an operator lets you assume default
arguments doesn't mean that you have to make use of the
     defaults. The defaults are there for lazy systems programmers
writing one-shot programs. If you want your program to be
     readable, consider supplying the argument. 

     Along the same lines, just because you CAN omit parentheses in
many places doesn't mean that you ought to: 

         return print reverse sort num values %array;
         return print(reverse(sort num (values(%array))));

     When in doubt, parenthesize. At the very least it will let some
poor schmuck bounce on the % key in vi. 

     Even if you aren't in doubt, consider the mental welfare of the
person who has to maintain the code after you, and who will
     probably put parentheses in the wrong place. 

     Don't go through silly contortions to exit a loop at the top or
the bottom, when Perl provides the last operator so you can exit
     in the middle. Just ``outdent'' it a little to make it more
visible: 

         LINE:
             for (;;) {
                 statements;
               last LINE if $foo;
                 next LINE if /^#/;
                 statements;
             }

     Don't be afraid to use loop labels--they're there to enhance
readability as well as to allow multi-level loop breaks. See the
     previous example. 

     Avoid using grep (or map) or `backticks` in a void context, that
is, when you just throw away their return values. Those
     functions all have return values, so use them. Otherwise use a
foreach loop or the system function instead. 

     For portability, when using features that may not be implemented
on every machine, test the construct in an eval to see if it
     fails. If you know what version or patchlevel a particular
feature was implemented, you can test $] ($PERL_VERSION in
     English) to see if it will be there. The Config module will also
let you interrogate values determined by the Configure
     program when Perl was installed. 

     Choose mnemonic identifiers. If you can't remember what mnemonic
means, you've got a problem. 

     While short identifiers like $gotit are probably ok, use
underscores to separate words. It is generally easier to read
     $var_names_like_this than $VarNamesLikeThis, especially for
non-native speakers of English. It's also a simple rule
     that works consistently with VAR_NAMES_LIKE_THIS. 

     Package names are sometimes an exception to this rule. Perl
informally reserves lowercase module names for ``pragma''
     modules like integer and strict. Other modules should begin with
a capital letter and use mixed case, but probably
     without underscores due to limitations in primitive file systems'
representations of module names as files that must fit into a
     few sparse bites. 

     You may find it helpful to use letter case to indicate the scope
or nature of a variable. For example: 

         $ALL_CAPS_HERE   constants only (beware clashes with perl
vars!)  
         $Some_Caps_Here  package-wide global/static 
         $no_caps_here    function scope my() or local() variables 

     Function and method names seem to work best as all lowercase.
E.g., $obj->as_string. 

     You can use a leading underscore to indicate that a variable or
function should not be used outside the package that defined
     it. 

     If you have a really hairy regular expression, use the /x
modifier and put in some whitespace to make it look a little less like
     line noise. Don't use slash as a delimiter when your regexp has
slashes or backslashes. 

     Use the new ``and'' and ``or'' operators to avoid having to
parenthesize list operators so much, and to reduce the incidence
     of punctuation operators like && and ||. Call your subroutines as
if they were functions or list operators to avoid excessive
     ampersands and parentheses. 

     Use here documents instead of repeated print statements. 

     Line up corresponding things vertically, especially if it'd be
too long to fit on one line anyway. 

         $IDX = $ST_MTIME;       
         $IDX = $ST_ATIME       if $opt_u; 
         $IDX = $ST_CTIME       if $opt_c;     
         $IDX = $ST_SIZE        if $opt_s;     

         mkdir $tmpdir, 0700 or die "can't mkdir $tmpdir: $!";
         chdir($tmpdir)      or die "can't chdir $tmpdir: $!";
         mkdir 'tmp',   0777 or die "can't mkdir $tmpdir/tmp: $!";

     Always check the return codes of system calls. Good error
messages should go to STDERR, include which program caused
     the problem, what the failed system call and arguments were, and
VERY IMPORTANT) should contain the standard system
     error message for what went wrong. Here's a simple but sufficient
example: 

         opendir(D, $dir)     or die "can't opendir $dir: $!";

     Line up your translations when it makes sense: 

         tr [abc]
            [xyz];

     Think about reusability. Why waste brainpower on a one-shot when
you might want to do something like it again? Consider
     generalizing your code. Consider writing a module or object
class. Consider making your code run cleanly with use
     strict and -w in effect. Consider giving away your code. Consider
changing your whole world view. Consider... oh, never
     mind. 

     Be consistent. 

     Be nice. 

-------------Now is the time we stop quoting-------------


HTH

Faust Gertz
Philosopher at Large


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

Date: Thu, 9 Oct 1997 18:19:54 GMT
From: Mike Reiter <reiter@research.att.com>
Subject: inheriting filehandles from Win32::Process::Create
Message-Id: <343D204A.167EB0E7@research.att.com>

Please respond to "reiter@research.att.com".

I'm using standard Perl 5.004 for Win32 on a Windows 95 machine.  I am
trying to use Win32::Process::Create to spawn a process from my "main"
program.  The call looks like this:

Win32::Process::Create($Process, 'c:\perl\bin\perl.exe',
			'perl c:\myprograms\child.pl',
			1, DETACHED_PROCESS, ".") or die "create: $!";

According to the docs, the "1" in the fourth argument enables the
child process to inherit all inheritable open handles from the
parent process, including I/O handles, socket handles, etc.  I can
verify that the child process is created, but I'm having trouble
making use of the filehandles that it supposedly inherits.  For
example, if before the above call the parent executes

	open TEST, ">test";

then a call like

	print TEST "This is a test.\n";

in the child apparently fails (the "test" file remains empty).  Can
anyone tell me what I'm doing wrong??

Many thanks in advance.  Please respond to "reiter@research.att.com".

- Mike Reiter


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

Date: Thu, 09 Oct 97 12:57:39 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Lists of lists in Perl 4
Message-Id: <343d0d76$2$ofn$mr2ice@speaker>

In <343CC542.41759187@bonn.netsurf.de>, on 10/09/97 at 12,
   Janning Vygen <Janning.Vygen@bonn.netsurf.de> said:
+-----
| How can I create a list of a list
| (=multidimensional array) in Perl 4?
+--->8

Upgrade to Perl5.

You can create a "list of lists" in Perl 4 by means of symbol table
manipulations:  create an anonymous list and insert its symbol table entry
into another list.  Doing so is a major pain and *accessing* it afterward is
even more of one.  (I used to do a lot of this; it got to be so much of a pain
that I switched languages until Perl5 stabilized.)

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: 9 Oct 1997 17:57:48 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: map in void context (was Re: $x = $y || $z - dangerous assumption?)
Message-Id: <61j5us$7g8$1@news.fm.intel.com>

Randal Schwartz (merlyn@stonehenge.com) so eloquently and verbosely pontificated:
> >>>>> "Terry" == Terry Michael Fletcher <tfletche@pcocd2.intel.com> writes:
> 
> Terry> i will take a little time after work to see if i can duplicate
> Terry> my tests.  i will have to change around some of the code to
> Terry> make it general.  i dont want to just *say* its faster without
> Terry> showing what i found.

ok.  the tests that i was doing a while back were actually testing
algorithms for parsing strings in fixed columns out of a file.  it was
more of a test benchmarking various algorithms of split, unpack, big
list-returning regex, and substr.  however, i had to use an inner and
outer "loop":  the outer was the list-returning function, and the inner
iterated through an existing array of strings, concatenating a new value
from the outer list on the end of the string.  i had to either use
for/for, map/for, for/map, or map/map (which would run into $_ problems).
it turned out that a map/for was fastest, mapping an anonymous array
(effectively a one value list) onto an inner block of a for loop.  map in
my test was *only* about 1% faster, but only on the one value list.  it
looked like this:

map { some /for(each)?/ loop here } [list-returning function];
vs. 
for $i ([list-returning function]) { same /for(each)?/ loop here }

the innner map or for loop were remarkably the same.  this realization is
explained by randal in that the C<for> loop has to dynamically create the
variable $i, which takes a little overhead that the map doesnt have to do,
and C<map> is only returning a one-value reference.  this block of code
was executed in my script for every line of the file (about 2000!), which
is a lot of local $i's.

> In the current implementation, the body of foreach is always doing
> less work than the body of map.  Map is *always* building a list, even
> in a void context.  The best possible timings from map, therefore, are
> when you consistently return a null list for each iteration.

i agree that /for(each)?/ should be faster, but i tried this for a general
case:

# @array was built from a 2000 line text file, and also from a 6000 line
# one as another test.
# the s/(.)/$1/g is simply something useless to consume some time.

for (@array) { s/(.)/$1/g }

# ran remarkably the same as:

map { s/(.)/$1/g } (@array);

# and:

@junk = map { s/(.)/$1/g } (@array);

> However, a foreach (as opposed to a foreach my) has to localize the
> control variable.  For a small number iterations, this localization
> time may dwarf the actual iteration time.  And map has to localize $_
> regardless.  There's no "map my $_" equivalent form.  (Chip, are you
> listening? :-)

dangit.  im not on a system that i can test 5.004 on right now.  i
would hope that /for(each)?/ my is faster, or something else unknown must
be going on.

> A void use of grep, on the other hand, is relatively fast, because
> it's merely building a simple array from the scalars of the list being
> scanned (not from a newly created expression).  Again, returning false
> keeps this list from being extended, so it'd be faster.

hmm, didnt try grep since i assumed it would be slower.  something else
fun to do after work :-)

> So, I'd say in speed (knowing a little behind the scenes), from
> fastest to slowest, it'd be:
> 
> 	foreach my $x
> 	foreach $x
> 	grep returning false
> 	grep returning true/false
> 	map returning ()
> 	map returning other

i'd love to see these, someone think they can try it before randal lands?
:-)

my tests could probably be discarded for something that i have overlooked,
even though i ran them on the same server at the same time, and used
'repeat 20 timex bench.pl' to time them.  hopefully someone can run a more
accurate and systematic benchmark.

-- 
#!/usr/local/bin/perl -w
@"=(qw; P ;,q*e*,qq,r,,q;l;);$_=<<'/\<<$_; :-) \' ^/<\'<>/\'$!=0/\'/<&@_';
^[^a-i*#,k-z@&]u[s,*]t$ ^[]/$%a!&]*not*\(anything\)*here*$ ^p[$_r%,.]i*nt$
[^hi]?[]MOM!#]$ #  tfletche@pcocd2.intel.com  # ^h*[^b$d-j%/,l-z(]\{3\}er$
/\<<$_; :-) ' ^/<'<>/'$!=0/'/<&@_
for(split){map{s;print;join"",@";eg;chop;print}q& &.qx;look -r '$_';}# TMF


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

Date: Thu, 9 Oct 1997 10:54:01 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Doug Seay <seay@absyss.fr>
Subject: Re: Module for dealing with INN spools.
Message-Id: <Pine.GSO.3.96.971009105257.28404C-100000@usertest.teleport.com>

On Thu, 9 Oct 1997, Doug Seay wrote:

> For you young-uns, "rn" is another fine product from Larry Wall.  Has he
> ever gotten back to his project of redoing it in Perl?

Larry says:

    rn:
        There are various derivatives being supported by various people.
        None of them are me.

:-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 9 Oct 1997 16:56:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Installation Question
Message-Id: <slrn63q3a1.a8i.abigail@betelgeuse.rel.fnx.com>

Tom Phoenix (rootbeer@teleport.com) wrote on 1500 September 1993 in
<URL: news:Pine.GSO.3.96.971009072757.23840F-100000@usertest.teleport.com>:
++ On Wed, 8 Oct 1997, delazzer wrote:
++ 
++ > A friend gave me a tar file that has Perl 5.004_03. The Perl web page
++ > says 5.004_01 is the latest version. Is 5.004_03 the latest or is
++ > 5.004_01? 
++ 
++ _01 is the latest released version; _03 has not been officially released
++ (as I understand things). For most people, there's no real difference
++ between the two; just a few bug fixes for things you're not likely to
++ notice. :-)
++ 
++ > Is it ok to install a newer version of Perl even when there is an older
++ > version in my PATH? 
++ 
++ Yes. In fact, it's normal to keep the older binary around, under a name
++ like /usr/local/bin/perl5.003, which allows you to run that binary if you
++ discover a problem with the new one.

Yeah, ok, you have the binary around. Just too bad a default install has
erased your core modules and man pages. You'd need to install each new
release of perl in a different lib (/usr/local/lib/perl5.00401, etc) -
and that will make it harder to keep your site modules to be included.



Abigail


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

Date: Thu, 09 Oct 1997 11:33:35 -0700
From: Dan Cradler <dcradler@mods.com>
Subject: Perl script to delete old mail
Message-Id: <343D237F.76C3@mods.com>

Does anyone know of a script to delete all mail older than a certain
date from all unix mail inboxes? I am in need of such a script to
implement a company policy and am hoping I don't need to start from
scratch. I am fairly new to Perl but experienced in C and sh so any
suggestions would be helpful.

--------------------------------------------------------------------------
Dan Cradler                                               Modern
Solutions
dcradler@modernsolutions.com               Full-Service Web Space
Provider
702-323-3341                                          
http://www.mods.com


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

Date: 09 Oct 1997 17:08:36 GMT
From: hfalken@x4u2.desy.de (Harald Falkenberg)
Subject: perl scripts hangs while starting httpd server within other script
Message-Id: <HFALKEN.97Oct9190836@x4u2.desy.de>

>From a Perl script I start another shell script, which sets up a httpd server.
This shell script executed directly on shell works well and comes back with the
normal prompt. Within a Perl script the execution stucks at that point
of starting the httpd server. 

Whats going wrong? The server I start is the Apache server. Does it change 
the state and looses the connection to his mother process? So how can I 
switch off that the mother process waits till all her child process terminted?

For any hint to solve this problem I would be very glad.

Please mail me: harald.falkenberg@desy.de


Gcc: nnfolder+archive:misc-news 
--text follows this line--



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

Date: Thu, 09 Oct 1997 12:23:36 -0600
From: gtuckerkellogg@genetics.com
Subject: regexp: matching at least n chars out of a string of length m
Message-Id: <876416222.32513@dejanews.com>

I have	a collection of strings which contain many occurances of the
character ':'.	I'd like to know, for each string, all the substrings of
length $window than contain $want colons.

I've been thinking along the lines of

$window = 30;
$want = 20;

foreach $string (@stringlist) {
  my $i;
  my $result = "";
  for (i=0;i<length($string)-$window; $i++) {
    my $substring = substr($string,$i,$window);
    if ($substring =~ /some_magical_regexp/) {
#            stuff the results into $result;
            substr($result,$i,1) = "1";
    }
  }
}

but I can't seem to figure out the right regexp.  Am I barking up the
wrong tree?

Thanks,

Greg

Disclaimer: the statements above are my own.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Thu, 09 Oct 1997 13:27:27 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: regexp: matching at least n chars out of a string of length m
Message-Id: <343D220F.5656@houston.Geco-Prakla.slb.com>

gtuckerkellogg@genetics.com wrote:

 > $window = 30;
 > $want = 20;
 > 
 > foreach $string (@stringlist) {
 >   my $i;
 >   my $result = "";
 >   for (i=0;i<length($string)-$window; $i++) {
 >     my $substring = substr($string,$i,$window);
*>     if ($substring =~ /some_magical_regexp/) {
|> #            stuff the results into $result;
|>             substr($result,$i,1) = "1";
|>     }
|>   }
|> }
|> 
|> but I can't seem to figure out the right regexp.  Am I barking up the
|> wrong tree?
|
|  How about:
|--> if ($substring =~ /:{$want,}/) {

This should find at least $want occurrences of the previous character...
: in this case.



-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
* Schlumberger Geco-Prakla   (281) 596-1434 (Office Number)            *
* 1325 S. Dairy Ashford      (281) 596-1807 (Fax)                      *
* Houston, TX 77077                                                    *
------------------------------------------------------------------------


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

Date: 9 Oct 1997 17:53:44 GMT
From: "Andrew Bishop" <ajb@plaza.ds.adp.com>
Subject: script for reading mail and saving it
Message-Id: <01bcd4dc$6bee3c40$90a07e8b@opi.plaza.ds.adp.com>

Hi,
I want to write a script which does the following-
It checks the specified mailbox (other than the default one) for mail and
saves the first message from it into a file and then deletes that
particular msg from the mailbox.Iam having problems with mail & mailx as
they are both interactive .....
 Any suggestions...

Thanks in anticipation
mrudula



e-mail mrudula@plaza.ds.adp.com


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

Date: Thu, 09 Oct 1997 13:01:32 -0600
From: gmichel@nais.com
Subject: striphtml
Message-Id: <876419479.3983@dejanews.com>

We recently upgraded our server from 5.003 to 5.004 and now Tom
Christiansen's striphtml.pl script fails.  It appears to
be a problem with the second regex (truncated here):

s{<([^>'"]*|".*?"|'.*?')+>}{}gsx;

Specifically, the "+" appears to cause an error.  Anyone see similar
behavior?

George Michel
gmichel@nais.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 09 Oct 1997 19:54:02 +0200
From: Oliver Flimm <flimm@ph-cip.uni-koeln.de>
Subject: Re: Wanted: Wall/Schwartz book (1st ed)
Message-Id: <vc6n2ki3jr9.fsf@thorin.middleearth.de>

Hi,

Tom.Grydeland@phys.uit.no (Tom Grydeland) writes:
> (And I'm *still* waiting for the panther book9 to appear in Tromsx.
> Grumble, grumble)

I got my panther book here in germany on 16.9. - and I like it a lot ;-) 

> 9 it *is* a panther, isn't it?

Yes it is. It's a black leopard, often called "black panther", as
stated in the colophon.

Regards,

Oliver

-- 
Oliver Flimm                    Email: flimm@ph-cip.uni-koeln.de
CipLab, Institutes of Physics          flimm@ub.uni-koeln.de, flimm@guug.de
Cologne, Germany                WWW  : http://www.ph-cip.uni-koeln.de/~flimm


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

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

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