[8431] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2048 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 7 18:07:27 1998

Date: Sat, 7 Mar 98 15:00:26 -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           Sat, 7 Mar 1998     Volume: 8 Number: 2048

Today's topics:
    Re: "Learning Perl" or "Programming Perl" (I R A Aggie)
    Re: "Learning Perl" or "Programming Perl" (Gabor)
    Re: 501 error from www server <jdf@pobox.com>
    Re: Arrays and using output of executed program as inpu <jdf@pobox.com>
        ftp.pl (get hanging) <rconklin@monmouth.com>
    Re: ftp.pl (get hanging) <webmaster@fccjmail.fccj.cc.fl.us>
        Help! Suidperl doesn't work... <duhsty@mountain-inter.net>
    Re: Help: avoiding eval() on a grep() function. (Andrew M. Langmead)
    Re: IO::Select problem on Win 95 <webmaster@fccjmail.fccj.cc.fl.us>
    Re: Matching words anywhere in strings: need \A, \Z? <rjk@coos.dartmouth.edu>
    Re: Memory limitation of Perl for OS/2 <webmaster@fccjmail.fccj.cc.fl.us>
        NTPerl, get inet addr or name without the other? (Vincent Fatica)
    Re: Performance Question <jdf@pobox.com>
    Re: Performance Question (I R A Aggie)
    Re: Performance Question (Andrew M. Langmead)
    Re: Problem of passing two hashes to a function ?! Does <spp@colltech.com>
    Re: Q: obscuring Perl scripts? <webmaster@fccjmail.fccj.cc.fl.us>
    Re: Q: obscuring Perl scripts? <jhi@alpha.hut.fi>
    Re: RegEx Quiz Question <jdf@pobox.com>
    Re: RegEx Quiz Question <webmaster@fccjmail.fccj.cc.fl.us>
    Re: rsh hanging... (Tom Grydeland)
    Re: rsh hanging... (Kim Kiat Tan)
    Re: Script for RTrimming Fields <rjk@coos.dartmouth.edu>
        Script will not run <rayhall@internetnorth.com.au>
    Re: Special Characters <rjk@coos.dartmouth.edu>
        Win32::ODBC or ADODB <dave@mornet.com>
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl <steve@jrnl.com>
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl <steve@jrnl.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 07 Mar 1998 14:07:05 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <fl_aggie-0703981407050001@aggie.coaps.fsu.edu>

In article <6dr5il$q82$1@skytrain.asahi-net.or.jp>, "ITC"
<itccars@twics.com> wrote:

+ I share the feelings of Mr. Benjamin Smith about "Tom Christiansen's
+ behaviour". When I contacted him by E-mail to suggest him some necessary
+ point which I believe he had omitted in his current edition, he or one of
+ his pets put me off by his rude and proud reply.

I take it you got upset by his autoresponder. I would suggest getting
a thicker skin.

+ We should not support such people by buying their products.

That would be your choice. I choose to ignore Tom's behaviour, and
instead learn what I can from him.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 7 Mar 1998 22:33:23 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <slrn6g3je3.nmg.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, ITC <itccars@twics.com> wrote :
# I share the feelings of Mr. Benjamin Smith about "Tom Christiansen's
# behaviour". When I contacted him by E-mail to suggest him some necessary
# point which I believe he had omitted in his current edition, he or one of
# his pets put me off by his rude and proud reply. We should not support such
# people by buying their products.

People skills are important for salesman, not programmers.  He is
knowledgable and I wouldn't hesitate to buy a book written by him.  If
you'd rather by some schmoe's book who is all candy and no content, be
my guest.


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

Date: 07 Mar 1998 14:52:26 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: 501 error from www server
Message-Id: <yaym2s91.fsf@news.concentric.net>

"Dan Peterson" <petersongroup-nospam@home.com> writes:

>   my $req = POST 'http://$user:$pw@//<host-name>/index.cgi',

Do you realy intend to be sending the literal string '$user:$pw'?
Those single-quotes will not interpolate those scalars.  I'm sorry if
I've misunderstood your code, but I think that may be part of your
trouble.

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


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

Date: 07 Mar 1998 14:37:02 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Arrays and using output of executed program as input
Message-Id: <1zwe47j5.fsf@news.concentric.net>

keefner@kinetic.com (Craig Keefner) writes:

> >open(DOS_SEARCH, "/path/to/dos_search.exe /arg /arg2 |") or die "$!"; 
> ># now you can read from DOS_SEARCH, e.g.,
> >my @results = <DOS_SEARCH>;
> >close DOS_SEARCH or die "$!";
> 
> I had actually tried that and yes it works fine from the
> command line, but as part of a script which is run from
> the webserver it causes the server to "hang".
> Status bar reports server contacted. Waiting for reply...

I have sent mail to the cited author referring him to the
unfortunately named "Idiot's Guide" for CGI problems over at
language.perl.com.

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


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

Date: Sat, 7 Mar 1998 15:40:55 -0800
From: "Robert Conklin" <rconklin@monmouth.com>
Subject: ftp.pl (get hanging)
Message-Id: <6dser7$nl8$1@news.monmouth.com>

Hi,
Can anyone help me with a ftp problem??

I've written a perl script using the ftp package to download files. The
ftp::open and ftp::cwd commands work fine.
My problem is the ftp::get will retrieve about 10 files then hang. The get
is in a foreach loop if that make a difference.

Thanks,
Bob Conklin (rconklin@monmouth.com)





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

Date: Sat, 07 Mar 1998 22:37:29 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: ftp.pl (get hanging)
Message-Id: <3501CAEA.C504BD06@fccjmail.fccj.cc.fl.us>

Why wouldn't you want to
use 'ls' then parse what you want,
sort it, next use 'mget';  the
loop would be less painful :-)

IMHO,
Bill :-)



Robert Conklin wrote:

> Hi,
> Can anyone help me with a ftp problem??
>
> I've written a perl script using the ftp package to download files. The
> ftp::open and ftp::cwd commands work fine.
> My problem is the ftp::get will retrieve about 10 files then hang. The get
> is in a foreach loop if that make a difference.
>
> Thanks,
> Bob Conklin (rconklin@monmouth.com)





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

Date: 7 Mar 1998 20:05:28 GMT
From: "Dustin Stable" <duhsty@mountain-inter.net>
Subject: Help! Suidperl doesn't work...
Message-Id: <01bd4a04$c1d30a80$25c8f4cc@default>

Hi...

Sorry if I'm posting this to the wrong newsgroup, but I thought it was more
of a Perl question then a CGI question.

I've got some Perl scripts on my BSD web server which need to read and
write some files which have read and write permissions turned off for
'others'. I heard that by setting the set-user-ID bit, i.e. chmod u+s
*.cgi, you can have your scripts run as you, with the same permissions as
if you had run them from the command line.

Anyway...

I keep getting this error which I don't really understand: "Can't do suid".
The perldiag manpage says that this error means that the Perl interpreter
"could not exec suidperl". It further says that it "looks for a name of the
form sperl5.000 in the same directory that the perl executable resides
under the name perl5.000". There isn't a file called perl5.000 on the
server. In the /usr/contrib/bin directory, there is a program called
sperl5.001. I have execute but not read permissions for it. I don't know if
it matters, but there are also programs called suidperl5, sperl5 and perl5
in that directory. In my /usr/bin directory there are programs called
perl5, suidperl, and taintperl. I have execute permissions for them all.

Another problem is that the suid emulator wants the Perl interpreter to be
called "perl", but on my server that is the name for the Perl 4
interpreter. I need Perl 5. I got around this by creating a link to the
Perl 5 interpreter called "perl" in my home directory and putting that in
the #! lines in my scripts. I don't know if this has anything to do with
the other problem.

Please take the "h" out of "duhsty" when replying to this message...

Thanks in advance,
Alex Dowad


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

Date: Sat, 7 Mar 1998 20:27:17 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Help: avoiding eval() on a grep() function.
Message-Id: <EpGu5I.C5r@world.std.com>

Tommy <tkho@technologist.com> writes:

>Generally, my task is to write a subroutine to grep the list of the
>@Array which contains all the words in @Pattern.

Have you seen the FAQ entry "How do I efficiently match many regular
expressions at once?" <URL:http://www.perl.com/CPAN/doc/manual/
html/pod/perlfaq6/How_do_I_eficiently_match_many_.html>
 
>I have a workable subroutine AndMatch(); however, it is very slow. The
>major problem is the function eval().

One trick about eval() is to try to put it around the biggest loop you
can manage. (and count grep as a loop, even though it doesn't look
like one.)

eval "grep { /$STR1/i && /$STR2/i } \@Array"

will only perfrom one eval(), while yours does a separate eval for
every element of @Array.

-- 
Andrew Langmead


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

Date: Sat, 07 Mar 1998 22:47:31 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: IO::Select problem on Win 95
Message-Id: <3501CD44.6063CD2C@fccjmail.fccj.cc.fl.us>

Do you want to assign a value, like this -

(What you wrote)
  if( @ready = $sel->can_read() )


Or test for equality?  IE -

(What I think, probably wrong :-)
  if( @ready == $sel->can_read() )
(Or, if text, use 'EQ')

HTH,
Bill


dave wrote:

> Hi,
>
> Here is some code I'm trying to get working onWin 95:  It  just keeps
> printing "I did not block!".  What's wrong?
>
> Thanks,
> Dave
>
> -- code begins here---
>
> #/user/bin/perl -w
>
> use IO::Select;
>
> $sel = IO::Select->new();
> $sel->add( \*STDIN );
> for(;;)
> {
>   if( @ready = $sel->can_read() )
>   {
>     print "Got some input.\n";
>     for $fh ( @ready )
>     {
>       if( $fh == STDIN )
>       {
>         print $inp if defined( $inp = <STDIN> );
>       }
>     }
>   }
>   print "I did not block!\n"; sleep 1;
> }
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> dlripberXisoc.net (sub X with shunned char)
> http://www.isoc.net/dlripber
>
> /--\./==\./ee\./oo\./--\





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

Date: Sat, 07 Mar 1998 00:22:53 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: pse@euclid.jpl.nasa.gov
Subject: Re: Matching words anywhere in strings: need \A, \Z?
Message-Id: <3500D9B2.C59CAD1@coos.dartmouth.edu>

[posted and mailed]

Peter Scott wrote:
> 
> Wanting to detect and count number of occurrences of the word "abc" in $str,
> I wrote:
> 
>         $str = "abc def abc def abc ghi abc";
>         $count= () = $str =~ /\Wabc\W/ig;  # require 5.004 :-)
> 
> but this misses the first and last "abc".  My next attempt was:
> 
>         $count = () = $str =~ /(?:\W|\A)abc(?:\W|\Z)/ig;
> 
> which works.  But it looks darn ugly.  Am I missing an easier way?

Yes.

$count = () = $str =~ /\babc\b/ig;

\b matches a word boundary, which is defined as the position between a word
character and a non-word character.  End of string and beginning of string are
treated as non-word characters.

-- 
 _ / '  _      /         - 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: Sat, 07 Mar 1998 22:27:14 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Memory limitation of Perl for OS/2
Message-Id: <3501C883.72CF3D81@fccjmail.fccj.cc.fl.us>

The memory issue is not Perl, it is a problem with
versions of OS/2 prior to OS/2 Warp Connect v3 and
can be corrected with Service Pack 17 or 22
(SP are accumulative.)

If you are on OS/2 Warp Connect, SP 17 is available
for free (see www.os2bbs.com), otherwise you
must upgrade to Warp Connect.


HTH,
Bill
------------------------------------------------------------------
//  (Webmaster, FCCJ @ www.fccj.org  &  Co-Admin for
//  the ShadowMAC BBS @ www.shadowmac.org)



Ilya Zakharevich wrote:

> [A complimentary Cc of this posting was sent to ic
> <altmann@zoology.ubc.ca>],
> who wrote in article <6dr6gs$h2c$1@nntp.ucs.ubc.ca>:
> > To OS/2 users:
> >
> > It looks like the version of Perl that I am using on OS/2 does not use any
> > more than 32 megs of RAM.  Has anyone else run into a similar problem?
> >
> > Do you know a version of the interpretor that can use more than 32 megs
> > of RAM on OS/2?
>
> Time to upgrade?
>
> D:\tcpip\tmp>perl -e "$a= 'a'; $a x= shift; print length $a" 40e6
> 40000000
>
> Ilya





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

Date: Sat, 07 Mar 1998 21:21:08 GMT
From: vefatica@syr.edu (Vincent Fatica)
Subject: NTPerl, get inet addr or name without the other?
Message-Id: <3501b7e4.657628760@news.ican.net>

With NT Perl (5.001) is it possible to (and how might I) get either the internet
name or internet address of the local computer without knowing the other (NT
4.0, dial-up, dynamic address/name)?

I'm new to this group, and sorry if this is an oft-asked question.

Please email.

Thanks.

 - Vince
___
   Vincent Fatica
   Syracuse University Mathematics
   vefatica@syr.edu
   http://barnyard.syr.edu/~vefatica/


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

Date: 07 Mar 1998 14:48:41 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Performance Question
Message-Id: <zpj22sfa.fsf@news.concentric.net>

elwood@rumba.m.isar.de (Konstantinos Agouros) writes:

> I want to check a string that's entered by the user against some regular
> expressions I read from a config-file. Now I am wondering what is the fastest
> way to do that:

This is addressed in perlfaq6, under the heading "How do I efficiently
match many regular expressions at once?"  The solution given there
makes use of eval, the /o regex modifier, and closures.  If you want a
simpler solution, but are still concerned with efficiency, you may
want to write a subroutine for each method of your choice, and then
time them using the standard Benchmark module.  I hope this helps.

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


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

Date: Sat, 07 Mar 1998 15:12:05 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Performance Question
Message-Id: <fl_aggie-0703981512050001@aggie.coaps.fsu.edu>

In article <1998Mar7.104903.4026@rumba.m.isar.de>, elwood@rumba.m.isar.de
(Konstantinos Agouros) wrote:

+ a) Put the expressions in an array and do something like 
+ foreach $exp(@ARRAY)
+ {
+   if($string =~ /$exp/)
+   .....
+ 
+ b) Generate one regexp in the form exp1|exp2|exp3|exp4|exp5...
+ and do one match against that. 

c)

@matches=grep /$string/, @ARRAY;
if ($#matches > -1) {
   print "matched!\n";
} else {
   print "no match!\n";
}

I don't know if this is faster, per se, but it only needs on pass
to find a match.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Sat, 7 Mar 1998 20:28:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Performance Question
Message-Id: <EpGu7u.Cty@world.std.com>

elwood@rumba.m.isar.de (Konstantinos Agouros) writes:

>Hello,

>I want to check a string that's entered by the user against some regular
>expressions I read from a config-file. Now I am wondering what is the fastest
>way to do that:

Have you seen the FAQ entry "How do I efficiently match many regular
expressions at once?" <URL:http://www.perl.com/CPAN/doc/manual/
html/pod/perlfaq6/How_do_I_eficiently_match_many_.html>
-- 
Andrew Langmead


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

Date: 06 Mar 1998 16:48:26 -0600
From: Stephen Potter <spp@colltech.com>
Subject: Re: Problem of passing two hashes to a function ?! Doesn't work.
Message-Id: <uu1zwf8mh1.fsf@psasolar.private.psa.pencom.com>

Geert Roovers <Geert.Roovers@POBoxes.com> writes:
> This problem is described in "Perl 5 by Example" (There is an on-line
> version available at http://www.affy.com/p5be), chapter 8. The solution
> appears to be that you put a backslash infront of each hash in the
> function call. I cannot test this, because I -still - do not have Perl
> 5.

Well, it is a bit more complicated than simply putting a \ in front of the
hashes.  You actually need to understand what references are and how to use
them.  The \ creates a reference to the hash, which is a scalar.  So,
instead of both the hashes getting flattened and sent as a single list, you
are only sending two references to hash.  Then, you need to dereference
them within the subroutine.

Looking at perldata and perlref will probably help you out, as would
Chapter 4 of the Camel.

-spp

-- 
Stephen P Potter     |~~~~|                     |~~~~|   spp@colltech.com
Ph: 312-781-1111     |____| C o l l e c t i v e |____|   Team "OH, Yeah!"
Pg: 800-759-8888,    |_______                 _______|   Webstreet Securities
      571-1869              []  technologies []        jthome.jthome.com/~spp
			     a pencom company


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

Date: Sat, 07 Mar 1998 22:12:24 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <3501C509.8C9FBFD0@fccjmail.fccj.cc.fl.us>

Somehow I think the point was missed...

Steve Palincsar wrote:

> And you actually paid good money for a product with code that looks
> like this?  What does that make you?  And what "useful purpose"
> has been thus served other than protecting the bug from correction?
>
> This product could walk on water, double my agency's appropriation and
> be totally free of charge and I wouldn't recommend we even test it.
>
> Steve Palincsar
>



> >
> > $bgYF =
> > "JExzZGlyID0gIi4vIjskV3NhVXcgPSAwOyRybVRPRXYgPSAwOyRGUVp4b3kgPSAwOyZaYkV
> > KcXI7aWYgKCRGUVp4b3kgPT0gMSkgeyR0VVdRSyA9ICJMaW5rU3B5ZGVyIjsgfQ==";eval(&TKuB($b
> > gYF));
> > $cfQkd = "";foreach $mUDBJ (@ARGV) {$cfQkd = "$cfQkd $mUDBJ";}$cfQkd =~
> > s/^\s*//
> > ;print "\n$tUWQK Version $wzSO.\n\n";
> >
> > [etc.]





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

Date: 08 Mar 1998 00:31:03 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <oeehg5a2kwo.fsf@alpha.hut.fi>


Bill Jones <webmaster@fccjmail.fccj.cc.fl.us> writes:
: Somehow I think the point was missed...

Yes, and not probably by Steve.

The only thing thusly encrypted software would tell to me is that the
software vendor does not trust me.  He does not trust me not to leak
his code and/or he does not trust his own code so much that he could
show it it plaintext.  Therefore, why should I trust him?
Some proponents for such mangling moan that what if the customer
modifies the code, breaks it, and then sues them for the damages?
Well, again, that does not sound like trust to me.

Yes, scripting languages are exceptional in the sense that giving the
executable product and the source code are the same and only.  Selling
the first one forces you to give the second one.  Nevermind.  It is
still all down to trust.

: Steve Palincsar wrote:
: > And you actually paid good money for a product with code that looks
: > like this?  What does that make you?  And what "useful purpose"
: > has been thus served other than protecting the bug from correction?
: > This product could walk on water, double my agency's appropriation and
: > be totally free of charge and I wouldn't recommend we even test it.
: > Steve Palincsar
: > > $bgYF =
: > > "JExzZGlyID0gIi4vIjskV3NhVXcgPSAwOyRybVRPRXYgPSAwOyRGUVp4b3kgPSAwOyZaYkV
: > > KcXI7aWYgKCRGUVp4b3kgPT0gMSkgeyR0VVdRSyA9ICJMaW5rU3B5ZGVyIjsgfQ==";eval(&TKuB($b
: > > gYF));
: > > $cfQkd = "";foreach $mUDBJ (@ARGV) {$cfQkd = "$cfQkd $mUDBJ";}$cfQkd =~

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 07 Mar 1998 14:35:25 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: RegEx Quiz Question
Message-Id: <3egu47lu.fsf@news.concentric.net>

Bill Jones <webmaster@fccjmail.fccj.cc.fl.us> writes:

> ($client,$host) = /(\d+\.\d+\.\d+\.\d+).+ > (\d+\.\d+\.\d+\.\d+)/
>      if /P \d+:\d+\((\d+)\)/ && $1 > 0;
> 
> The above is from Lincoln Stein's 'sniffer'.
> 
> Would someone please help me understand it
> a little better?

That depends on what you mean by "understand!"  I don't know the
context of that line, though I can parse the code.

The second half of the line (which begins with "if") goes first, and
looks for a pattern like

   P 133:34(2112)

capturing the parenthesized number in $1.  If that number is non-zero,
the first half of the line is evaluated.  That match looks for a
canonical ip address (like 206.173.15.12) followed by some other
characters, a space, a right angle-bracket, another space, and another
ip address.  Those two addresses are captured and assigned to the
variables $client and $host, respectively.

I'm being deliberately brief, because I don't even know if this is the
kind of explanation you're looking for; maybe you're already a regex
whiz, and you just need to know *why* those patterns are relevant.
That, I don't know.  If you'd like to see the regexes broken down
explicitly, let me know.

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


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

Date: Sat, 07 Mar 1998 22:34:58 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: RegEx Quiz Question
Message-Id: <3501CA53.910820F@fccjmail.fccj.cc.fl.us>

No, I know nothing about RegEx
(yes I own lots of Perl books,
mainly all from ORA :-)  But
I am embedded so far into
'C' I cannot see Perl clearly
sometimes :-)

I don't want to write
substr($A, rindex($A, index( blah blah blah)));

I want to write $A =~ stuff
(like Randal, only better! :-)

So, your explaination is fine :-)
I can 'copycat' code til I am
blue in the face, but no
closer to understanding
why d+, et al, is used,
you know?

Thx,
Bill :-)

Jonathan Feinberg wrote:

> Bill Jones <webmaster@fccjmail.fccj.cc.fl.us> writes:
>
> > ($client,$host) = /(\d+\.\d+\.\d+\.\d+).+ > (\d+\.\d+\.\d+\.\d+)/
> >      if /P \d+:\d+\((\d+)\)/ && $1 > 0;
> >
> > The above is from Lincoln Stein's 'sniffer'.
> >
> > Would someone please help me understand it
> > a little better?
>
> That depends on what you mean by "understand!"  I don't know the
> context of that line, though I can parse the code.
>
> The second half of the line (which begins with "if") goes first, and
> looks for a pattern like
>
>    P 133:34(2112)
>
> capturing the parenthesized number in $1.  If that number is non-zero,
> the first half of the line is evaluated.  That match looks for a
> canonical ip address (like 206.173.15.12) followed by some other
> characters, a space, a right angle-bracket, another space, and another
> ip address.  Those two addresses are captured and assigned to the
> variables $client and $host, respectively.
>
> I'm being deliberately brief, because I don't even know if this is the
> kind of explanation you're looking for; maybe you're already a regex
> whiz, and you just need to know *why* those patterns are relevant.
> That, I don't know.  If you'd like to see the regexes broken down
> explicitly, let me know.
>
> --
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY





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

Date: 7 Mar 1998 19:23:01 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: rsh hanging...
Message-Id: <slrn6g37kl.ngv.Tom.Grydeland@mitra.phys.uit.no>

On Fri, 06 Mar 1998 23:40:23 GMT,
Kim Kiat Tan <kktan@concentric.net> wrote:
> I have the following code :

> $out = `rsh rmthost .\test`;

Are you absolutely sure you have a program named .<tab>test ?


-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Sat, 07 Mar 1998 20:17:13 GMT
From: kktan@concentric.net (Kim Kiat Tan)
Subject: Re: rsh hanging...
Message-Id: <6dsaah$r8d@examiner.concentric.net>

In article <slrn6g37kl.ngv.Tom.Grydeland@mitra.phys.uit.no>, Tom.Grydeland@phys.uit.no (Tom Grydeland) wrote:
>On Fri, 06 Mar 1998 23:40:23 GMT,
>Kim Kiat Tan <kktan@concentric.net> wrote:
>> I have the following code :
>
>> $out = `rsh rmthost .\test`;
>
>Are you absolutely sure you have a program named .<tab>test ?
>

well, it is typo, it is supposed to by $out=`rsh rmthost ./test`, and yes, the 
program does run.


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

Date: Sat, 07 Mar 1998 15:43:04 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Script for RTrimming Fields
Message-Id: <3501B159.A4390290@coos.dartmouth.edu>

? the platypus {aka David Formosa} wrote:
> 
> what is wrong with s/(.*?)\s*$/$1/

For starters, it's a lot slower than the simple s/\s*$//;

-- 
 _ / '  _      /         - 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: Sun, 08 Mar 1998 08:23:46 +1000
From: Ray Hall <rayhall@internetnorth.com.au>
Subject: Script will not run
Message-Id: <3501C8F2.4624357C@internetnorth.com.au>

Could some one please tell me what is wrong with this script, I get
error 500 when it is run. The script searches a text file for a
sub-string and returns the line containing the search string.

#!/usr/local/bin/perl
Content-type: text/html

  $file = "cgi-bin/Parts/gar.dat";
  $query = $ENV{QUERY_STRING};

 open (DATA_FILE, $file);

  while (<DATA_FILE>) {
       $dataline = $_;

       if ($dataline =~ $query) {
           print "$-";
           last;
       }
  }

  close($file);



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

Date: Fri, 06 Mar 1998 23:44:34 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Special Characters
Message-Id: <3500D0B5.F2537394@coos.dartmouth.edu>

Abigail wrote:
> 
> Puzzle: How do I escape $, @ and \ in interpolative strings without using \?

You could store them in variables, and interpolate the appropriate variable in
place of each character.

($dollar, $atgry, $backslash) = ('$', '@', '\\');

print "I have ${dollar}4.00.\nrjk${atgry}coos.dartmouth.edu\nC:$bslash\n";

Of course, you could also use a hash.

%chars = (dollar => '$', atgry => '@', backslash = '\\');

-- 
 _ / '  _      /         - 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: Sat, 07 Mar 1998 11:41:44 -0800
From: Dave Moore <dave@mornet.com>
Subject: Win32::ODBC or ADODB
Message-Id: <3501A2F8.63B1@mornet.com>

I recently read in a fact somewhere that ADODB was supposedly faster
than Win32::ODBC.  Does anyone know if this has any merit?



if you could cc my email it would be much appreciated.

BTW I am looking for example programs that use Win32::ODBC or ADODB on
an NT/IIS4.0 machine to access a MSAccess97 Database.  Has anyone seen
any good working examples of shopping carts systems, Calender systems
anything that writes to and Access database, I have been searching for a
while and have found very little (ie Dialogue Forums etc.)

Thanks
Again in advance

dave


PERL ROCKS !


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

Date: Sat, 07 Mar 1998 16:07:05 -0500
From: Steve Rountree <steve@jrnl.com>
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <3501B6F9.61AF@jrnl.com>

Abigail wrote:
> 
> Colin Dooley (colin@medit3d.com) wrote on 1634 September 1993 in
> <URL: news:34EDBD17.16475955@medit3d.com>:
> ++ Steve Dover wrote:
> ++ >
> ++ > Time marches on, but by design, a given date or timestamp datam
> ++ > will only be allocated so many bits.  At some point in time,
> ++ > more bits will need to be allocated.  There's no way around it.
> ++
> ++ In a billion years the Sun will explode and you won't need to
> ++ worry about it any more. This suggests that a 64 bit time_t
> ++ ought to be enough...
> 
> We already have machines outside of the solar system. What makes
> you think we won't have another one in the next billion years?
> 
> Abigail
> --
> perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'

I thought the number was more like 5 billion years till nova but, before it actually
goes, its circumference will have expanded to the point where our orbit will fall inside of
its surface as it ages and becomes a red giant.  Anyone still hanging around on terra firma
will be crispy long before that.

I think a 64 bit time_t value will give us enough time to worry about other things like
terraforming other planets, near-speed of light travel, etc. that will allow us to escape
that eventuality.  Once we are all settled on our new home planet(s), then we can worry that the
variable space limitations of our time stamp only allows us 5 googols of bit space.


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

Date: Sat, 07 Mar 1998 16:09:37 -0500
From: Steve Rountree <steve@jrnl.com>
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <3501B791.3520@jrnl.com>

Abigail wrote:
> 
> Colin Dooley (colin@medit3d.com) wrote on 1634 September 1993 in
> <URL: news:34EDBD17.16475955@medit3d.com>:
> ++ Steve Dover wrote:
> ++ >
> ++ > Time marches on, but by design, a given date or timestamp datam
> ++ > will only be allocated so many bits.  At some point in time,
> ++ > more bits will need to be allocated.  There's no way around it.
> ++
> ++ In a billion years the Sun will explode and you won't need to
> ++ worry about it any more. This suggests that a 64 bit time_t
> ++ ought to be enough...
> 
> We already have machines outside of the solar system. What makes
> you think we won't have another one in the next billion years?
> 
> Abigail
> --
> perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'

I thought the number was more like 5 billion years till nova but, before it actually
goes, its circumference will have expanded to the point where our orbit will fall inside of
its surface as it ages and becomes a red giant.  Anyone still hanging around on terra firma
will be crispy long before that.

I think a 64 bit time_t value will give us enough time to worry about other things like
terraforming other planets, near-speed of light travel, etc. that will allow us to escape
that eventuality.  Once we are all settled on our new home planet(s), then we can worry that the
variable space limitations of our time stamp.  Perhaps moving it up to a googol of bit space.
I doubt that we will be computing in any similar manner by then, though.


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

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

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