[7263] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 888 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 19 00:07:20 1997

Date: Mon, 18 Aug 97 21:00:23 -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           Mon, 18 Aug 1997     Volume: 8 Number: 888

Today's topics:
     Re: 2 variables = 1 (sorta) (Terry Michael Fletcher - PCD ~)
     Are you a FROG? <sales@volcanobooks.com>
     Re: CGI Script that searches a web sites (Curt Bousquet)
     Re: changing perl to gibberish <usenet-tag@qz.little-neck.ny.us>
     Re: Cookie...... (Nathan V. Patwardhan)
     floor/ceil (Gary Chambers)
     Re: floor/ceil (Mike Stok)
     Re: floor/ceil <zenin@best.com>
     Hailp!  Hailp! <wathab@tiac.net>
     HELP - Changing passwords inside script (Brian Wiren)
     Re: how can I read compressed files in perl (Eric Harley)
     Re: I need help debugging (I've been trying for hours) (Curt Bousquet)
     Re: Need some explanation about unpack. (Mike Stok)
     Re: Pattern repacement with variables question (Tad McClellan)
     Perl5 & Personal Web Server <mudd97@nac.net>
     Re: perl5 regexes slower than perl4? <rootbeer@teleport.com>
     Re: reading and writting to the same file (Nathan V. Patwardhan)
     Re: reading and writting to the same file (Tad McClellan)
     Re: regex opinions wanted <usenet-tag@qz.little-neck.ny.us>
     shift <ravdin@vantisintl.com>
     Re: Slick way to return everything within matching pare (Damian Conway)
     Re: splice (Terry Michael Fletcher - PCD ~)
     unexpected foreach value (Andrew D. Arenson)
     unexpected foreach value (Andrew D. Arenson)
     Where do I get Perl? (Paynesys)
     Re: Where do I get Perl? <rootbeer@teleport.com>
     Re: window.location...........? <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Aug 1997 00:32:24 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: 2 variables = 1 (sorta)
Message-Id: <5tapio$c4o$1@news.fm.intel.com>

Tad McClellan (tadmc@flash.net) so eloquently and verbosely pontificated:
> Perl *can* add 1 to a frog:
> 
> --------------------------
> $variable = "urlb0001";
> $variable++;
> print "$variable\n";
> --------------------------

by the way, *that* is *awesome* :)

> : 	Incrementing $count is a breeze, how do I attach it to the end of
> : another variable and call a new variable that is the combination of both
> : names? i.e.:
> 
> : 	$a = "abcd";
> : 	$b = "1234";
> : 	$c = "$($a$b)"; <- this code is not right at all! But what is?

that will work if you place some kind of value into $abcd1234 first, and
make a symbolic reference with curly braces {}:

$abcd1234 = "something";
$a = "abcd";
$b = 1234;
$c = ${"$a$b"};
print "$c\n";

the braces actually executes that block and returns whatever the last
thing in the block returns (integer, string, boolean, etc.).  in this
case, you interpolated that double quoted string to return that value.
you could be really wierd and do this:

$abcd1234 = "something";
$c = ${$a="abcd";$b=1234;"$a$b"};
print "$c\n";

to be honest, i used to play with variables like this because i thought it
was cute and fun, but for practical use, indexing variable names with 
another variable should just have been an array or hash in the first 
place.

--
               "Give me ambiguity or give me something else."
 ______                       ______ _               _               
(_) |                        (_) |  | |             | |              
    | _   ,_    ,_              _|_ | |  _ _|_  __  | |     _   ,_   
  _ ||/  /  |  /  |  |   |     / | ||/  |/  |  /    |/ \   |/  /  |  
 (_/ |__/   |_/   |_/ \_/|/   (_/   |__/|__/|_/\___/|   |_/|__/   |_/
*+*+*+*+*+*+*+*+*+*+*+* /| *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+* 
                        \|    tfletche@pcocd2.intel.com
*+*+*+*+*+ Views expressed...not INTeL's...yadda yadda yadda.... *+*+*+*+*+*




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

Date: Mon, 18 Aug 1997 17:41:59 -0700
From: Kermit <sales@volcanobooks.com>
Subject: Are you a FROG?
Message-Id: <33F8EBD6.C4DFEA52@volcanobooks.com>

Sample Page:  How the Frog

Would you like to see a sample of several chapters of a
book guaranteed to show you how to satisfy women?  If so,
just send me e-mail matth@mmgco.com with the subject line:
Send Frog.

Ill send you back a page with samples from How the Frog
Satisfies the Princess - What Every Man Must Know About the
Arts of Love, Romance and Sex by Ben Stirling.  The book
is a guide to being desirable, attractive, charming and a
great lover.  The book also shows you how to master the
mental, the emotional and the sexual techniques which are
the three keys to winning a womans passions.

You can also find information about the book at the
following web site:

http://www.volcanobooks.com/




--
-------------------------------------------------------
      Learn the easiest way to seduce a woman:

What Every Man MUST KNOW about the arts of Love, Romance
and Sex! http://www.volcanobooks.com/




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

Date: Tue, 19 Aug 97 01:36:48 GMT
From: scanline@sover.net (Curt Bousquet)
Subject: Re: CGI Script that searches a web sites
Message-Id: <5tatbg$2fg_002@scanline.sover.net>

In article <01bc9c5d$a9e3c720$2956dacd@admin>, "Michael A Dustin" <cybrghst@mail.tir.com> wrote:
>Hi,
>
>Can anyone point me to a CGI script that will search a personal
>web site and return the results.
>thanx
>--dusty
>

try 'swish' at:
http://www.eit.com/goodies/software/swish/

        It is a C program that you can build a PERL 'wrapper' for to 
customize it for your site. It seems to make fast, efficient searches or 
either the page <TITLE> or the contents of the entire document.

+++++++++++++++++++++++++++          
Curt Bousquet
http://www.webrover.com/ia/
Email: scanline@sover.net


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

Date: 19 Aug 1997 02:23:49 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: changing perl to gibberish
Message-Id: <eli$9708182213@qz.little-neck.ny.us>

Matthew Burnham <danew@enterprise.net> wrote:
> Phil Carmody <pc1@scigen.co.uk> wrote:
> >Victor Magdic wrote:
> >> Does anyone know if there are any programs that will take perl source
> >> and scramble it into gibberish, so that it is effectively unreadable
> >Russ Allbery does, see his .sig -
> >#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> >$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ >
> >0gFzDgD,
> > 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e
> >0.),01,pnn,y{
> >rw} >;,$0=q,$,,($_=$^)=~y,$/
> >C-~><@=\n\r,-~$:-u/#y,d,s,(\$.),$1,gee,print
> Huh? Running that gives:

Yes, well. That particular one is supposed to out put gibberish. I
believe the name for it is a 'quine': some program that outputs itself.
His is particularly sensitive to whitespace, so the line wrapping has
killed it.

It should look like this (all lines but the first are the same length,
the third line begins with a space):

#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print

Elijah
------
#!/usr/bin/perl -w
$_="<j!y~f^v* >h.g=c+m\@q[p;r} ?x/t|d:l# )e\\p.d-s]p{c<,\n";$j=0;while(
s"[^\w\s,](.*)"($u=$1,$u=~s;(\w);(($s=ord($1)-97),chr((($s+$j++)%26)+97
));gex,$u)"ex){}exit !print;#18/5/97:etb


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

Date: 18 Aug 1997 22:55:59 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Cookie......
Message-Id: <5tajtv$q5@fridge-nf0.shore.net>

John Devlin (devli002@gold.tc.umn.edu) wrote:
: How do I get the cookie in Perl?

You don't.  It's a CGI thing, me thinks.  If you're running some kind
of webserver, install CGI.pm, read the docs, and follow the examples
that deal with cookies.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 19 Aug 97 01:00:22 GMT
From: geecee@netquarters.net (Gary Chambers)
Subject: floor/ceil
Message-Id: <slrn5vhs2h.qv.geecee@flyfish.netquarters.net>

I've checked CPAN with no luck.  Can someone point me in the direction
of a Perl equivalent to C's floor and ceil functions?  A BCD math
package would work, too.  I'd hate to reinvent the wheel, but if I
must, I must.  Thanks in advance...

-- 
Gary Chambers

//------------------------------------------
// NetQuarters, Inc., Brunswick, ME 04011
// 207-798-8400 (Voice) 207-798-8403 (Fax)
// Midcoast Maine's Total Internet Solution
//------------------------------------------


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

Date: 19 Aug 1997 01:18:42 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: floor/ceil
Message-Id: <5tas9i$fd2@news-central.tiac.net>

In article <slrn5vhs2h.qv.geecee@flyfish.netquarters.net>,
Gary Chambers <geecee@netquarters.net> wrote:
>I've checked CPAN with no luck.  Can someone point me in the direction
>of a Perl equivalent to C's floor and ceil functions?  A BCD math
>package would work, too.  I'd hate to reinvent the wheel, but if I
>must, I must.  Thanks in advance...

If you have perl 5 with the POSIX module installed then saying 

  use POSIX qw/ceil floor/;

in your program and/or modules should import the functions for you.  In
the debugger...

  DB<1> use POSIX qw/ceil floor/

  DB<2> print ceil 3.0001
4
  DB<3> print floor 3.999
3


Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 19 Aug 1997 01:20:35 GMT
From: Zenin <zenin@best.com>
Subject: Re: floor/ceil
Message-Id: <5tasd3$pe1$2@nntp2.ba.best.com>

Gary Chambers <geecee@netquarters.net> wrote:
> I've checked CPAN with no luck.  Can someone point me in the direction
> of a Perl equivalent to C's floor and ceil functions?  A BCD math
> package would work, too.  I'd hate to reinvent the wheel, but if I
> must, I must.  Thanks in advance...

	You're thinking too low level for perl. sprintf() and int() will
	probably do the bulk of what you want, if not all of it.
		perldoc -f sprintf
		perldoc -f int

-- 
-Zenin
 zenin@best.com


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

Date: 19 Aug 1997 02:42:57 GMT
From: "Hiawatha Bray" <wathab@tiac.net>
Subject: Hailp!  Hailp!
Message-Id: <01bcac49$9f33e660$28ec77ce@hiawathb>

I'm trying to teach myself Perl with a book from Waite Press.  Came with a
CD-ROM with Perl 5.001 on it.  But I can't get it to run on my Win 95
computer.  I can get the program PERL.EXE to fire up, but it won't run the
basic Hello World program.  It just sits there.  Throws an error message
once in awhile, but I don't understand how to get it to work.  What command
do I type to tell it to execute a program?  Despite its cross-platform
pretensions, the book seems to have been written as if everyone uses Unix. 
There doesn't seem to be any Win 95-specific info on how you get Perl to
work.  Please, somebody, e-mail me!  I'm at wathab@tiac.net.  Thanks.

Hiawatha Bray
Quincy, MA


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

Date: 19 Aug 1997 00:41:59 GMT
From: bwiren@bs.wa.gov.au (Brian Wiren)
Subject: HELP - Changing passwords inside script
Message-Id: <5taq4n$b7q$1@marri.bs.wa.gov.au>

Hi

I am writing a script to Maintain 500+ POP A/c's wher by certain people can 
create , delete or change the password for their user's POP A/c's.

I can use "useradd" and "userdel" but I need to be able to create new 
/etc/passwd entries and to change existing entries.

The UNIX "passwd" command only takes input from tty so is no good.  I do not 
want to start opening the /etc/shadow file and changing entries then writing 
the file back.

Is there a perl function for doing this ?

Any help suggestions would be most appreciated.

I have read the perl manual and every FAQ I can find but alas no luck....

Regards Brian



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

Date: Mon, 18 Aug 1997 20:33:53 -0800
From: eharley@pacbell.net (Eric Harley)
Subject: Re: how can I read compressed files in perl
Message-Id: <eharley-1808972033540001@ppp-207-104-16-69.snrf01.pacbell.net>

> Bob Hannaford (bobh@metrica.co.uk) wrote:
> : I am writting an application that needs to handle files compressed
> : by the standard unix compress command and possible by 'gzip'.
> 
> : I have found the alpha version of a perl extension Compress::Zlib-0.50
> : and successfully uncompressed 'gzip' files, does it also handle files
> : compressed with the standard unix compress.  If so how do I do it?  I 
> : have not been able to.
> 
> Nope. Compress::Zlib can only read gzip files.
> 
> : If Compress::Zlib-0.50 doesn't handle files compressed by the standard
> : unix compress, what is a good way of doing the uncompress from perl?
> : (Other than forking a process using the 'system' function which I will
> : resort to, if all else fails.)
> 
> try
> 
>     open(F, "uncompress $file|") ;
>     while (<F>) {
>         ...
>     }
>     close F ;

What about doing a zcat? I would think that this be the perferred method
seeing as zcat doesn't permanately uncompress the file but rather reads
the compressed contents.

   open(F, "zcat $file|");
   while (<F>) {
      #Your code here  
   }

-- 
'Dial 888,' Rick said as the set warmed. 'The desire to watch TV,no matter what's on it'
 -'Do Androids Dream of Electric Sheep?', Phillip Dick


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

Date: Tue, 19 Aug 97 02:05:39 GMT
From: scanline@sover.net (Curt Bousquet)
Subject: Re: I need help debugging (I've been trying for hours)
Message-Id: <5tav1j$2fg_004@scanline.sover.net>



>        Hey group, I could *really* use some help debugging a search script 
I've
>been
>writing. I've printed out on paper, studied, found no bugs. Studied in
>electronic form, found no bugs. The shell I have access to will not allow
>me to
>execute from the command line, so that's no help. Can you guys and girls
>please
>take a real good look at my code, and search for those bugs? I really need
>you
>to help me here (other people often see things that you might miss on your
>own). Thanks!

I ran your script through PERL 5 to debug and it failed because of this error 
on this line (line 91):

  foreach $key (sort keys(%KeyToNum)))

You appear to have too many closing ")" 

The kind of thing you can look at all day and never see :(

hope this helps...

+++++++++++++++++++++++++++          
Curt Bousquet
http://www.webrover.com/ia/
Email: scanline@sover.net


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

Date: 19 Aug 1997 01:15:09 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Need some explanation about unpack.
Message-Id: <5tas2t$f5r@news-central.tiac.net>

In article <33f8b392.1466332@news.one.net>, dave <over@the.net> wrote:

>But for a structure containing two strings,
>struct { char val1[64], val2[256]; },
>
>( $val1, $val2 ) = ( unpack "A64 A256", $message );
>
>does not work OK.

How doesn't it work OK?  Do you have the surrounding code and a
description of what you get and how it differs from what you expected?

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 18 Aug 1997 17:14:40 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Pattern repacement with variables question
Message-Id: <gghat5.ar6.ln@localhost>

Mark Tripod (mark@pbi.net) wrote:
: Vince Busam wrote:
: > 
: > I want to perform pattern replacement based on variables which contain
: > backreferences.  Similar to :
: > $test = "one two";
: > $match = '^([^ ]+) +([^ ]+)';
: > $replace = '$2 $1';

: change $replace = '$2 $1';
: to $replace = "$2 $1";

: single quotes prevent the variable substitution that you are looking
: for.


But he does *not* want interpolation at that statement, because
$1 and $2 have not been set in a pattern match yet...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Mon, 18 Aug 1997 20:05:11 -0400
From: Brian Moffatt <mudd97@nac.net>
Subject: Perl5 & Personal Web Server
Message-Id: <33F8E337.3ADA11A9@nac.net>

I installed PWS and I am brand new at Perl. How do I install it so I can
test CGI's
Thank you.



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

Date: Mon, 18 Aug 1997 18:58:45 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Andrew Dalke <dalke@ks.uiuc.edu>
Subject: Re: perl5 regexes slower than perl4?
Message-Id: <Pine.GSO.3.96.970818185314.5155D-100000@linda.teleport.com>

On 18 Aug 1997, Andrew Dalke wrote:

> I'm glad I was able to help you to track it down to a specific
> set of changes and hope the performance improvements are easy
> to implement.
>   Could you drop me a note when this happens?

I wouldn't expect most of this to be "fixed" anytime soon. :-)  The reason
is that many slowdowns in one place either provide greater speed someplace
else or greater security and accuracy. For example, we take extra time
when compiling a regexp in order to make it run more quickly when it's
used. In real-world applications, programs written to use Perl5's features
should outrun equivalent Perl4 programs almost every time. The exception
is when Perl5 does something extra which is needed for security or
accuracy.

Nevertheless, on the developers' wish list is the 'use less FOO' pragma,
in which you could say perhaps 'use less regexp_optimizing' if you know
that that will speed your application. Similarly, 'use less memory', 'use
less swap', 'use less processor_time', and 'use less money' :-) are all
dreamed of.

When a version of Perl has these features, the release notes should
document them. Hope this helps!

-- 
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/



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

Date: 18 Aug 1997 22:54:19 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: reading and writting to the same file
Message-Id: <5tajqr$q5@fridge-nf0.shore.net>

Devin Anderson (dev@sgi.net) wrote:
: I'm trying to read and write to the same file. Now my perl book says
: this is possible by opening the file with a "+>" mode. However, it just
: destroys the file when I do this. Here is my code.

That's right.  +> *creates* the file *first*.  You should use +<
instead (for which the file must exist first), or better yet, read the
input file, open an output file (don't forget flock), output the
contents to the new file, and rename when you're done.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Mon, 18 Aug 1997 17:22:56 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: reading and writting to the same file
Message-Id: <00iat5.is6.ln@localhost>

Devin Anderson (dev@sgi.net) wrote:
: I'm trying to read and write to the same file. Now my perl book says
                                                     ^^^^^^^^^^^^

Which one?

The one that *comes with* the perl distribution tells you that
using +> will destroy the previous contents.

Believe the man pages first, books second.  ;-)



: this is possible by opening the file with a "+>" mode. However, it just
: destroys the file when I do this. Here is my code.


from perlfunc man page (my underlining):

---------------------------------
=item open FILEHANDLE,EXPR

=item open FILEHANDLE

Opens the file whose filename is given by EXPR, and associates it with
FILEHANDLE.  If FILEHANDLE is an expression, its value is used as the
name of the real filehandle wanted.  If EXPR is omitted, the scalar
variable of the same name as the FILEHANDLE contains the filename.
(Note that lexical variables--those declared with C<my>--will not work
for this purpose; so if you're using C<my>, specify EXPR in your call
to open.)

If the filename begins with '<' or nothing, the file is opened for input.
If the filename begins with '>', the file is truncated and opened for
output.  If the filename begins with '>>', the file is opened for
appending.  You can put a '+' in front of the '>' or '<' to indicate that
you want both read and write access to the file; thus '+<' is almost
always preferred for read/write updates--the '+>' mode would clobber the
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
file first.  The prefix and the filename may be separated with spaces.
^^^^^^^^^^
These various prefixes correspond to the fopen(3) modes of 'r', 'r+', 'w',
'w+', 'a', and 'a+'.
 ...
---------------------------------


: I just need to scan through the file, make any replacements, and close.

You can do this directly ONLY if you want to replace exactly the
same number of characters.


: Because this routine could get called multiple times, writing to a
: second file then copying would be a waste of io, (at least the way I
: see, please disagree with me if you think otherwise). 

: Any ideas?
  ^^^^^^^^^

Yes.

Consult your Frequently Asked Question in the Perl FAQ, part 5:

   "How do I change one line in a file/delete a line in a file/insert 
    a line in the middle of a file/append to the beginning of a file?"


Which offers several alternatives.


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 19 Aug 1997 02:41:25 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: regex opinions wanted
Message-Id: <eli$9708182221@qz.little-neck.ny.us>

Posted and mailed.

David Turley  <dturley@rocketmail.com> wrote:
> After looking thru the various perl animal books, and ora's regex book, I
> believe I have come up with a regex to match a US$ amount, and am lloking
> for feedback.
> /^\d+(\.\d\d)?$|^\.\d\d$|^\d+\.$/
> (dollar sign is stripped off before processing)

Well, I would simplify it to

	/^(\d+\.?(\d\d)?|\.\d\d)$/

And quite possibly use non-capturing parens, like this:

	/^(?:\d+\.?(?:\d\d)?|\.\d\d)$/

Of course, you picked an easy task. Here's a little something from my
spam filter with a similar aim, identifying prices:

# Be very generous about accepting "only US$15,- p min" text.
 /\b(?:to|just|only)     # first they try to de-emphasize it
  \s+(?:[a-z]{2}\s*)?    # Sometimes with something for the currency
  (?:(?:\$|\#)\s*)?      # Sometimes a currency notation (needs expanding)
  (?:\d+                 # A number
     (?:[.,](?:[o\d]{2}  #    with an optional fractional portion
      |-)?)?             #    or a hyphen for 00
   |\.\d+)               # or exclusively fractional
  (?:\s*cents)?          # an alternative currency location
  \s*(?:\/|p(?:er|\.)?)  # "per" and variations
  \s*(?:m(?:in(?:ute)?)? # "minute" and variations
     |h(?:ou)?r?)        # or "hour" and variations
  /ix                    # Ignore case and use free-format regexp

It was originally just a phone sex price identifier, but then I expanded
it to cover "up to $75.00 per hr" job offer stuff. Quite effective.

Elijah
------
few spammers are creative enough to get past my regexps



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

Date: Mon, 18 Aug 1997 19:18:37 -0700
From: Bill Ravdin <ravdin@vantisintl.com>
Subject: shift
Message-Id: <33F9027D.3EF9@vantisintl.com>

I'm having a problem using the shift function.

It's my understanding that it undefines the array if there's only one 
element in it (at least that's what it says in the Camel book.)

The problem is, the interpreter doesn't seem to be doing this properly.  
If I start out with five or more elements in the array, no problem- my 
program works the way I expect it to.  However, if I start with four or 
fewer elements in the array, shift fails to undefine, causing all kinds 
of problems.

Of course, there's always more than one way to do it, and I'm sure I can 
get around this problem by writing more code.  I was curious to see if 
anyone knew of this problem, though.  Is it me or is it Perl?


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

Date: 19 Aug 1997 02:38:47 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Slick way to return everything within matching parens
Message-Id: <5tb0vn$fpa$1@towncrier.cc.monash.edu.au>

horn@beaner.cs.wisc.edu (Jeffrey Horn) writes:

>I am looking for a way to match everything within parens starting from
>the first open paren "(" and going through the matching closing
>paren ")".

My module Text::Balanced does this, and more (for instance, do you need to
handle unbalanced but quote-protected parentheses?)

It was uploaded late last week and should have hit most of the CPAN
mirrors by now.

damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  who: Damian Conway                 email: damian@cs.monash.edu.au
where: Computer Science Dept.          web: http://www.cs.monash.edu.au/~damian
       Monash University             quote: "The best form of self-defence is
       Clayton 3168, Australia               not being there in the first place"


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

Date: 18 Aug 1997 16:41:36 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: splice
Message-Id: <5t9u00$qqn$1@news.fm.intel.com>

Scott Houck (scott@radix.net) so eloquently and verbosely pontificated:
> Um, why not just use grep?
> 
> @aliasfile = grep !/test/, @aliasfile;

oh.....my.....god.....
i dont know *how* i have survived for a over a year now without ever even
using the *Perl* grep.  all this time i assumed it was the same as the
unix grep, so it was useless when regexps could do all the grepping in the
world.  i guess by assuming i made an ass out of me and me :(
i sure hate unknowingly trying to re-invent the wheel.
well, at least i hope my explanation of why you cant extract from a list
you are foreaching (that is a verb isn't it?) through was helpful.

--
               "Give me ambiguity or give me something else."
 ______                       ______ _               _               
(_) |                        (_) |  | |             | |              
    | _   ,_    ,_              _|_ | |  _ _|_  __  | |     _   ,_   
  _ ||/  /  |  /  |  |   |     / | ||/  |/  |  /    |/ \   |/  /  |  
 (_/ |__/   |_/   |_/ \_/|/   (_/   |__/|__/|_/\___/|   |_/|__/   |_/
*+*+*+*+*+*+*+*+*+*+*+* /| *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+* 
                        \|    tfletche@pcocd2.intel.com
*+*+*+*+*+ Views expressed...not INTeL's...yadda yadda yadda.... *+*+*+*+*+*





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

Date: 18 Aug 1997 21:54:48 -0500
From: arenson@hen.imgen.bcm.tmc.edu (Andrew D. Arenson)
Subject: unexpected foreach value
Message-Id: <wq203qkhl3.fsf@hen.imgen.bcm.tmc.edu>


I have a simple loop:

	foreach $trace (@traces) {
	    $result = &filter($trace);
	}

That is doing something quite unexpected. In a fully reproducable
fashion, but for no reason I've been able to discern, the last time
the variable '$trace' is set, instead of actually getting the value
of $traces[$#traces], it gets either 8 or 0.

The above is a simplification of the code. I'd be more than happy
to expand on it, but I didn't want to scare people off right away.
I've used the debugger to get to the inner code above and am stunned
to see:

  DB<11> p $trace
8
  DB<12> p $traces[$#traces]
Bcm::PM_Trace=HASH(0x76f260)




-- 
Andrew D. Arenson            | http://gc.bcm.tmc.edu:8088/cgi-bin/andy/andy
Baylor College of Medicine   | arenson@bcm.tmc.edu        (713)  H 520-7392
Genome Sequencing Center, Molecular & Human Genetics Dept.     | W 798-4689
One Baylor Plaza, Room S903, Houston, TX 77030                 | F 798-5386


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

Date: 18 Aug 1997 21:56:29 -0500
From: arenson@hen.imgen.bcm.tmc.edu (Andrew D. Arenson)
Subject: unexpected foreach value
Message-Id: <wqzpqej2xu.fsf@hen.imgen.bcm.tmc.edu>


Platform: Solaris2.5, perl-5.003

I have a simple loop:

	foreach $trace (@traces) {
	    $result = &filter($trace);
	}

That is doing something quite unexpected. In a fully reproducable
fashion, but for no reason I've been able to discern, the last time
the variable '$trace' is set, instead of actually getting the value
of $traces[$#traces], it gets either 8 or 0.

The above is a simplification of the code. I'd be more than happy
to expand on it, but I didn't want to scare people off right away.
I've used the debugger to get to the inner code above and am stunned
to see:

  DB<11> p $trace
8
  DB<12> p $traces[$#traces]
Bcm::PM_Trace=HASH(0x76f260)




-- 
Andrew D. Arenson            | http://gc.bcm.tmc.edu:8088/cgi-bin/andy/andy
Baylor College of Medicine   | arenson@bcm.tmc.edu        (713)  H 520-7392
Genome Sequencing Center, Molecular & Human Genetics Dept.     | W 798-4689
One Baylor Plaza, Room S903, Houston, TX 77030                 | F 798-5386


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

Date: 19 Aug 1997 00:02:11 GMT
From: paynesys@aol.com (Paynesys)
Subject: Where do I get Perl?
Message-Id: <19970819000201.UAA09861@ladder02.news.aol.com>

I've heard a lot of great things about this language.  Where and how do 
I get a copy?

Please e-mail responses to paynesys@aol.com


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

Date: Mon, 18 Aug 1997 19:03:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Paynesys <paynesys@aol.com>
Subject: Re: Where do I get Perl?
Message-Id: <Pine.GSO.3.96.970818190321.5155G-100000@linda.teleport.com>

On 19 Aug 1997, Paynesys wrote:

> I've heard a lot of great things about this language.  Where and how do 
> I get a copy?

    http://www.perl.org

-- 
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/



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

Date: Mon, 18 Aug 1997 19:01:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: John Devlin <devli002@gold.tc.umn.edu>
Subject: Re: window.location...........?
Message-Id: <Pine.GSO.3.96.970818190037.5155E-100000@linda.teleport.com>

On Mon, 18 Aug 1997, John Devlin wrote:

> Date: Mon, 18 Aug 1997 09:47:10 -0700
> From: John Devlin <devli002@gold.tc.umn.edu>
> Newsgroups: comp.lang.perl.misc
> Subject: window.location...........?
> 
> Senerio:  I have a page (page1) that calls another page (page2).  When
> page2 is loaded, javascript is executed displaying a confirmation
> messagebox.  In the javascript, if the user selects ok, I set the
> window.location to a specific location.  If not, I set window.location
> to different location.
> 
> Problem:  In Win3.1 using Netscape 3.0, this works fine.  I am having a
> problem when trying to run this using Netscape 3.0 on WinNT.  When the
> OK or Cancel buttons are pressed, the browser acts as if it was trying
> to load a page but doesn't.  The browser seems to be waiting for another
> user event when the ok or cancel button is pressed before executing the
> window.location.  If I click once on the cancel or ok button, and then
> press the keyboard or click anywhere on the screen, the window.location
> works fine.  I found that if I double click on the buttons, everything
> executes wonderfully.  Any idea what is going on?  

Yes: You're posting a non-Perl question to a Perl newsgroup! :-)  Maybe
you would get better answers in a newsgroup about browsers, or something
like that. Good luck!

-- 
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/



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

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

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