[8567] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2184 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 26 02:07:44 1998

Date: Wed, 25 Mar 98 23:00:46 -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, 25 Mar 1998     Volume: 8 Number: 2184

Today's topics:
    Re: Authorization of porxy <mhchau@cse.cuhk.edu.hk>
    Re: Can this be done with Perl5 and NT4 <ebohlman@netcom.com>
    Re: crypt paranoia ? <webmaster@fccjmail.fccj.cc.fl.us>
    Re: File Upload with LWP? <aas@sn.no>
    Re: FileHandle - I really wish it had a 'file_name' met (Iacchus Maladeus Mozart)
    Re: Form Input (Andre L.)
    Re: Going Rates for PERL Programming??? <fp@pmpcs.com>
    Re: Going Rates for PERL Programming??? <fp@pmpcs.com>
    Re: Going Rates for PERL Programming??? <fp@pmpcs.com>
        grepping on an array <monty@nospam.net>
    Re: grepping on an array <jdf@pobox.com>
    Re: grepping on an array <rjk@coos.dartmouth.edu>
    Re: hard reference, variable names ? <rjk@coos.dartmouth.edu>
    Re: hash vs hash ref <jdf@pobox.com>
    Re: hash vs hash ref <rjk@coos.dartmouth.edu>
    Re: help with Hardware ethernet addresses please (Jason Gloudon)
    Re: Is there a "Newsgroup" for Newbies to Perl? (John)
    Re: Lazy question.. <stevenjm@olywa.net>
    Re: need regexp help <rjk@coos.dartmouth.edu>
        Need sorting routine in Perl <didiek@intouch.co.id>
        Please Help, Win95/NT4.0 Serial Port Usage Questions (J. Daniel Melton)
        Problems with handling Mac/PC/Unix line breaks (Robert Cassidy)
        regular expression (8($J$Z6!*:2VE]$})
    Re: regular expression (Huu Da Tran)
        Remote Host Redirection wes@wesley.win.net
    Re: Shortcut question <uri@sysarch.com>
    Re: Sybperl return values <bill@tela.com>
    Re: verifying email address -- how? <zenin@archive.rhps.org>
    Re: || and 'or' - implications? <jdf@pobox.com>
    Re: || and 'or' - implications? <rjk@coos.dartmouth.edu>
    Re: || and 'or' - implications? (Martin Vorlaender)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 26 Mar 1998 06:09:16 GMT
From: Sleep <mhchau@cse.cuhk.edu.hk>
Subject: Re: Authorization of porxy
Message-Id: <6fcrec$br0@eng-ser1.erg.cuhk.edu.hk>

Sneex <chasecreek.systemhouse@usa.net> wrote:
> If I understand your question - firewalls don't work like that, at least
> mine don't :-)

> Firewalls will not accept authentication from 'outside' - in my network I
> control via ACL who gets to which server via what port (protocol, if you
> will).
> Sleep wrote:
> > Hello ,
> > Can anyone tell me how to authorize a proxy server (etc give user name &
> > password ) ?
> > I am blocked by the firewall ...

Sorry , my question is too simple & unclear.

In fact , when using ordinary broswer (netscape 4) to surf the outside 
world from the Intranet, the firewall will ask the broswer(client) to prompt 
for the input of username & password. But how to do it when using 
CGI(Perl) script to go out ?

Is there any function inside LWP module can do that ?


Regards,
Chau.


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

Date: Thu, 26 Mar 1998 06:38:33 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Can this be done with Perl5 and NT4
Message-Id: <ebohlmanEqEyG9.333@netcom.com>

Jonathan Feinberg <jdf@pobox.com> wrote:
: Josh Cook <webmaster@jersey.net> writes:

: > My application that I need to create involves a perl script, running as
: > a cgi program, to request a webpage from another site and then take the
: > contents from that page and re-format them into a new page for my site. 
: > The webpage that I would be 'borrowing' this information has the page
: > setup so that all of the information that I need is between <pre> tags. 
: > Can anyone help me in getting started with this???

: This is an easy task for a moderately experienced Perl programmer,
: who would know to use the LWP modules and a regex or two.  You'll
                                        ^^^^^^^^^^^^^^^^^^
: have to learn Perl, though.  I suggest you start with the excellent
: book _Learning Perl_.

Surely you meant "and HTML::Parse"



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

Date: Thu, 26 Mar 1998 02:57:46 GMT
From: Webmaster <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: crypt paranoia ?
Message-Id: <3519C2CA.3096E82@fccjmail.fccj.cc.fl.us>

Arunas Salkauskas wrote:

> I would have thought that it was the US government that was paranoid about
> exporting encryption...
>
> - Arunas

Having worked in the 'gov' I would say that is the
impression that would have the populance believe :-)

Sneex :-)



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

Date: 26 Mar 1998 06:35:50 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: File Upload with LWP?
Message-Id: <m33eg6rp3d.fsf@furu.g.aas.no>

neal@make-a-store.com writes:

> I have successfully been able to use the LWP module for
> POST/GET/HTTPS/etc...but I am stuck on file upload (no, I cannot just use
> Net::FTP).
> Has anyone seen any working examples of simulating file-upload with LWP. I
> already have the file upload server written (which works fine via browser). I
> guess I'm just confused about how to build the HTTP::Request with all the
> Content-disposition stuff, etc.

Take a look at the HTTP::Request::Common module.

-- 
Gisle Aas


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

Date: 26 Mar 1998 04:22:26 GMT
From: IMMozart@poee.org (Iacchus Maladeus Mozart)
Subject: Re: FileHandle - I really wish it had a 'file_name' method!
Message-Id: <6fcl62$f5m$1@news.doit.wisc.edu>

>Here's the quandary: suppose I write all these groovy packages that
>operate on an open FileHandle (so someone else has already worried
>about openinging the FileHandle & what to do if it fails).
>
>Now, in the package I'm parsing the input from the FileHandle (say)
>and I find an error.  
>
>Gee, wouldn't it be nice to be able to issue a warning message with
>the file name in it?  But how!?


Couldn't you get the name of the file from the symbol table?

For instance $file = $main::{$handle}
  or something like that.




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

Date: Wed, 25 Mar 1998 21:51:35 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Form Input
Message-Id: <alecler-2503982151350001@dialup-530.hip.cam.org>

In article <3518C67B.35F8BC2E@pixi.com>, Dan Jezek <danjezek@pixi.com> wrote:

> Thanks to all of you who have answered regarding this small problem.
> 
> I'm using a regular IBM PC with windows 95 on it and when I fill out the
> HTML form which is located on my hard drive, I want it to run the perl
> program which is also located on my hard drive.  (no networks are
> involved here).  As far as I can tell, it's not even executing the pl
> program.  Don't know why, perhaps it has something to do with making the
> program executable which I don't have a clue how to do that.

To execute a CGI, you need a webserver on your PC. Browsers alone don't
run CGIs.


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

Date: Wed, 25 Mar 1998 22:26:45 -0500
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: Going Rates for PERL Programming???
Message-Id: <6fchok$68g$1@usenet40.supernews.com>

Greetings Jim:

Jim Michael wrote in message ...
>Zenin (zenin@archive.rhps.org) wrote:
>: You're assuming (danger) that the code you're tweaking is actually
>: well written, commented, documented, etc.  You're either living a
>: charmed life, or you're vary delusioned...
>
>I'm neither.  Failing well written, commented, documented code, we have
>overstepped the bounds of tweaking, and entered the realm of rewriting,
>commenting and documenting, and should be paid accordingly.

The catch is clear business communication.

Prospective client... "What are your rates?

Programmer with attitude their time is worth less tweaking... "$40 per hour
for modifying existing code -- tweaking and $100 per hour for writing new
code..."

Prospective client... "Great... I need you to modify....."

Programmer... "Ok..."

Then....

A.  Programmer sees code is poorly written, and charges $100 per hour to
client who was never informed and has one expectation... lost client and
client tells 10+ others about bad ethics of programmer.

OR

B.  Programmer takes (most likely) UNPAID time to review code to determine
whether or not it is tweaking or custom.. and then has to explain (in
English) why (s)he now has to charge $100 per hour.

 .....

OR you have one person who knows the value of their time is the same for
either task... and can state it without adding client complexities in the
form of the above (there will most always be client complexities, but why
add to it because of UNCLEAR billing practices or practices where you can
WASTE valuable time?).

--
===========================================================
Peter Perchansky,  Computer Consultant & Microsoft FrontPage MVP
Dynamic Net, Inc. DBA PMP Computer Solutions
Providing Dynamic Databases, Design, &  Electronic Commerce Solutions
FrontPage Web Hosting at http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.pmpcs.com/support/frontpage.htm






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

Date: Wed, 25 Mar 1998 22:29:55 -0500
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: Going Rates for PERL Programming???
Message-Id: <6fchvs$d28$1@usenet43.supernews.com>

Greetings Richard:

Richard Bellavance wrote in message <6fbeb7$oop@ocean.CAM.ORG>...
>That's not what I said.  It depends on your definition of "simple
>programming", I guess.  But if I performed all the analysis of an
>application and asked you to implement it, I would expect you to
>charge me less than if you had to design the whole thing.  Then again,
>this also varies with the quality of the analysis :-)

My point is that time is time is time... it is fixed, unmutable, etc.  If
you are skilled at what you do, then the value of what you do should be the
same.

AND...  if you are dealing with issues where you don't have all of the
controls up front --- as in tweaking some one else's code --- to charge
less... is to really and seriously devalue your own time.

Just an opinion.

--
===========================================================
Peter Perchansky,  Computer Consultant & Microsoft FrontPage MVP
Dynamic Net, Inc. DBA PMP Computer Solutions
Providing Dynamic Databases, Design, &  Electronic Commerce Solutions
FrontPage Web Hosting at http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.pmpcs.com/support/frontpage.htm






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

Date: Wed, 25 Mar 1998 22:31:52 -0500
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: Going Rates for PERL Programming???
Message-Id: <6fci3l$39t$1@usenet36.supernews.com>

Greetings Brian:

brian d foy wrote in message ...
>In article <6fbg77$k1v@julius.ling.ohio-state.edu>,
kcohen@julius.ling.ohio-state.edu (Kevin B Cohen) posted:

>i've been know to quote OUTRAGEOUS rates for some projects
>that i really had no intention of doing.  some people just
>don't get the hint that $9 trillion/hour is a nice way of
>saying "no thanks". i bump up the rates that high for any
>project which has the words "<some name> Script Archive" in
>the description :)

What I find interesting are those times when one quotes a very high rate for
the purpose of not getting the project... and then you are handed it...

--
===========================================================
Peter Perchansky,  Computer Consultant & Microsoft FrontPage MVP
Dynamic Net, Inc. DBA PMP Computer Solutions
Providing Dynamic Databases, Design, &  Electronic Commerce Solutions
FrontPage Web Hosting at http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.pmpcs.com/support/frontpage.htm






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

Date: Wed, 25 Mar 1998 23:02:18 -0600
From: "Monty Scroggins" <monty@nospam.net>
Subject: grepping on an array
Message-Id: <6fcnsa$dkj$1@plucky.netgazer.net>

I have found a strange behavior in Perl.

I have an array which I clear using undef @array;.
The array is then defined from an input file - @array=<infile>;
I use shift to pull the first element off of the array.
I then search the array for certain strings.  The grep fails on
the first element of the array.  If I change the undef @array to
@array=""; the grep functions properly!!

Does anyone have an idea on why this behavior occurs??

Any information would be greatly appreciated



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

Date: 26 Mar 1998 01:04:45 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: grepping on an array
Message-Id: <zpievvgi.fsf@news.concentric.net>

"Monty Scroggins" <monty@nospam.net> writes:

> I have an array which I clear using undef @array;.

That's not exactly 'clearing' an array.  To clear it (which I take to
mean make it empty), you'd idiomatically say:

   my @array = ();

> The array is then defined from an input file - @array=<infile>;

Are you *quite* sure that infile is defined, and that the file was
successfully opened?

> I then search the array for certain strings.  The grep fails on
> the first element of the array.  If I change the undef @array to
> @array=""; the grep functions properly!!

This *strongly* suggests to me that the file has not been opened, or
that it is empty.  Why?  Because when you say

   @array = "";  # this is not what you mean, I'd wager

you have created an array with one element consisting of the null
string.  The array is therefore still defined when you shift from it,
and grep has a defined value to work with.

> Does anyone have an idea on why this behavior occurs??

I'll bet you that -w would tell you a lot of things you need to know
when you next run your script.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Thu, 26 Mar 1998 01:22:41 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: grepping on an array
Message-Id: <3519F438.7431E741@coos.dartmouth.edu>

Monty Scroggins wrote:
> 
> I have an array which I clear using undef @array;.
> The array is then defined from an input file - @array=<infile>;
> I use shift to pull the first element off of the array.
> I then search the array for certain strings.  The grep fails on
> the first element of the array.  If I change the undef @array to
> @array=""; the grep functions properly!!
> 
> Does anyone have an idea on why this behavior occurs??

Please post a brief code sample which demonstrates this behavior.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 26 Mar 1998 01:14:28 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: hard reference, variable names ?
Message-Id: <3519F24A.A7CB89AC@coos.dartmouth.edu>

Phil R Lawrence wrote:
> 
> In my program I said 'use strict vars' and declared %M, %F, and %T.  In the
> code snippet below, I want to add keys and values to these hashes.
> 
> The problem is with this line:
>    $sex{$offer} = $sth->fetchrow_array;
> 
> I want this to update %M and %F, depending on which value $sex is currently
> set to, but instead it tries to update %sex.  (Which causes the script to
> die, as I haven't declared %sex.)

I'm surprised no one has suggested this solution.  Apparently, everyone is
stuck thinking inside the box.  ;-)

($sex eq 'M' ? $M{$offer} : $F{$offer}) = $sth->fetchrow_array;

On the other hand, it's not the best solution for this problem, particularly
since you're using the hashes in other statements as well.  Just thought I'd
suggest it as a reminder that ?: can be used as an lvalue.  :-)

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 26 Mar 1998 00:40:47 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: hash vs hash ref
Message-Id: <1zvqxb4w.fsf@news.concentric.net>

boson@earthlink.net (Tomas) writes:

> Could someone give me a simple reason why or when it is better to have
> a reference to a hash than just using the hash itself. For instance
> these both codes does the same.
> 
> %hash = (name =>"Jason");
> print $hash{name};
> 
> $hashref = {name =>"Jason};
> print $hashref->{name};

Well, no; one features a list assignment, the other a scalar
assignment.  The *output* is the same in both cases.  

Why use a reference?  Sometimes you have to, as when constructing a
list of lists or some more complex data structure.  Sometimes you have
to pass more than one list or hash to a subroutine, in which case you
must use references.  Check out perlref, perlsub, perllol, perldata,
and perldsc for detailed discussions of these issues.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Thu, 26 Mar 1998 00:58:29 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Tomas <boson@earthlink.net>
Subject: Re: hash vs hash ref
Message-Id: <3519EE8A.16C5CF2E@coos.dartmouth.edu>

[posted and mailed]

Tomas wrote:
> 
> Could someone give me a simple reason why or when it is better to have
> a reference to a hash than just using the hash itself.

If you're passing the hash to a subroutine, passing a ref to the hash instead
is much more efficient.  It's necessary if you want to pass other hashes or
arrays as well.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 26 Mar 1998 03:07:09 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: help with Hardware ethernet addresses please
Message-Id: <slrn6hjhgb.mh8.jgloudon@manitoba.bbn.com>

Mark Kucera <kucera@mindsrping.com> wrote:
>is there a perl utility or function that can retrieve a remote
>ethernet address accros a network/ the internet??

Ethernet Adress of what ? 
A machine you have the hostname for on the other side of the room / world ? 

The first is doable, the second is not.

You should take your question to a networking related newsgroup,
as your question shows that you don't understand what you expect
from this utility.

-- 
Jason Gloudon


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

Date: 26 Mar 1998 04:11:27 GMT
From: falstaff@lennon.postino.com (John)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6fckhf$633$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Tom Christiansen (tchrist@mox.perl.com) wrote:
: Nonprogammers should not use any programming language.   Period.
: Nonsurgeons should perform any surgical interventions.  Period.  This is
: a profession, you know.  If you aren't a programmer, hire one.

That is pretty funny Tom. I am fairly new to this group, and 
am still getting a handle on your sense of humour. Did you keep
a straight face when you posted this troll? And Larry, how


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

Date: Wed, 25 Mar 1998 20:28:25 -0800
From: Steven May <stevenjm@olywa.net>
Subject: Re: Lazy question..
Message-Id: <3519D969.CBAFE5EE@olywa.net>

First 'Out Loud Laugh' I have had all day.

Thank you.

Steve

Andy Lester wrote:
> 
> : I need to knock up a quick Perl script
> 
> I suspect you misunderstand how one creates child processes.
> 
> xoxo,
> Andy
> 
> --
> --
> Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
> Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/


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

Date: Thu, 26 Mar 1998 00:41:08 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: need regexp help
Message-Id: <3519EA78.FACFF6E7@coos.dartmouth.edu>

Douglas Wilson wrote:
> 
> Use "." not /./ if you want to split on dot characters and ""
> if you want to split on every character.

I don't think so.

  DB<1> x split(".", 'foo.bar')
  empty array
  DB<2> x split("\.", 'foo.bar')
  empty array
  DB<3> x split("\\.", 'foo.bar')
0  'foo'
1  'bar'
  DB<4> x split(/\./, 'foo.bar')
0  'foo'
1  'bar'

The first argument to split is a regex.  If you give it a string, the string
will be used as a regex.

{split "."} is equivalent to {split /./}.  So is {split "\."}; do you see why?

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 26 Mar 1998 10:36:46 +0700
From: Didiek <didiek@intouch.co.id>
Subject: Need sorting routine in Perl
Message-Id: <3519CD44.60D@intouch.co.id>

Hi,

Does anyone know how or where can I get a sample perl script for sorting
numbers. I plan to build a link list and display them in a top referrer
order basis. Just like top50 or top100 or whatever.

Any information would be very appreciated.

Regards,
Didiek


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

Date: Thu, 26 Mar 1998 06:17:59 GMT
From: jdmelton@oz.sunflower.org (J. Daniel Melton)
Subject: Please Help, Win95/NT4.0 Serial Port Usage Questions
Message-Id: <3519e23f.34483764@news.supernews.com>

I wish to use Perl 5.004 Standard for communication with a couple of
RS232 devices on an Intel  Windows 95 platform. I wish to use Perl, I
know there are other tools for the job.

Could someone please point me to USEFUL information about setting bps
(baud rate), data bits, parity bits, and stop bits via Perl? Is there
a Win32 module anywhere for serial communications?

The open() function (as listed in the faq) does not work properly for
this, or are there more parameters available than listed in Perl's
docs? I have looked at perlfunc for open() parameters.

Should I expect to change Registry settings before using the serial
port in order to change UART settings?

I can easily communicate with these devices via my Linux box and my
DOS/Windows 3.1 box. On the Linux box, I use Perl, the MS OS's have
used either C/C++ or some form of Basic. So, I know the hardware is
good. My devices are "slave" devices, so they only send data after
receiving ASCII commands via their RS232 ports. What I need to do in
Perl is set up the UART for communication parameters, send an ASCII
string, then wait for a response (also an ASCII string).

One device requires 2400 baud, 7 data bits, even parity, 1 stop bit.
The other device requires 14400 bps, 8 data bits, no parity, and 1
stop bit. My Intel platforms all use the 16550 UART.

The Windows faqs, CPAN, monitoring this newsgroup, searches of usenet
archives, and various Perl books (from O'Reilly) have been where I
looked so far. All I have found were simple references to using
open(), like in the faqs, but none of these have addressed setting the
baud rate or other parameters in a way that actually works on Win32
platforms. I thought that a modem communications program would
probably have the information that I need, but I have not found any
modem programs applicable to Win32 platforms.

Surely someone has done this before! I would certainly appreciate
hearing from someone who has actual experience in this area.

Thanks,

Dan


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

Date: Wed, 25 Mar 1998 14:50:45 -0800
From: rmcassid@uci.edu (Robert Cassidy)
Subject: Problems with handling Mac/PC/Unix line breaks
Message-Id: <rmcassid-2503981450450001@dante.eng.uci.edu>

Fairly newbie using MacPerl, but will likely have to deal with it on unix
as well.

I'm trying to figure out how to deal with files that have, without prior
knowledge, Mac/DOS/unix line breaks. The problem is that some of the files
I deal with run into the tens and hundreds of megabytes so just grabbing
the whole file and looking for \n or \r is a wee bit impractical. I can
make some safe assumptions about how many characters before a break should
occur, though. 

-Bob Cassidy


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

Date: 26 Mar 1998 05:03:37 GMT
From: NortonNg.bbs@CHS.Dorm10.NCTU.edu.tw (8($J$Z6!*:2VE]$})
Subject: regular expression
Message-Id: <3NdUHd$94p@CHS.Dorm10.NCTU.edu.tw>



hi there,

just a simple question: how can I write a perl script to identify
all strings of 0's and 1's that do not contain the substring 011  ?

and another one is to identify all strings of digits with at most one 
repeated digit. 

thanks...
Scott

--
!0 -W'o:!ENortonNg )s Mar 26 13:04:53 -W'o%;$e!E[FROM: localhost]
!0 (S7=:!E;e8A8j0T/8 CHS.Dorm10.NCTU.edu.tw!E[FROM: localhost]


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

Date: Thu, 26 Mar 1998 05:17:11 GMT
From: tranhu@jsp.umontreal.ca (Huu Da Tran)
Subject: Re: regular expression
Message-Id: <slrn6hjp78.rdb.tranhu@derby.jsp.umontreal.ca>

Un jour, 8($J$Z6!*:2VE]$} (NortonNg.bbs@CHS.Dorm10.NCTU.edu.tw)
     affirmait publiquement que:

| just a simple question: how can I write a perl script to identify
| all strings of 0's and 1's that do not contain the substring 011  ?

using grep(! /011/, @array_of_strings);  ?

| and another one is to identify all strings of digits with at most one
| repeated digit.

Hum... ;-)

-- 
__________________________________________________________________________
   TRAN, Huu Da                                  Universiti de Montrial
   tranhu@jsp.umontreal.ca         http://www.jsp.umontreal.ca/~tranhu/
//////////////////////////////////////////////////////////////////////////
En amour, il importe seulement de ne pas parantre plus sot qu'on ne le
devient.                                                       -- K. Kraus


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

Date: Wed, 25 Mar 1998 22:41:37 -0600
From: wes@wesley.win.net
Subject: Remote Host Redirection
Message-Id: <6fcm8p$l26$1@nnrp1.dejanews.com>

Is there a script which will detect the originating IP of someone browsing
your web pages and, depending on their IP - or remote host,  automatically
redirect them to "disneyworld.com"?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 25 Mar 1998 22:15:30 -0500
From: Uri Guttman <uri@sysarch.com>
To: alecler@cam.org (Andre L.)
Subject: Re: Shortcut question
Message-Id: <x7lntyjg6l.fsf@sysarch.com>

alecler@cam.org (Andre L.) writes:

> In the two following examples, I'm searching through an array for a match
> between two variables. If a match is found, I want to get out of the loop
> immediately, so that the $found flag retains the value true (I need it for
> later).

better

> # Example 1 -- unorthodox?
> foreach $new_val (@entries) {
>    $found = ($new_val eq $search_val) and last;
> }

worse

> # Example 2 -- more classic
> foreach $new_val (@entries) {
>    $found = ($new_val eq $search_val);
>    if ($found) { last; }
> }


IMO best

foreach $new_val (@entries) {
	last if $found = ($new_val eq $search_val);
}

also look into grep

$found = grep { $search_val_val eq $_ } @entries ;

the only weakness is that it looks at all entries, but the internal loop
is faster


hth,

uri
-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


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

Date: Thu, 26 Mar 1998 00:03:05 -0600
From: Bill Lubanovic <bill@tela.com>
Subject: Re: Sybperl return values
Message-Id: <3519EF99.B048A913@tela.com>

Gary Udstrand wrote:
> 
>         Could someone please tell me how I would determine the number of
> rows updated via a sybperl call?  This is perl 4.xx.
> 
>         Also, where can I find what subroutines are available via the
> Sybperl package?
>...

http://www.mbay.net/~mpeppler/Sybperl/sybperl.html

-- 
Bill Lubanovic   bill@tela.com    612-686-6289
Tela, Inc.            1024 Wedgwood Lane South
Eagan MN 55123-1936        http://www.tela.com
> Tela means web - web developers since 1993 <


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

Date: 26 Mar 1998 02:56:12 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: verifying email address -- how?
Message-Id: <890881341.373858@thrush.omix.com>

Mike King <m.king.garbage@praxa.garbage.com.au> wrote:
: You could verify that the domain exists using WHOIS

	This doesn't meen the host is valid however, which is
	more important:

	$ whois archive.rhps.org
	No match for "ARCHIVE.RHPS.ORG".

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 26 Mar 1998 00:34:34 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: || and 'or' - implications?
Message-Id: <3eg6xbf9.fsf@news.concentric.net>

ian@caliban.org (Ian Macdonald) writes:

> "(And you must also be careful to use 'or die' after the statement
> rather than '|| die', because the the precedence of || is higher than
> list operators like open)"

> Can someone explain to me in lucid terms what the implications are of
> using the symbolic and literal forms?

|| and 'or' are the same operators with different precedence.
Precedence affects the way in which perl decides how to bind a given
operand to an operator when it has a choice of operators.  For
example, here are some lines of code, followed by the same lines of
code with explicit parentheses, showing precedence:

   # || binds more tightly than ,
   opendir HERE, '.' || die "opendir: $!";
   opendir HERE, ('.' || die "opendir: $!"); #you don't want this

as opposed to

   # , binds more tightly than or
   opendir HERE, '.' or die "opendir: $!";
   opendir (HERE, '.') or die "opendir: $!"; #you want this

This is all explored in depth in the perlop document.  I, like many
other (mortal) perl programmers, keep a printout of the first page of
perlop right where I can see it.
-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Thu, 26 Mar 1998 00:54:36 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Ian Macdonald <ian@caliban.org>
Subject: Re: || and 'or' - implications?
Message-Id: <3519EDA1.B5A279DC@coos.dartmouth.edu>

[posted and mailed]

Ian Macdonald wrote:
> 
> Can someone explain to me in lucid terms what the implications are of
> using the symbolic and literal forms [of the logical operators]?
> If I develop good practice now, I won't have to unlearn bad habits later.

The only difference between the symbolic (&&, ||) and literal (and, or)
operators, aside from readability, is precedence.  && and || have high
precedence, and and or have low precedence.

Thus
{ open FOO, "bar" || die } is equivalent to { open FOO, ("bar" || die) }
{ open FOO, "bar" or die } is equivalent to { open (FOO, "bar") or die } *

On the other hand
{ $x = $a || $b } is equivalent to { $x = ($a || $b) } *
{ $x = $a or $b } is equivalent to { ($x = $a) or $b }

* What was probably intended

Check out the beginning of the perlop documentation for a complete precedence chart.

The best habit for you to get into is to use parentheses to explicity group
your expressions whenever it's not clear what the precedence is, and sometimes
even when it is clear.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 26 Mar 1998 06:55:47 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: || and 'or' - implications?
Message-Id: <3519ede3.524144494f47414741@radiogaga.harz.de>

Ian Macdonald (ian@caliban.org) wrote:
: I can't find this in the FAQ, so here goes:

: On page 191 of 'Programming Perl', in the section describing the use
: of the 'open' function, the following recommendation appears:

: "(And you must also be careful to use 'or die' after the statement
: rather than '|| die', because the the precedence of || is higher than
: list operators like open)"

: Now, I'm just starting out in Perl and recently finished reading
: 'Learning Perl', which on page 110 shows this use of the || operator
: without any warnings. In fact, throughout the rest of the book, it's
: this notation that is used and not 'or'.

: Going back to 'Programming Perl', on page 94 it says:

: As more readable alternatives to &&, ||, and !, Perl provides the
: 'and', 'or' and 'not' operators. The behaviour of these operators is
: identical - in particular, they short-circuit the same way."

: Frankly, I'm confused.

'Precedence' is the key to the difference. For example, if you write

open FILE, 'file.name' || die "Oops: $!";  # WRONG!

it will be interpreted as

open FILE, ('file.name' || die "Oops: $!");

On the other hand, if you use 'or' in the above statement, it will be
interpreted in the right way:

open FILE, 'file.name' or die "Oops: $!";

Of course, if you help Perl by parenthesising, it doesn't matter which
or operator you use:

open (FILE, 'file.name') || die "Oops: $!";

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

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

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