[13187] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 597 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 20 03:07:25 1999

Date: Fri, 20 Aug 1999 00:05:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 20 Aug 1999     Volume: 9 Number: 597

Today's topics:
    Re: adding 30 days (Abigail)
    Re: Adding up a Data Variable   Completely Lost perl sc (Larry Rosler)
        DBD with several databases - is it possible? <jriera@retemail.es>
    Re: determining a leap year (Abigail)
        Determining Session Uniqueness (Dan Kubb)
    Re: Determining Session Uniqueness <kenhirsch@myself.com>
    Re: directory reading (Neko)
    Re: DWIM redux (Was: Why use Perl when we've got Python (Sam Holden)
    Re: exponentiation please explain what it means <meowing@banet.net>
    Re: exponentiation please explain what it means (Abigail)
    Re: HARASSMENT -- Monthly Autoemail <Bill@fuckyou.co.uk>
    Re: Help with CGI and PERL <pleasenomail@privacy.org>
        LWP Legality Issue? <church@NOSPAMspinn.net>
    Re: LWP Legality Issue? (brian d foy)
        Matching E-mail <tungyat@yahoo.com>
        Newbie : tr/// question (JustYaz)
    Re: newbie CGI question re CGI.pm toby@NCHM03A59.RMT.UTK.EDU
    Re: newbie CGI question re CGI.pm (either Jana or John)
    Re: Perl Exam Beta Testers Required (brian d foy)
        Perl Expressions?? (Gary Lefko)
    Re: please explain (Larry Rosler)
        Regular Expression?? (Pete)
    Re: Regular Expression?? <griffinc@ameritech.net>
    Re: Request for Comments: www.perl.com (Abigail)
    Re: what does eq do on lists? (Abigail)
    Re: what does eq do on lists? (Abigail)
    Re: While loop being ignored <wyzelli@yahoo.com>
        Why $|++ (was: Re: perl system()) (Abigail)
    Re: Why use Perl when we've got Python?! <kj0@mailcity.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 20 Aug 1999 01:26:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: adding 30 days
Message-Id: <slrn7rpt9h.ath.abigail@alexandra.delanet.com>

Jimmy Humphrey (jimmy@blackhole-designs.com) wrote on MMCLXXVII September
MCMXCIII in <URL:news:37B9CD80.E9496D2C@blackhole-designs.com>:
;; I was wondering how I could go about adding 30 days to the current date.

my $hours_in_a_day      = 24;  # Except where void.
my $minutes_in_an_hour  = 60;  # Magic!
my $seconds_in_a_minute = 60;  # Usually.


sub add_days_to_current_time ($) {
    my $number_of_days = shift;
    die if !defined $number_of_days || $number_of_days =~ /\D/;

    sleep $number_of_days     *
          $hours_in_a_day     *
          $minutes_in_an_hour *
          $seconds_in_a_minute;
    localtime;
}



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 19 Aug 1999 22:56:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Adding up a Data Variable   Completely Lost perl script
Message-Id: <MPG.12268df4a6d02829989e7a@nntp.hpl.hp.com>

In article <7pig1u$311@newsops.execpc.com> on Thu, 19 Aug 1999 21:53:43 
-0500, E-Z Auction <Ezjy@execpc.com> says...

<SNIP more than 140 lines of previous posts>
 
> Hi,
>      Thanks, I will see how this works, By the way no its not for school so
> Pretty doesn't matter. Just that it works. You have restored my Sanity.
> 
> Mike

Thanks are OK, but quoting everything without having anything to comment 
on is decidedly not OK.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 20 Aug 1999 07:45:52 +0200
From: "Juan Riera" <jriera@retemail.es>
Subject: DBD with several databases - is it possible?
Message-Id: <7piqt6$iqe1@SGI3651ef0>

Hello,
I am just new to DBI/DBD. I have sucessfully configured  my access to MySQL
(thanks to several comp.lang.perl.misc posts helping me). As I must actually
use Sybase, I would like to know if can I have several DBD accesses
simultaneoulsy configured and open on Perl, reading from one Sybase table
and writing on MySQL.
Can I have my Perl configured to access, say, MySQL, Sybase and DB2
(Msql-Mysql modules, DBD-Sybase and DBD-DB2 installed)

Thanks,
Juan




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

Date: 20 Aug 1999 01:55:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: determining a leap year
Message-Id: <slrn7rpv1k.bf8.abigail@alexandra.delanet.com>

Linda Minnich (lin.minnich@usa.net) wrote on MMCLXXVI September MCMXCIII
in <URL:news:37b80e37.3412597@nntp.lucent.com>:
&& Does anyone know much about an algorithm to determine whether or not
&& the current year is a leap year or not?  I'm trying find one!  I don't
&& remember how many years are inbetween leap years, or even when the
&& last or next one is!!! If you could just help me out with that tiny
&& amt of info I would be greatful and I could write my own algorithm.


So... what's your Perl question?



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 20 Aug 1999 05:10:17 GMT
From: dankubb@canada.com (Dan Kubb)
Subject: Determining Session Uniqueness
Message-Id: <37bce1ab.1098751@news.intergate.ca>

Hi,

A few programmers and myself are designing a shopping
cart system  where we have to determine the
uniqueness of a given user.  We record all the information
we can gather from the host computer by looking at
the %ENV hash, and grab things like IP address, etc.

Of course, this is to determine uniqueness if cookies
are turned off. If on, it is relatively easy to track.

What I would like to know, has anyone found any other
ways to determine uniqueness of a user?

One of the other programmers suggested polling each of
the user's ports, the idea is that different O/S's would
give back different results, and combined with other
known methods, this could work.  I am not sure
I like this idea, it might not be welcomed by remote
users.

If any of you have any little known ideas, please let me
know.

Dan


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

Date: Fri, 20 Aug 1999 01:32:53 -0400
From: "Ken Hirsch" <kenhirsch@myself.com>
Subject: Re: Determining Session Uniqueness
Message-Id: <7pipml$1a9$1@oak.prod.itd.earthlink.net>


Dan Kubb <dankubb@canada.com> wrote in message
news:37bce1ab.1098751@news.intergate.ca...
> Hi,
>
> A few programmers and myself are designing a shopping
> cart system  where we have to determine the
> uniqueness of a given user.  We record all the information
> we can gather from the host computer by looking at
> the %ENV hash, and grab things like IP address, etc.
>
> Of course, this is to determine uniqueness if cookies
> are turned off. If on, it is relatively easy to track.
>
> What I would like to know, has anyone found any other
> ways to determine uniqueness of a user?
>
> One of the other programmers suggested polling each of
> the user's ports, the idea is that different O/S's would
> give back different results, and combined with other
> known methods, this could work.  I am not sure
> I like this idea, it might not be welcomed by remote
> users.

This will not work.  Firewalls are going to block access to ports for one
thing.  Anyway, different users' HTTP request can come from the same IP
address at the same time and from the same port within a few minutes of each
other.  One user's requests can come from different ports, even from
different IP addresses (do you want them to start over if their ISP
disconnects?).

The only way you can track a session without cookies is to dynamically
generate URLs that have the session ID embedded in them, or, equivalently,
insert CGI variables in the URL or POST that include the session ID.






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

Date: 20 Aug 1999 05:40:44 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: directory reading
Message-Id: <7pipos$eu3$0@216.39.141.200>

On Fri, 20 Aug 1999 02:24:21 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
wrote:

>In article <37BC8863.96CE4A05@cisco.com>,
>	Makarand Kulkarni <makkulka@cisco.com> writes:
>> Yes. Make it a side effect of using map.
>>  map { $hash {$directory. $_} = -s $_ }grep(!/^\./,readdir(ZIPDIR));
>
>Or if you don't like map in a void context, and side effects which are
>not immediately clear:
>
>my %files = map { ("$directory/$_", -s $_) } grep { !/^\./ } readdir DIR;
                                        ^
                                        "$directory/$_"

my %files = map { $_, -s } map "$directory/$_", grep !/^\./, readdir DIR;

-- 
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: 20 Aug 1999 04:20:59 GMT
From: sholden@staff.cs.usyd.edu.au (Sam Holden)
Subject: Re: DWIM redux (Was: Why use Perl when we've got Python?!)
Message-Id: <slrn7rpluc.9sg.sholden@staff.cs.usyd.edu.au>

On 20 Aug 1999 04:00:21 GMT, kj0 <kj0@mailcity.com> wrote:
>In <37b30253@cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:
>
>>Another principle underlying much of Perl is that "things that
>>act different should look different".  This allows you to write
>>programs in Perl that are *easier* to read, because different things
>>don't look like each other.  Python tends to obscure this.
>
>>For example, that's one reason why when you want numeric ordering you
>>use "==", but when you want lexical ordering you use an operator that
>>looks completely different: "eq".   Likewise, because an array and a hash
>>are, despite their interconvertibility, fundamentally different things,
>>they *look* different.
>
>This runs counter to the whole DWIM thing...  There's nothing DWIM about:
>
>  DB<1> print "dog" == "cat"
>1

That does exactly what IM.

>Conversely, one could argue that integer and float arithmetic is a
>different beasts, so that it is proper that they should look
>different:
>
>  3/4 vs. float(3)/float(4)

DWIM with numbers to me means treat them as numbers. Not as integers or
floats. If I asked someone what 3 divided by 4 was, they would say 3/4
or 0.75. They would not say 0.

3/4 == 0 is a restriction to intergers, since no restriction is needed,
it shouldn't apply. Of course if I want to use integer math I can, and
if I want the interger answer I can get that too. Since they are
less likely what I want I have to add an 'int' here or there.

>
>DWIM implies that the language will deal with multiple interpretations
>whereas "things that act different should look different" leaves the
>resolution of these possible interpretations to the programmer;
>i.e. these two principles tug in opposite directions.

I see no contridiction. DWIM implies that hopefully in the majority of cases
a construct will do what the author meant. Things that act different looking
different implies you can tell what is going to happen by how it looks.

$tim = $fred + $bill;

Has a well defined meaning in perl (ignoring operator overloading which since
it is not as trivial as in C++, is not overused so much in perl). It adds
$fred and $bill as numbers (converting to numbers if necessary) and stores
the result in $tim).

If I want to concatenate the strings $fred and $bill I don't use +. If I did
then the same code would do vastly different things depending on the values
of $fred and $bill.

They look different because they are different.
-- 
Sam

Another result of the tyranny of Pascal is that beginners don't use
function pointers.
	--Rob Pike


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

Date: 20 Aug 1999 00:10:14 -0400
From: meow <meowing@banet.net>
Subject: Re: exponentiation please explain what it means
Message-Id: <87wvuray8p.fsf@banet.net>

Ben Horowitz <bzhaainc@erols.com> wrote:

Exponentiation is raising a number to a power.  But if you didn't know
that, you probably don't need to care.

> and whats the diffrence between chop ,and chop,

None that I can see :P

Have you looked in perlfunc?  If not, go do that.  If you have, what
parts didn't make sense?

> and when do you use 1 punctuation mark and 2,thanks

In Perl, the more punctuation you use, the better.  Except when you
need to use less.  Really, you'd have to say what punctuation you're
having a problem with.


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

Date: 20 Aug 1999 01:59:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: exponentiation please explain what it means
Message-Id: <slrn7rpv8g.bf8.abigail@alexandra.delanet.com>

Ben Horowitz (bzhaainc@erols.com) wrote on MMCLXXX September MCMXCIII in
<URL:news:7pihko$m5r$1@autumn.news.rcn.net>:
-- and whats the diffrence between chop ,and chop,and when do you use 1

Well, his one leg is longer.

-- punctuation mark and 2,thanks


1 is informal, and 2 is polite. Just like the difference between
"Yes" and "Yes, Ma'am".



Abigail
-- 
sub J::FETCH{Just   }$_.='print+"@{[map';sub J::TIESCALAR{bless\my$J,J}
sub A::FETCH{Another}$_.='{tie my($x),$';sub A::TIESCALAR{bless\my$A,A}
sub P::FETCH{Perl   }$_.='_;$x}qw/J A P';sub P::TIESCALAR{bless\my$P,P}
sub H::FETCH{Hacker }$_.=' H/]}\n"';eval;sub H::TIESCALAR{bless\my$H,H}


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 20 Aug 1999 06:26:56 -0700
From: William Pettrey <Bill@fuckyou.co.uk>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37BD57A0.558@fuckyou.co.uk>

Tom Christiansen wrote:

> 
> If someone asks me to stop mentioning to them every month or three that
> their postings have been mangled and maybe they should check into it, then
> I put an entry in the database so they don't get sent that reminder again.
> 
> I should put the modules, programs, and datafiles that I use for all
> this up again so that everyone can play.  Peer pressure works.
> 

My, you must have a hell of a lot of time on your hands! All this just
to harass people? What could possibly motivate you to do this? Were you
picked on by the bigger boys in high school? You can't be getting paid
for this nonsense so what is it? As you can see by the responses in this
thread, nobody wants your pathetic little bot-mails.

> Timesharing: the use of several people by the computer
>--tom

Timesharing: the use of one brain by several self-appointed news group
moderators.
--Bill


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

Date: Fri, 20 Aug 1999 00:11:44 -0500
From: "Dan" <pleasenomail@privacy.org>
Subject: Re: Help with CGI and PERL
Message-Id: <is5v3.15177$gO1.506423@news2.giganews.com>

David,

I would advise you to get familiar with Perl and CGI with some simple
tutorial that you can find on TheWebCowboy.com
http://thewebcowboy.com

cheers,
Daniel

David C <dcohny@earthlink.net> wrote in message
news:7pch1f$r6b$1@holly.prod.itd.earthlink.net...
>     I am new to perl and CGI.   I need my program to simply take
information
> from a text field and put it into an array. I also need this array to be
the
> criteria for what to delete in a backend flat file.  I will include my
> source.  Could someone point me in the right direction in what I am doing
> wrong.  The addition to the backend flat file works fine, just the
deletion
> does not.  Thanks in advance.
>
>
>
>
>
>
>
>




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

Date: Thu, 19 Aug 1999 23:58:42 -0600
From: "DC" <church@NOSPAMspinn.net>
Subject: LWP Legality Issue?
Message-Id: <Qa6v3.7$151.15985@news.gstis.net>

I use LWP::UserAgent to go to several sites and post my data to their
forms.  When I first go to the site, I re-display their FORM code on my
page, so I
know exactly what fields are needed for data.  The Form submission string
is then saved to a file and then I send additional data there at a later
time.

 An example would be that I get the Altavista site content, re-display only
 the search form code on my site (only temporarily), grab the specific FORM
VARIABLE NAMES and VALUES, then save them to a file for later use.  I
could then run this script automatically later on now that I have the
correct
information.  I could use this to see what rankings are appearing at the
top of the QUERY on all the major search engines or something.

 My questions is this:  Is this a copyright violation if I re-display ONLY
THE FORM portion of their website temporarily ONCE, so I can enter the
correct search information into the FORM manually?

 Thanks in advance.

 dan :)

dchurch@kabana.net





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

Date: Fri, 20 Aug 1999 00:05:54 -0700
From: brian@pm.org (brian d foy)
Subject: Re: LWP Legality Issue?
Message-Id: <brian-2008990005550001@28.sanjose-08-09rs16rt.ca.dial-access.att.net>

In article <Qa6v3.7$151.15985@news.gstis.net>, "DC" <church@NOSPAMspinn.net> wrote:


> An example would be that I get the Altavista site content, re-display only
> the search form code on my site (only temporarily), grab the specific FORM
>VARIABLE NAMES and VALUES, then save them to a file for later use.  I
>could then run this script automatically later on now that I have the
>correct
>information.  I could use this to see what rankings are appearing at the
>top of the QUERY on all the major search engines or something.
>
> My questions is this:  Is this a copyright violation if I re-display ONLY
>THE FORM portion of their website temporarily ONCE, so I can enter the
>correct search information into the FORM manually?

no decision has been made on this, although the people from whom you
are stealing data are trying to get laws passed to protect them.

if you want legal advice, ask a lawyer.  this has nothing to do with
Perl.

-- 
brian d foy


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

Date: Fri, 20 Aug 1999 04:18:06 GMT
From: "Winter" <tungyat@yahoo.com>
Subject: Matching E-mail
Message-Id: <2G4v3.5979$dr6.134029@news1.rdc2.on.home.com>

Hi,

Can anyone write a regular expression to detect email address? I have a line
of string $str may or may not contain email adress..

Thanks in advance for you help, if you can help, please send it to
ty.wong@utoronto.ca

Regards,
Winter




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

Date: 20 Aug 1999 05:52:30 GMT
From: justyaz@aol.com (JustYaz)
Subject: Newbie : tr/// question
Message-Id: <19990820015230.11105.00001229@ng-bh1.aol.com>

I looked through the FAQ on www.activestate.com to find out the
answer to my queestion.  Maybe I missed something but I did not
find an answer. Why does this function not accept character classes
as defined in Table 7-1 of the Gecko book?
   ie.
      tr/\s+/\|/s; # does not accept \s as a space

I would think that it would look for a space and the s modifier
would get rid of the multiple spaces but it does not.  It completely
ignores the spaces and looks for the characters \, s and +.  This
other reg expresion does though.
   ie.
      tr/ /\|/s;

I am hoping that someone could possibly explain to me why this
is so.  It would be much preferred however if you could point me
to a location in the FAQ that explains this, IMO, inconsistency.
I had assumed that it would work similar to the s// function but
it does not so would appreciate any insight to what I am
misinterpretting

Peace, Vm
Yaz


Peace,   Vm
Yaz


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

Date: 20 Aug 1999 00:50:29 -0400
From: toby@NCHM03A59.RMT.UTK.EDU
To: quikscor@ix.netcom.com (either Jana or John)
Subject: Re: newbie CGI question re CGI.pm
Message-Id: <m3yaf7m4x6.fsf@NCHM03A59.RMT.UTK.EDU>

quikscor@ix.netcom.com (either Jana or John) writes:


> #!/user/bin/perl -w 

Ok. Here's the problem that I see. You need to find out 
where perl lives. I don't know where the sysadmins for your 
ISP parked it, but this line (the shebang) doesn't sit right 
with my eyes(/usr/bin/perl, maybe?). You need to find out where
 perl resides on your system. I would contact them though. 
Or if you have command line access:

shell$>which perl

Toby


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

Date: Fri, 20 Aug 1999 06:28:07 GMT
From: quikscor@ix.netcom.com (either Jana or John)
Subject: Re: newbie CGI question re CGI.pm
Message-Id: <37bcf447.76033615@nntp.ix.netcom.com>

You're right, I checked the online ISP FAQ, the path should have been
#!/usr/bin/perl
I fixed it -- same exact error message

I found that my permissions were wrong --
couldn't execute.  I changed the directory and
the file to 755. -- same exact error message

Also -- remember I don't know this code, I just copied it from a book 
I changed the q's to p's because all the other examples in the
book have p's.  I know it's lame, but I'm dying to get something
running. -- same exact error message.  (I kept the p's, BTW)

On 20 Aug 1999 00:50:29 -0400, toby@NCHM03A59.RMT.UTK.EDU wrote:

>quikscor@ix.netcom.com (either Jana or John) writes:
>
>
>> #!/user/bin/perl -w 
>
>Ok. Here's the problem that I see. You need to find out 
>where perl lives. I don't know where the sysadmins for your 
>ISP parked it, but this line (the shebang) doesn't sit right 
>with my eyes(/usr/bin/perl, maybe?). You need to find out where
> perl resides on your system. I would contact them though. 
>Or if you have command line access:
>
>shell$>which perl
>
>Toby



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

Date: Fri, 20 Aug 1999 00:01:49 -0700
From: brian@pm.org (brian d foy)
Subject: Re: Perl Exam Beta Testers Required
Message-Id: <brian-2008990001500001@28.sanjose-08-09rs16rt.ca.dial-access.att.net>

In article <rroqeequboh63@corp.supernews.com>, "Stephen Collins" <scollins@co-active.com> wrote:

>Would anyone like to beta test the Perl exam in a shortly-to-be-released
>online technical screening system?

i assume, that like any ethical company, you are compensating your
focus group participants.

-- 
brian d foy


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

Date: Fri, 20 Aug 1999 05:21:06 GMT
From: lefkogt@worldnet.att.net (Gary Lefko)
Subject: Perl Expressions??
Message-Id: <37bce596.11193059@netnews.worldnet.att.net>

Noticed in first post my identity was fouled, my correct email is
below:

Something simple I would think ...

We're using DBMAN (www.gossamer-threads.com) a Perl flat-file db
application.  It allows for regular expression searches, we can do
"or" searches -- cats|dogs -- OK but how do you do "cats and dogs?" in
a PERL regular expression?  The searches iterate through the form
fields looking for matches.

Gary
lefkogt@worldnet.att.net


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

Date: Thu, 19 Aug 1999 22:51:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: please explain
Message-Id: <MPG.12268cce4e50408c989e79@nntp.hpl.hp.com>

In article <3dxhoj9b.fsf@wind.localdomain> on 17 Aug 1999 21:33:20 -
0600, ljp <ljp@209.204.251.8> says...
> why this-
> my $pattern1='<IMG ALIGN="bottom" BORDER=0 HEIGHT=9 HSPACE=3 SRC="image.bmp">';
>   my $pattern2=' ';
> 
> @$data = grep {s/$pattern1/$pattern2/} @$data; 
> 
> replaces <IMG ALIGN=\"bottom\" BORDER=0 HEIGHT=9 HSPACE=3
> SRC="image.bmp"> and everything preceding the first match, but
> correctly substitutes after the first match? I thought
> pattern substitution was supposed to match the exact pattern specified
> in $pattern1?

The grep function selects only those elements where the pattern match 
succeeds.  My guess is that you want simply to apply the match to every 
element.

  s/$pattern1/$pattern2/o for @$data; 

where I added the /o/ so the regex is complied once only, as the pattern 
is constant.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 20 Aug 1999 05:19:20 GMT
From: lucky@worldnet.att.net (Pete)
Subject: Regular Expression??
Message-Id: <37bce4c2.10981194@netnews.worldnet.att.net>

Something simple I would think ...

We're using DBMAN (www.gossamer-threads.com) a Perl flat-file db
application.  It allows for regular expression searches, we can do
"or" searches -- cats|dogs -- OK but how do you do "cats and dogs?" in
a PERL regular expression?  The searches iterate through the form
fields looking for matches.

Gary


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

Date: Fri, 20 Aug 1999 01:26:13 -0500
From: Griffin Caprio <griffinc@ameritech.net>
Subject: Re: Regular Expression??
Message-Id: <37BCF505.427A2B90@ameritech.net>

Pete wrote:
> 
> Something simple I would think ...
> 
> We're using DBMAN (www.gossamer-threads.com) a Perl flat-file db
> application.  It allows for regular expression searches, we can do
> "or" searches -- cats|dogs -- OK but how do you do "cats and dogs?" in
> a PERL regular expression?  The searches iterate through the form
> fields looking for matches.
> 
> Gary
/cats/ && /dogs/
-- 
"Six simple words: 'I'm not gay, but I'll learn'" -Homer Simpson


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

Date: 20 Aug 1999 00:18:18 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Request for Comments: www.perl.com
Message-Id: <slrn7rppaj.ath.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXXX September
MCMXCIII in <URL:news:37bc93cd@cs.colorado.edu>:
~~ I would like to solicit from you answers to the following questions:
~~ 
~~     What you don't like at www.perl.com

$ lynx -dump http://www.perl.com | grep -c '\[INLINE\]'
3
$ lynx -dump http://www.perl.com | grep -c 'bullet'
6
$ lynx -dump http://www.perl.com | head -2

blank.gif
$ lynx -source http://www.perl.com | grep -i -c 'FONT  *FACE'
6
$ lynx -source http://www.perl.com | grep -i -c 'FONT [^>]*SIZE'
15
$

In other words, www.perl.com gives the impression to be designed for
looks. Sites designed for looks tend to lack content. So, why go there?


I seldomly go there. Even before it was redesigned. I used to go there
when it was still run from someones home in Colorado. But I quickly
lost interest after O'Reilly took over. The only times I visit
www.perl.com is when someone gives a specific URL somewhere on the site,
with a description that tickles my interest.

I recently noticed that a very significant time of my "web surfing"
is spend viewing documents of type "text/plain", which seems to be
quickly re-replacing HTML as the lingua franca of the net.


~~     What you would like to see at www.perl.com
~~     What you might like to help with at www.perl.com


The sad thing is, I wouldn't miss www.perl.com if it was suddenly gone
and would never reappear.



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Aug 1999 01:11:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: what does eq do on lists?
Message-Id: <slrn7rpsdg.ath.abigail@alexandra.delanet.com>

John M. Dlugosz (john@dlugosz.com) wrote on MMCLXXVIII September MCMXCIII
in <URL:news:208F7691D51D04B1.335619AA67C52965.B642C04DE1838C7C@lp.airnews.net>:
__ The expression
__     @a[0..3] eq @b
__ doesn't do what I thought it would.  It's not a compile-time error, either.
__ So what does it do, if not compare all four strings?  It produces undef in
__ the case I expect true, when b has four elements that match the first four
__ elements of a.


eq forces scalar context on its arguments. @a [0 .. 3] is a *slice*, while
@b is an *array*. A slice does the same as a list in scalar context, it
returns the last element. However, an array in scalar context returns the 
number of elements.

Now, if you know that $" isn't a substring in any of the strings you
are comparing, you can take use of the fact that a slice in string
context acts like an array, and compare them as:

   "@a[0..3]" eq "@b"

Of course, if you don't know whether $" can be contained, you end up with
writing a loop.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Aug 1999 01:18:10 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: what does eq do on lists?
Message-Id: <slrn7rpsqs.ath.abigail@alexandra.delanet.com>

Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote on MMCLXXVIII September
MCMXCIII in <URL:news:slrn7rk4v9.die.sholden@pgrad.cs.usyd.edu.au>:
$$ 
$$ @a = (1,2,3,4,5,6,7,8,9,10);
$$ @b = (1,2,3,4);
$$ print "match" if (@a[0..3] eq @b);
$$ 
$$ Will output match...

Never, ever use arrays 1 .. n or 0 .. n to proof anything general about
your code. Witness:

    @a = ( 4) x 10;
    @b = (10) x  4;

    print "match" if @a [0 .. 3] eq @b;

This will output "match" ....




Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 20 Aug 1999 16:04:10 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: While loop being ignored
Message-Id: <AF6v3.6$ui4.3550@vic.nntp.telstra.net>

elephant <elephant@squirrelgroup.com> wrote in message
news:MPG.122644e6b1d0059a989c55@news-server...
> Wyzelli writes ..
> >I change it to
> >
> >while (<MAIL>){
> >    print MAILTEMP $_;
> >}
> >
> >And still get nothing...
> >
> >There is definitely something in the source file
>
> then print out the value of $MailLoginFile just after the open .. make
> sure that it contains what you think it does
>
> if it is what you think .. then post all your relevant code
>
> >What I have found is that a debugger break-point set at the while
statement
> >is skipped as if it is a comment...
>
> if the condition is false then the debugger will not break on that line
> .. like I've been indicating - the while will happen unless it's false
> .. it'll be false when an EOL is read from the file
>
> --
>  jason - elephant@squirrelgroup.com -

Thanks for the ideas..

Still no go...

I have sent the entire script and files to solutionsoft for analysis.

Hopefully they don't come back and tell me I am and idiot... :^)

Wyzelli




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

Date: 20 Aug 1999 00:42:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Why $|++ (was: Re: perl system())
Message-Id: <slrn7rpqo2.ath.abigail@alexandra.delanet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXXX September
MCMXCIII in <URL:news:37BC9BE1.C225EA2D@mail.cor.epa.gov>:
## 
## $|++;


Why "$|++;"? I've seen this before, and frankly, it baffles me why
someone would want to use this instead of "$| = 1;".

Would it be faster? No... a simple benchmark shows it's slower, 
by almost a factor of 2.5:

    #!/opt/perl/bin/perl -w

    use strict;

    use Benchmark;

    timethese (1000000, {
        empty    => sub {local $|;},
        plusplus => sub {local $|; $| ++},
        set      => sub {local $|; $| = 1},
    });

    __END__

    Benchmark: timing 1000000 iterations of empty, plusplus, set...
         empty: 13 secs (11.35 usr  0.00 sys = 11.35 cpu)
      plusplus: 19 secs (17.32 usr  0.02 sys = 17.34 cpu)
           set: 15 secs (13.81 usr  0.00 sys = 13.81 cpu)


Would it be clearer? Well, no, not at all. "$| = 1;" tells it all, while
to know what "$| ++;" does, you would need the previous value of "$|".

Is it that "$| = 1;" isn't always correct? Well, in fact, "$| = 1;" will
*always* turn of buffering, while "$| ++;" would enable buffering if, for
whatever reason, "$| == -1;". 


So, except for being obscure on purpose, why "$| ++;"?

Or is this some form of cargo cult programming?



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Aug 1999 04:18:31 GMT
From: kj0 <kj0@mailcity.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7pikun$6o$1@news.panix.com>

In <37b4531e@cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:

>     [courtesy cc of this posting mailed to cited author]

>In comp.lang.perl.misc, 
>    Skip Montanaro <skip@mojam.com> writes:
>:Along the lines of DWIM, the following seems to me to be a DWIMish
>:shortcoming in Perl:
>:    echo 'print "19" + "14.5";' | perl
>:    33.5
>:Python recognizes that I explicitly fed it strings:
>:    echo 'print "19" + "14.5";' | python
>:    1914.5

>What you would be misunderstanding there is the "+" operator.  That
>operator in Perl means "add two numbers".  It never means concatenate
>two strings.  That's what the "." operator is for.  The reason that this
>happens is because of the terrible troubles we all used to experience
>in awk because of the darned language trying to outguess the progammer.

One man's "outguessing the programmer" is another man's DWIM...


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 597
*************************************


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