[7932] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1557 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 31 13:09:28 1997

Date: Wed, 31 Dec 97 10:00:25 -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           Wed, 31 Dec 1997     Volume: 8 Number: 1557

Today's topics:
     'flock'ing <tcm@tcmd.com>
     Re: 'flock'ing <reibert@mystech.com>
     Re: CGI y comandos SSI <Clinton.Bodine@mci.com>
     GDBM_File <jims@online-marketing.com>
     Re: importing subroutines <dev@sgi.net>
     Re: misterious context <ajohnson@gpu.srv.ualberta.ca>
     Re: Newbie question <reibert@mystech.com>
     Re: Perl compiler (Reini Urban)
     Re: Perl editor needed (James Hurd)
     Re: Perl for Win32 under NT, IIS3, client is a mac! (Nick Kew)
     Re: Perl Resource Kit - UNIX Edition or wait for WIN 32 scott@softbase.com
     Re: Perl5 on NT4 with IIS4 scott@softbase.com
     Putting a Caret in My Unix Prompt Capitalizes the Next  (Kevin M Simonson)
     reading in passwords <dev@sgi.net>
     s without regexp <bill@bill.co.uk>
     Re: s without regexp <bill@bill.co.uk>
     Re: s without regexp (brian d foy)
     Re: SHELL/REGEX GUNSLINGERS NEEDED!!! <Chris@iifs.iisc.co.uk>
     Re: Sorting files (Bennett Todd)
     SSI and FrontPage98 under IIS3 <moises@texas.net>
     Stripping non-alphanum's from within string? hagani@worldnet.att.net
     Re: Stripping non-alphanum's from within string? (brian d foy)
     Re: Stripping non-alphanum's from within string? <mwc@shell16.ba.best.com>
     Re: Tech writer lifts burden from programmers <friedman@uci.edu>
     Re: Tech writer lifts burden from programmers (brian d foy)
     Re: The To-Do List ??? <jdporter@min.net>
     timing subroutines <dev@sgi.net>
     Re: timing subroutines (brian d foy)
     Re: undefined value <dballing@speedchoice.com>
     Re: word wrap routine (Gabor)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 31 Dec 1997 10:11:44 -0500
From: "Ernie Johnson" <tcm@tcmd.com>
Subject: 'flock'ing
Message-Id: <68dmup$lj9$1@nr1.toronto.istar.net>

I've read some past posts on file locking and the general suggestion seems
to be utilize flock if its available... (our program is running on a linux
system - yes its a web app - and the server is apache)

after following some flock implemenations I set it into use, but within a
few hours, had erased data...

my code follows this pattern:

open file
read data
close file

do other stuff here

open the file
flock handle,2
write new data
close file


I understand its not "good" to close the flock, just let close handle the
flushing, unlock and close.

My question is, using this, why would I still have lost data?  The program
is simply reading a file, adding a line to it and resaving it.

Thanks!

Please cc replies to tcm@tcmd.com if convenient.



Ernie Johnson





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

Date: Wed, 31 Dec 1997 09:27:57 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: 'flock'ing
Message-Id: <34AA728D.A540F160@mystech.com>

Ernie Johnson wrote:

> I've read some past posts on file locking and the general suggestion seems
> to be utilize flock if its available... (our program is running on a linux
> system - yes its a web app - and the server is apache)
>
> after following some flock implemenations I set it into use, but within a
> few hours, had erased data...
>
> my code follows this pattern:
>
> open file
> read data
> close file
>
> do other stuff here
>
> open the file
> flock handle,2
> write new data
> close file

The problem is that, *between* the open and the flock, another process may
have written to the file. You need to make sure that you are actually at the
end of the file when you append. The Camel has an example on page 166 -
something like:

open the file
flock handle, 2        # now you're in control
seek handle, 0, 2    # so make sure you're really at the end
write new data
close file

> I understand its not "good" to close the flock, just let close handle the
> flushing, unlock and close.

Absolutely!

HTH-----------------------------   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Wed, 31 Dec 1997 15:33:03 GMT
From: Clinton Bodine <Clinton.Bodine@mci.com>
Subject: Re: CGI y comandos SSI
Message-Id: <34AA6569.698332C3@mci.com>

I personally welcome non-English questions.  Unfortunately, I don't have a
grasp of any other language except for a little German.  Could someone
translate this question for us?

NICOLAS wrote:
> 
> Pregunta:
> Para hacer que un CGI se ejecute automaticamente al cargar una pagina WEB
> se consigue, mediante el uso de comandos SSI,  de la forma:
> 
> <!--#EXEC CGI="cgi-bin/fichero.cgi"-->
> 
> el problema es que el 'fichero.cgi' requiere un parametro y al hacer la
> llamada de la forma:
> 
> <!--#EXEC CGI="cgi-bin/fichero.cgi?parametro"-->
> 
> da un mensaje de error
> 
> ?Como se puede pasar un parametro al CGI ?
> ?Existe otra forma de hacer que se auto-ejecute el CGI al cargar la pagina
> WEB?
> 
> Gracias por vuestra ayuda y Feliz 1998

-- 
Clinton Bodine
Email: Clinton.Bodine@mci.com


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

Date: Wed, 31 Dec 1997 10:13:31 -0500
From: Online Marketing Company <jims@online-marketing.com>
Subject: GDBM_File
Message-Id: <34AA611B.3FA6@online-marketing.com>

The camel book describes the module GDBM_File, but this module is not in
the CPAN 07_Database_Interfaces section, with the others.

I mostly concerned if official support for the GDBM libraries has been
pulled.  Can someone please let me know?

Thanks,

Jim Schueler
USWeb


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

Date: Wed, 31 Dec 1997 17:25:00 GMT
From: "Devin P. Anderson" <dev@sgi.net>
Subject: Re: importing subroutines
Message-Id: <34AA8090.2DD9@sgi.net>

John Tannahill wrote:
> 
> I have just spent quite a while trying to figure out how to call a perl
> subroutine that is
> in one file from a perl program in another file.  I have tried various
> "use" commands,
> but I keep getting the following error message:
> 
> Undefined subroutine &main::seait ...
> 
> There must be a simple way to do what I want?
> 
> Thanks,
> John Tannahill

Try this:

push(@INC, "/directory/location/of/other/file");
require 'filename.pl';

Only put the directory that the file is located in into the push
statement.

Also be sure to have a '1; #return true' as the last line of the other
file so that when it reads it in it returns true back to the orginal
script.

For your reference, the 'use' statement is for modules which are usually
located in something like 'usr/local/lib/perl5'.

Hope that helps!

later-

 
---                                                                @				
Devin P. Anderson                           Happy Holidays         * * 	
Webmaster, Systems Administrator                from              * ' *
Stargate Industries, Inc.                 Network Operations     * ',` *
http://www.sgi.net/                                             *',  `,
*
Phone: 412.930.STAR (7827) ext. 241                           
***********
F a x: 412.930.7110                                                ***
                                                                && ***
&&	
                                                         
#=#=#=#=#=#=#=#=#=#=#

"Prehaps today *is* a good day to die. Ramming speed."
		-Lt. Worf

-----PGP PUBLIC KEY AVAILABLE-----


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

Date: Wed, 31 Dec 1997 00:08:03 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: misterious context
Message-Id: <34A9E143.D5F3897@gpu.srv.ualberta.ca>

Cho SangWook wrote:
!
! Hi, all!
! I'm rather new to Perl.
! The scalar and list context are somewhat confusing to me.
! I thought that I understood each context, but I failed to
! understand the following code. It originated from page 116 from
! Programming Perl book.
! 
! Suppose
! %foo = (f => 1, g => 'abc', h => 3, i => '21a');
! while ($k = each %foo) {
!     print "key = $k\n";
! }
! 
! I thought that above code had to print 1, abc, 3, 21a in random
! order. But I was wrong.
! It printed keys instead.
! "each" returns two elements list consisting of key and value pairs.
! 
! But
! $x = (4, 5, 6);
! print "$x\n";
! 
! prints 6 and
! @x = (4, 5, 6);
! $x = @x;
! print "$x\n";
! 
! prints 3.
! 
! From these I guessed that the topmost code had to print the values
! of hash.
! What's wrong with my understanding?
! Can anybody explain to me?
! Thanks in advance.

it does seem odd, unless you read the latest perlfunc manpage
for the each function which tells you that it behaves
differently in scalar context (not returning a two element
list):

[danger:ajohnson:~]$ perldoc -f each
=item each HASH

When called in a list context, returns a 2-element array consisting of the
key and value for the next element of a hash, so that you can iterate over
it.  When called in a scalar context, returns the key for only the next
element in the hash.  (Note: Keys may be "0" or "", which are logically
false; you may wish to avoid constructs like C<while ($k = each %foo) {}>
for this reason.)
(rest of each() description snipped)

regards
andrew


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

Date: Wed, 31 Dec 1997 08:54:55 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Newbie question
Message-Id: <34AA6ACF.59018684@mystech.com>

Blaine Owens wrote:

> I have a perl script which reads a file and parses out particular fields to
> produce a report. One of the fields is like "(45.0%)" but I would like for
> it to be just "45.0" in the report. What is the best way to strip the
> leading "(" and the trailing "%)"? Thanks.

Let's assume the field is in the variable $token, as in

$token = "(45.0%)";

Then, any of the following will strip as desired:

$token =~ s/^\((.*?)%\)$/$1/;    # probably slow due to the minimal match
$token =~ s/^\(([^%]*).*/$1/;    # should execute faster

Or, use the following two statements for clarity:

$token =~ s/^\(//;
$token =~ s/%\)$//;

HTH
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Wed, 31 Dec 1997 17:16:57 GMT
From: rurban@xarch.tu-graz.ac.at (Reini Urban)
Subject: Re: Perl compiler
Message-Id: <34aa7b81.111232093@judy>

Tom Christiansen <tchrist@mox.perl.com> wrote:
>I think it's time that someone explain just exactly what this thing is
>really doing.

How Perl2exe works in my opinion:

It copies all required files together with a small win32-exe stub that
copies all to %TEMP% and calls the script there with 
%TEMP%\perl <scriptname>.pl arguments..
and deletes it afterwards.

Errors: 
if you include packages like for example
package Net::Ping;

then perl looks for a directory called Net but this is not created in
the packaging step. so you have to manually change all packages to
something like
package Net_ping;

rename Net\ping.pm to net_ping.pm
and package this.
So you may say that packages are NOT supported.

Some troubles for professionals who want to hide their perl code:
1) The complete source code is in the exe, neither encrypted nor
compressed.
2) If you press <Pause> during the script evaluation, the whole stuff is
visible at %temp%

so there you have your source code if you need it.


--                                         Reini Urban
AutoCAD stuff at   http://xarch.tu-graz.ac.at/autocad/


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

Date: 31 Dec 1997 15:11:35 GMT
From: jhurd@indiana.edu (James Hurd)
Subject: Re: Perl editor needed
Message-Id: <68dnb7$p0n$1@dismay.ucs.indiana.edu>

Distribution: 

scott@softbase.com wrote:
	(snips)
 
: Emacs is the best all around editor for programming.  Its drawback is
: you have to learn how to use it, which puts off a lot of people who
: don't want to bother with this kind of thing. Learning Emacs is a good
: investment in your programming career, though, since it is available on
: most platforms and has an unmatched degree of advanced editing.
: 

	When I first began writing Perl and Java, I resisted
 learning Emacs.When I finally broke-down andd beganb toi learn it; 
 it made things so much easier.

James Hurd
UITS Support Center
Intel Support
Indiana University


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

Date: Wed, 31 Dec 1997 02:03:31 +0000
From: nick@webthing.com (Nick Kew)
Subject: Re: Perl for Win32 under NT, IIS3, client is a mac!
Message-Id: <j59c86.o11.ln@jarl.webthing.com>

In article <34A96C72.D28D53E6@concentric.net>,
	"Lon F. Binder" <vex1@concentric.net> writes:
> I seem to be having a problem with one of my customers.
> (chop) 
>      You have started to dowload the file "phonesend.pl", of type
>      "application/octet-stream".

You have a broken CGI script that will fail with _any_ HTTP-compliant
browser.  I guess all the other would-be customers who had the problem
just went away again.

> Does anyone recognize this problem, or have any suggestions?

Get a programmer.

Or do it yourself.  cg-eye (<URL:http://www.htmlhelp.org/tools/cg-eye/>)
will tell you what's wrong.  Don't use Microsoft for web development;
they ignore too many of the specs they pay lip service to (and the rest
of us work to).

-- 
Nick Kew
WebThing virtual office: personal and groupware desktop on the Web
Mail Client, Mail Server, Calendar Server, FileServer, Conferencing
- <URL:http://www.webthing.com/>


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

Date: 31 Dec 1997 16:59:12 GMT
From: scott@softbase.com
Subject: Re: Perl Resource Kit - UNIX Edition or wait for WIN 32 Edition?
Message-Id: <68dtl0$m96$2@mainsrv.main.nc.us>

>  Should I buy the Perl Resource Kit UNIX Edition or wait for the WIN 32
>  Edition?

If you're using Windows, WAIT!!!

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: 31 Dec 1997 16:59:57 GMT
From: scott@softbase.com
Subject: Re: Perl5 on NT4 with IIS4
Message-Id: <68dtmd$m96$3@mainsrv.main.nc.us>

Mario Abela (mario.v.abela@magnet.mt) wrote:

> Can anyone help me setting up Perl5 to run under IIS4 on NT or from where I
> can get the info to set it up?

I tried on and off for about six months to get Perl scripts
to work on an NT server, and gave up and put an Apache
server on a UNIX box just to handle CGI.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: 31 Dec 1997 16:27:28 GMT
From: simonsen_nospam@skopen.dseg.ti.com (Kevin M Simonson)
Subject: Putting a Caret in My Unix Prompt Capitalizes the Next Character
Message-Id: <68drpg$hr4@sf18.dseg.ti.com>
Keywords: caret capitalize

     I have seen some software people who use the standard Unix prompt and
others who customize that prompt to include so much information that the
prompt takes up almost eighty columns.  For a long time I've been happy
with a compromise; my customized prompt contains an abbreviation that iden-
tifies the machine I'm working on and also contains the name of the direc-
tory I'm in and the name of its parent directory.

     When I first got this prompt working, I created it by way of a C pro-
gram.  This has always been a little inconvenient when starting things up
on a new system, since I had to compile the C program before I could do
anything that would change my prompt.  It's been _really_ inconvenient now
because I'm working on projects that have me regularly changing between
three operating systems, none of which can execute a C program compiled on
one of the other two operating systems.

     Once I learned "perl", I began to wonder if an answer to several of my
problems would be to create the prompt with a "perl" script.  I've now made
that change, and life is considerably easier for me.

     Just one thing troubles me.  Previously I had separated the hostname-
abbreviation from the rest of the prompt with a caret ("^").  I've disco-
vered that if I do that with my "perl" script I don't get the results I
want.  To simplify the problem, please assume that what I want is a prompt
of the form "a^g: ".  To do this I create the following "perl" script and
                             set the prompt with the command:
,---Simple-------------.
|#!/usr/local/bin/perl |          set prompt = `~simonson/Perl/Simple`" "
|print "a^g:"          |
`----------------------'     On my machine when I do this I get the fol-
                             lowing results:

          oas~h/simonson/Perl} cat Simple
          #!/usr/local/bin/perl
          print "a^g:"
          oas~h/simonson/Perl} set prompt = `~simonson/Perl/Simple`" "
          a^G:

     The thing that's been bothering me is the capital 'G' from the small
'g'.  Anybody know why this is happening?  Or how I can make it stop hap-
pening?

     I found that if I replace the caret with a tilde I don't get the same    
problem.  That's the work-around I'm currently using, but personally I
think a caret looked better, and would like to change back to it.

     I guess there's another thing that's worth looking into.  Here I'm us-    
ing the "perl" script indirectly.  Is there a way to set my prompt from
within the "perl" script, instead of reverting to a Unix call that refer-
ences a "perl" script, as I'm doing above?  Any information on either of
these questions would be greatly appreciated.

                                     ---Kevin Simonson
 -------------------------------------------------------------------------
     Reverence                   To send me mail, remove "_nospam" and
     the eternal.                all the vowels from my login name.


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

Date: Wed, 31 Dec 1997 15:22:07 GMT
From: "Devin P. Anderson" <dev@sgi.net>
Subject: reading in passwords
Message-Id: <34AA63C5.3E80@sgi.net>

How can you read from STDIN and not display what is being typed on the
screen? Like a password. Is this possible though a socket?

Please cc any resonse to dev@sgi.net.

Thanks!!

---                                                                 @				
Devin P. Anderson                           Happy Holidays         * * 	
Webmaster, Systems Administrator                from              * ' *
Stargate Industries, Inc.                 Network Operations     * ',` *
http://www.sgi.net/                                             *',  `,
*
Phone: 412.930.STAR (7827) ext. 241                           
***********
F a x: 412.930.7110                                                ***
                                                                && ***
&&	
                                                         
#=#=#=#=#=#=#=#=#=#=#

"Prehaps today *is* a good day to die. Ramming speed."
		-Lt. Worf

-----PGP PUBLIC KEY AVAILABLE-----


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

Date: Wed, 31 Dec 1997 15:03:41 +0000
From: "$Bill Dossett" <bill@bill.co.uk>
Subject: s without regexp
Message-Id: <34AA5ECD.DE2A620C@bill.co.uk>

Hi,

I've run into something strange.  I'm using latest perl
my script reads a string from a file into $s_t_r so

$s_t_r = "../" ;

then when I want to substitute this string with another

$ws =~ s/$s_t_r/"the new string"/ ;

the first occurance of any two chars and /
is matched rather than the ../ I am looking for.

I haven't been able to find a way to make
s/PATTERN/SUBSTITUTE/  not process
PATERN as a regular expression, but literally.

Sorry if this is beign stupid, but I haven't run into
this before.

Thanks,

Bill





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

Date: Wed, 31 Dec 1997 15:48:36 +0000
From: "$Bill Dossett" <bill@bill.co.uk>
Subject: Re: s without regexp
Message-Id: <34AA6954.4CB2EDED@bill.co.uk>

Found \Q
sorry for the bother..

Bill



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

Date: Wed, 31 Dec 1997 11:25:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: s without regexp
Message-Id: <68dr8s$j0f@bgtnsc03.worldnet.att.net>
Keywords: just another new york perl hacker

In article <34AA5ECD.DE2A620C@bill.co.uk>, bill@bill.co.uk posted:

 
> $ws =~ s/$s_t_r/"the new string"/ ;

> I haven't been able to find a way to make
> s/PATTERN/SUBSTITUTE/  not process
> PATERN as a regular expression, but literally.

* quote the metacharacters using quotemeta

   $s_t_r = quotemeta($s_t_t);
   $ws =~ s/$s_t_r/"the new string"/;
   
* quote the metacharacters using \Q and \E inside the s///

   $ws =~ s/\Q$s_t_r\E/"the new string"/;


good luck :)

-- 
brian d foy                                 <http://computerdog.com>


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

Date: Wed, 31 Dec 1997 15:55:52 +0000
From: Chris Hall <Chris@iifs.iisc.co.uk>
To: Rholder@sispost1.bis.adp.com
Subject: Re: SHELL/REGEX GUNSLINGERS NEEDED!!!
Message-Id: <34AA6B08.73663811@iifs.iisc.co.uk>

Rholder@sispost1.bis.adp.com wrote:
> 
> I want to store regular expressions in one file, and then use a
> shell script to read them into a shell variable within a "for" loop,
> and then feed the expression into egrep via the shell variable.
> 
> I'm doing this under Solaris 2.5.1.
> 
> Here is my script:
> [snip]

As has already been posted, the problem is the single quotes are inside the
variable REGEX and not outside it.

This script does though create 13 processes, ps is notoriously slow and is
called three times, try:

    ps -whatever | awk -F' '
'/(dataserver).*(miler)+|(dataserver).*(citys)+|(dataserver).*(demo)+/ { print
$1 }'

-- 
Chris.


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

Date: Wed, 31 Dec 1997 16:43:08 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: Sorting files
Message-Id: <slrn6akthb.epq.bet@ritz.mordor.net>

Randal wrote:
> @ARGV = sort { -M $b <=> -M $a } @ARGV;
and then mentioned you'd wanna do a Schwartzian transform on it if you were
going to sort more than a handful of files. The transform looks like

	@ARGV = map { $_->[0] }
	        sort { $a->[1] <=> $b->[1] }
		map { [ $_, -M ] } @ARGV;

or thereabouts. How you get from one to another, and why you might want to,
is explained in wonderful detail in Tom Christiansen's tract ``Far More Than
Everything You've Ever Wanted to Know About Sorting'', available at either of

    <URL:http://perl.org/CPAN/doc/FMTEYEWTK/sort.html>
    <URL:http://perl.com/CPAN/doc/FMTEYEWTK/sort.html>

(if one's slow or dead, try the other).

-Bennett


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

Date: 31 Dec 1997 15:37:09 GMT
From: "Moises G. Solis" <moises@texas.net>
Subject: SSI and FrontPage98 under IIS3
Message-Id: <01bd15cf$b0f37240$7f067fce@genesis>

I don't know where to turn for help.   Please point me in the right
direction.

I'm trying to execute a perl script from within an HTML page using SSI.  
The goal is to use a FP theme while providing the document content from a
perl script.  This will allow me to use the existing page theme without
having to code it within my perl script.

Is there a FAQ somewhere?

I've tried numerous things to no avail.

Thanks in advance.

Moises.


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

Date: Wed, 31 Dec 1997 17:10:52 GMT
From: hagani@worldnet.att.net
Subject: Stripping non-alphanum's from within string?
Message-Id: <68du0h$m4c@bgtnsc02.worldnet.att.net>

Anyone know how to accomplish this seemingly simple and common task?

Let's say I have:  $string = "P#E!$R-  L"

I'd like to remove all non-alphanumerics, the result being:
		$string = "PERL"

I've tried   $sting =~ s/\W//g;  but this doesn't seem to work
properly (it strips some of the letters too!)

Thanks!






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

Date: Wed, 31 Dec 1997 12:27:19 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Stripping non-alphanum's from within string?
Message-Id: <68dusq$6dq@bgtnsc03.worldnet.att.net>
Keywords: just another new york perl hacker

In article <68du0h$m4c@bgtnsc02.worldnet.att.net>, hagani@worldnet.att.net posted:

> Let's say I have:  $string = "P#E!$R-  L"
> 
> I'd like to remove all non-alphanumerics, the result being:
>                 $string = "PERL"

have you tried a negated character class?

   s/[^a-zA-Z0-9]//g;

good luck :)

-- 
brian d foy                                 <http://computerdog.com>


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

Date: 31 Dec 1997 17:31:52 GMT
From: Matthew Clarke <mwc@shell16.ba.best.com>
Subject: Re: Stripping non-alphanum's from within string?
Message-Id: <68dvi8$r9n$1@nntp2.ba.best.com>

hagani@worldnet.att.net wrote:
> Anyone know how to accomplish this seemingly simple and common task?

> Let's say I have:  $string = "P#E!$R-  L"

> I'd like to remove all non-alphanumerics, the result being:
> 		$string = "PERL"

> I've tried   $sting =~ s/\W//g;  but this doesn't seem to work
> properly (it strips some of the letters too!)

> Thanks!


Try doing a print $string before you do the substitution,
you may not have the string you think you have.  For
instance, that $R in the string above would be treated as
a null variable, thus removing the R from your resulting
string.

-Matt


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

Date: 31 Dec 1997 14:58:18 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: Tech writer lifts burden from programmers
Message-Id: <68dmib$ffp@news.service.uci.edu>

[mailed, posted]

In article <68agul$gq4@dfw-ixnews9.ix.netcom.com>,
James C. Hoffman  <tdsjms@ix.netcom.com> wrote:
<Hi-I'm a technical writer that can help you with your online help systems and

I'd be pretty reluctant to engage a writer who can't differentiate
between "that" and "who."

One style guide I've got lying around says, "who refers to people, and
that and which refer to animals and things.  That may also be used to
refer to an anonymous group of people."

-- 
Eric D. Friedman
friedman@uci.edu


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

Date: Wed, 31 Dec 1997 11:30:51 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Tech writer lifts burden from programmers
Message-Id: <68driu$j0f@bgtnsc03.worldnet.att.net>
Keywords: just another new york perl hacker

In article <68dmib$ffp@news.service.uci.edu>, "Eric D. Friedman" <friedman@uci.edu> posted:

> In article <68agul$gq4@dfw-ixnews9.ix.netcom.com>,
> James C. Hoffman  <tdsjms@ix.netcom.com> wrote:
> <Hi-I'm a technical writer that can help you with your online help systems and
> 
> I'd be pretty reluctant to engage a writer who can't differentiate
> between "that" and "who."
> 
> One style guide I've got lying around says, "who refers to people, and
> that and which refer to animals and things.  That may also be used to
> refer to an anonymous group of people."

maybe he's using the same style guide and making a statement about his
estimation of himself.

-- 
brian d foy                                 <http://computerdog.com>
uses 'who' for animals - even dogs.


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

Date: Wed, 31 Dec 1997 11:35:40 -0500
From: John Porter <jdporter@min.net>
Subject: Re: The To-Do List ???
Message-Id: <34AA745C.2F0B@min.net>

John Porter wrote:
> 
> I'm sorry but I just can't seem to find the Perl "To-Do List" on
> perl.com or my local CPAN site.
> 
> Does it still exist!?  What is its canonical location?
> 
> 'Thanks' x 1_000_000;
> John Porter
> jporter@logicon.com

It's in the top-level directory of the distribution, ya moron!


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

Date: Wed, 31 Dec 1997 15:20:13 GMT
From: "Devin P. Anderson" <dev@sgi.net>
Subject: timing subroutines
Message-Id: <34AA6353.5D52@sgi.net>

Is there a way to time a subroutine so that if it doesn't complete in a
certain time period it returns an error? I have a routine that uses
sockets, and sometimes it will hang when trying to connect(). I want the
routine to just return bad if doesn't complete in X seconds.

Please cc to dev@sgi.net any response.

Thanks!!!

---                                                                 @				
Devin P. Anderson                           Happy Holidays         * * 	
Webmaster, Systems Administrator                from              * ' *
Stargate Industries, Inc.                 Network Operations     * ',` *
http://www.sgi.net/                                             *',  `,
*
Phone: 412.930.STAR (7827) ext. 241                           
***********
F a x: 412.930.7110                                                ***
                                                                && ***
&&	
                                                         
#=#=#=#=#=#=#=#=#=#=#

"Prehaps today *is* a good day to die. Ramming speed."
		-Lt. Worf

-----PGP PUBLIC KEY AVAILABLE-----


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

Date: Wed, 31 Dec 1997 11:12:43 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: timing subroutines
Message-Id: <68dqgu$j0f@bgtnsc03.worldnet.att.net>
Keywords: just another new york perl hacker

In article <34AA6353.5D52@sgi.net>, "Devin P. Anderson" <dev@sgi.net> posted:

> Is there a way to time a subroutine so that if it doesn't complete in a
> certain time period it returns an error?

does alarm() do what you want?

-- 
brian d foy                                 <http://computerdog.com>


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

Date: Wed, 31 Dec 1997 11:54:38 -0600
From: Derek Balling <dballing@speedchoice.com>
Subject: Re: undefined value
Message-Id: <5895D01FCFD5DF9D.B3153359C42288A3.5D2F1924C3F8BD75@library-proxy.airnews.net>

snailgem@aol.com wrote:
> 
> This is driving me crazy:
> 
> #!/usr/local/bin/perl -w
> use diagnostics;
> use File::Copy;
> 
> ##stuff initialized here
> 
> $from_file = "$common_dir/$this_htm";
> $to_file = "$common_dir/copy_$this_htm";
> 
> copy ("$from_file", "$to_file");
> 
> The only new file here is $to_file. The code works ($to_file is
> created),
> but it generates the following warning that I'd like to get rid of:
> 
> Use of uninitialized value at /usr/local/lib/perl5/File/Copy.pm line 84
> (#1)
>     (W) An undefined value was used as if it were already defined.  It
> was
>     interpreted as a "" or a 0, but maybe it was a mistake.  To suppress
> this
>     warning assign an initial value to your variables.

A few questions:

	1.) Where is "$this_htm" being assigned a value?
	2.) Which line, specifically is line 84? With only 10 lines of code
	    its hard to guess. :)


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

Date: 31 Dec 1997 15:27:11 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: word wrap routine
Message-Id: <slrn6akone.dib.gabor@vinyl.quickweb.com>

In comp.lang.perl.misc, brian d foy <comdog@computerdog.com> wrote :
# In article <slrn6aiupa.69c.gabor@vinyl.quickweb.com>, gabor@vinyl.quickweb.com (Gabor) wrote:
# 
# > In comp.lang.perl.misc, Joseph Cotton <jcotton@erols.com> wrote :
# > # Does any one have a routine to word wrap a $string ?
# > # I need to insert \n every 50 bytes or less, but not in the middle of a
# > # word.
# > 
# > here is a quick and dirty solution.
# > does  not address the problem of extra spaces at the beginning of
# > lines
# 
# > s/(.{50})(?=\s)/$1\n/g;
# 
# what happens if the 51st character is not whitespace?

The newline will be inserted after the first char followed by
whitespace after at least 50 chars have been 'looked' at.  It still
works, albeit not quite correct.

Oops, should've been
s/(.{1,50})(?=\s)/$1\n/g;

# 
# why does everyone want to try to re-invent Text::Wrap?  if you

It was a 'quick and dirty solution'.  It wasn't really meant to work
perfect but just give an idea to the poster.  I am sorry if that
offends you.  All people get here is 'Look in CPAN' and then have to
search for bloody hours trying to find something.  It's often easier
and simpler to roll your own.  If you give a pointer to CPAN at least
say 'it's in the foobar dir under the author's name which is gumby'.

# want an example, look in the module rather than posting goofy stuff.

Sorry for posting goofy stuff! ;-0

gabor.
--
    Let us be charitable, and call it a misleading feature  :-)
        -- Larry Wall in <2609@jato.Jpl.Nasa.Gov>


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

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

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