[7108] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 733 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 14 18:07:16 1997

Date: Mon, 14 Jul 97 15:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Jul 1997     Volume: 8 Number: 733

Today's topics:
     Re: '' and "" + a question to the C Wizards <malunjkars@aol.com>
     2 xor 0 -> 1 (??) (Grant Reaber)
     [q] building perl5 on irix 6.2 (Peter Lees)
     A script to change passwd <dsamani@nc.com>
     adressing SCSI devices <lbaltus@declanet.nl>
     Re: bug in MailTools package? (Erik Braun)
     Re: Dear Spammer!  We are NOT happy with you. aca97922@hiu.ac.jp
     Re: eof() && sockets? <cmason@ti.com>
     Re: Extracting Expressions (Bob Wilkinson)
     Re: File permission in Perl (M.J.T. Guy)
     Re: Help needed: Regexps (pattern matching) with hashes (Chris Schleicher)
     Help! Need to run a script! <jsenecal@ucsd.edu>
     Re: help-print using labels gives error (Clay Irving)
     Re: Learning Perl ..Help?? (Charles Lin)
     Learning Perl book (Kevin D Ruggiero)
     Re: Lotus Notes && PERL <kermit@ticnet.com>
     Re: Lotus Notes && PERL <boei@trifox.com>
     Re: Newbie needs help with searching an array (Mark Nielsen)
     PERLIS.dll? from activeware <ran@ventura.co.il>
     Re: PERLIS.dll? from activeware (Chris Schleicher)
     Re: Regex with nested ()'s, ? (Tung-chiang Yang)
     Re: regexp- capturing matched pattern with an alternati (M.J.T. Guy)
     Search and replace problem. <bison@enterprise.net>
     Re: String Comparison (Christopher Hamilton)
     Total Environment allocation failure <uma@heidelbg.ibm.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 12 Jul 1997 02:02:59 -0700
From: Sanjay Malunjkar <malunjkars@aol.com>
Subject: Re: '' and "" + a question to the C Wizards
Message-Id: <33C74842.DBDB1F0@aol.com>

Yee Man, Chan wrote:

> $a = "a";
> $temp1 = '${a}bc\n';
> $temp2 = "${a}bc\n";

Didn't  understand the perl question .

But here's the answer to your C question:

All the work is done by F_OO() function which sets F=-202,OO=-16.
therefore 4.*F/OO/OO=3.156

First line defines a macro with name _. and this macro is used in the
F_OO()
function.

first line in the F_OO() expands to
F-->00 || F-OO-- ;-F-->00 || F-OO--;-F-->00 || F-OO--;F-->00 || F-OO--
which has 4 statements.

First statement decrements both F & OO leaving F=-1 and OO=-1. Here
F-->0
is false and therefore it will execute other part of the or condition
thereby
decrementing OO.

second,third and fourth statements only descrement F because -F-->00 is
going to evaluate to true as  -F-- will be +ve which is > 0
(decrementing F as side effect).
Since  first part of the || condition is true other part(s) of the same
won't be evaluated as  logical operators are short circuited in C.
First line will leave F=-4,OO=-1. Each line decrements OO only once.
There are sixteen lines in F_OO. Each _ macro decrements F exactly
once.  And there are 202 _ macros. Therefore at the end of F_OO() OO=-16
and F=-202.

Hope that makes sense. Surprisingly,the _- are in the shape of a circle.

>
> Here is a mysterious little C program which I obtained from the web.
> It
> is said to be able to compute pi. It really works and prints 3.156.
> Can
> any C Wizards out there can help me to understand it?
>
> #define _ F-->00 || F-OO--;
> long F=00,OO=00;
> main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
> {
>             _-_-_-_
>        _-_-_-_-_-_-_-_-_
>     _-_-_-_-_-_-_-_-_-_-_-_
>   _-_-_-_-_-_-_-_-_-_-_-_-_-_
>  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
>  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
>  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
>  _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
>   _-_-_-_-_-_-_-_-_-_-_-_-_-_
>     _-_-_-_-_-_-_-_-_-_-_-_
>        _-_-_-_-_-_-_-_-_
>             _-_-_-_
> }





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

Date: 14 Jul 1997 19:08:25 GMT
From: greaber@joker.cme.nist.gov (Grant Reaber)
Subject: 2 xor 0 -> 1 (??)
Message-Id: <5qdtf9$hs42@news.nist.gov>


How come "2 or 0" and "0 or 2" evaluate to 2, but "2 xor 0" and "0 xor
2" evaluate to "1"?  In other words, how come "and" and "or" both
return interesting true values, but "xor" just returns boring old 1?

Grant



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

Date: 14 Jul 1997 01:55:50 GMT
From: peter@junior.next.com.au (Peter Lees)
Subject: [q] building perl5 on irix 6.2
Message-Id: <5qc0v6$747@inferno.mpx.com.au>


g'day

i'm having an 'interesting' time building perl on SGI IRIX 6.2
with SGI cc.

i'm getting lots of warnings about ANSI defines being undefined, but
more importantly the DB_File dynamic module doesn't want to build:

        Making DB_File (dynamic)
        LD_RUN_PATH="/usr/local/lib" cc -o ../../lib/auto/DB_File/DB_File.so  -shared -L/usr/local/lib DB_File.o    -L/usr/local/lib -ldb 
ld: ERROR 48: Cannot access registry file ./so_locations (No locks available) - ignored.
ld: FATAL 51: Can't assign virtual addresses for DB_File.so within specified range.  Please check your registry file ./so_locations.
*** Error code 1 (bu21)
*** Error code 1 (bu21)


the ./so_locations file doesn't seem to exist. can anyone suggest 
what i might be missing?   do i need to use some extra flags with 
ld, or set an environment variable for the registry file?

thanks in advance.

(fwiw - perl5 builds fine on my irix 5.3 using GCC)

p


--
Peter Lees  (peter@next.com.au)   -   Technical Manager,   Next Online
tel: +61 2 9310 1433 *  fax: +61 2 9310 1315  * http://www.next.com.au

"You can have a day off when you're dead, Baldrick, and not before..."


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

Date: Mon, 14 Jul 1997 01:02:19 -0700
From: dsamani <dsamani@nc.com>
Subject: A script to change passwd
Message-Id: <33C9DD0B.41C67EA6@nc.com>

Would anybody know how to change the following script so it reads
from the passwd program, and writes to it ? Any help is greatly
appreciated.

--D


#!/usr/bin/perl
#Change my passwd to $NewPass

use FileHandle;
use IPC::Open2;
$NewPass="A_String_2";
$SomeUserNAme="MyName";
$pid=open2( \*Reader, \*Writer, "passwd $SomeUserName" );
$AnInput=<Reader>;	#First, throw away the first line
print Writer "$NewPass\n";
sleep(2);
print Writer "$NewPass\n";


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

Date: 14 Jul 1997 14:15:50 GMT
From: "L. Baltus" <lbaltus@declanet.nl>
Subject: adressing SCSI devices
Message-Id: <01bc9060$48b7da80$020101c0@pcman_2.declanet.nl>

I am not very familiar with perl so bear with me.

I would like to read, write set scsi devices so I can
rewind, set blocklength, set density,(of course write
and read data) etc. from/to SCSI devices like DAT, EXABYTE
and 1/2" tapes.
Can you do that (how?) with perl? Do I need specific modules.
BTW I am using SCO-Unix 3.2v4.2 and 3.2v5.0 as my perl platform

Thanks

--
  Leo Baltus                       Email : lbaltus@DeclaNet.nl
  DeclaNet C.V., The Netherlands   Tel.  : +31 33 4534411



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

Date: 14 Jul 1997 09:51:21 GMT
From: erik@paxp01.mipool.uni-jena.de (Erik Braun)
Subject: Re: bug in MailTools package?
Message-Id: <slrn5sjtko.o93.erik@paxp01.mipool.uni-jena.de>

On Fri, 11 Jul 1997 14:33:11 +0200, Tomas Pospisek <tpo@NoSpam.spin.ch> wrote:

>    my $fh   = $msg->open;
>    print $fh "bla";
>    $fh->close;
>
>------------------------
>now what I get is:
>------------------------
>
>~s DB - Online Formular
>bla


I answered this questions 4 days ago in this newsgroup.
>From dejanews:

You use a strange mail program. Try sendmail:

 ...
  my($fh) = $msg->open('sendmail');
  print $fh "$text";
  $fh->close;
 ...

and everything will be fine.

bye, erik
-- 
erik@minet.uni-jena.de


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

Date: 14 Jul 1997 10:38:35 GMT
From: aca97922@hiu.ac.jp
Subject: Re: Dear Spammer!  We are NOT happy with you.
Message-Id: <aca97922.22ee9d2aYAT1@wsb39.hiu.ac.jp>


In article <33C6685B.3338@sungardams.com>
	David Director <ddirecto@sungardams.com> writes:

 >
 >Richard Greene wrote:
 >> 
 >> There is a WEB site run by the E-MAIL Marketing Council. They "claim" that if
 >> you register with them to have your name removed from mailings by their
 >> "spammer" members they will pass it to them. Their main interest is to stop
 >> pending congressional legislation which could potentially put them out of
 >> business. Their address is
 >>                           http://www.jemmc.org
 >
 >I just tried to get to that web site and got a 404 message, "hostname
 >unknown".
 >
 >-- David
--


     Hello! David.
I,m japanese student. My name is Kyoko Hasegawa. 
Please call me "Kyoko". I live in Saitama-Ken, near the Tokyo.
I going to Heisei International University in the first-year.
ad: http://www.hiu aca97922



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

Date: Mon, 14 Jul 1997 16:09:48 -0500
From: Chris Mason <cmason@ti.com>
Subject: Re: eof() && sockets?
Message-Id: <33CA959C.5A7D@ti.com>

Austin Schutz wrote:
> Chris Mason wrote:
> > fcntl(Incoming, F_SETFL, O_NONBLOCK) || die (...);
> [stuff]
> >                 eof ($storesocket) && die("oh dear.\n");
> >                 # always "oh dear."
> >         }
> >         select(), etc...
> > }
> >
>         I'm not sure if this applies to socket io but what can work for files
> is to use the 4 argument version of select() and sysread(). With
> files, select will return true if the filehandle is ready and wants to
> spit an eof at you. When you actually sysread() from the handle it will
> return 0 if it hits an eof.

Well, it seems that sysread() returns the number of characters it read,
which when non-blocking is zero unless there is data on the socket,
which (because its network and non-blocking) there may not be.

Using something like:

if (!sysread($socket,...)) {
	debugmsg("Connection has closed.\n")
	#...
}

seems to always close the connection.

So does anyone else have ideas?  I need to be able to determine whether
a non-blocking network connection has closed.

Thanks for the help so far.

-c

--
Chris Mason <cmason@ti.com> -- Sterling Software - COOL:Cubes Dev
"...the monstrous thing is not that men have created roses out of 
 this dung heap, but that...they should _want_ roses." -H. Miller


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

Date: Mon, 14 Jul 1997 14:29:10 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Extracting Expressions
Message-Id: <b.wilkinson-1407971429100001@ip57-york.pindar.co.uk>

In article <01bc8b1b$b42c47f0$16069ccf@uranus>, "Dan Wright"
<dan@electronet.net> wrote:

> I am trying to use a global substitution on a file to reformat its contents
> from plain text into HTML on the fly.
> 
> The file has lines like this:
> 
> This is Headline 1
> ------------------------------------
> 
> This is the text that may be several lines or even...
> 
> Another paragraph.
> 
> This is Headline 2
> -------------------------
> 
> More text.
> 
> Even more text.
> 
> 
> I want to make it look like:
> 
> <TR><TD BGCOLOR=WHITE>This is Headline 1</TD></TR>
> <TR><TD>This is the text that may be several lines or even...<BR>
> Another paragraph.</TD></TR>
> 
> <TR><TD BGCOLOR=WHITE>This is Headline 2</TD></TR>
> <TR><TD>More text.<BR>Even more text.</TD></TR>
> 
> Currently I have:
> 
> $wholefile = s/\w+\-+/<TR><TD BGCOLOR=WHITE>$1</TD></TR>/g;
> 
> I have never used PERL to replace expressions, only exact matching. I can't
> find an example of what I'm trying to do anywhere??
> 
> Your help would be appreciated.
> 
> Thank you,
> Dan Wright

Hello,

      You can do this with a multi-stage pass over your data. This is my first
attempt. It does work, however. I'm sure though, that there are more elegant
solutions....

#!/usr/local/bin/perl -w
use strict;
use diagnostics;
undef $/;
my $wholefile = <DATA>;
$wholefile =~ s|^([^\n]+)\n\-{2,}\n{2,}|<TR><TD BGCOLOR=WHITE>$1</TD></TR>\n<TR>
<TD>|g;
$wholefile =~ s|\n{2}([^\n]+)\n\-{2,}\n{2,}|</TD></TR><TR><TD BGCOLOR=WHITE>$1</
TD></TR>\n<TR><TD>|g;
$wholefile =~ s|\n{2,}|<BR>|g;
$wholefile =~ s|</TR><TR>|</TR>\n\n<TR>|g;
print STDERR $wholefile,"</TD></TR>\n";

__DATA__
This is Headline 1
------------------------------------

This is the text that may be several lines or even...

Another paragraph.

This is Headline 2
-------------------------

More text.

Even more text.

which gives as output

<TR><TD BGCOLOR=WHITE>This is Headline 1</TD></TR>
<TR><TD>This is the text that may be several lines or even...<BR>Another paragra
ph.</TD></TR>

<TR><TD BGCOLOR=WHITE>This is Headline 2</TD></TR>
<TR><TD>More text.<BR>Even more text.<BR></TD></TR>

-- 
 .sig file on holiday


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

Date: 14 Jul 1997 17:43:25 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: File permission in Perl
Message-Id: <5qdoft$lmp@lyra.csx.cam.ac.uk>

Dan Brian  <dan@clockwork.net> wrote:
>Does someone know how to read a file owner in Perl? I am trying to
>compare the permissions of two files to one another. How can this be
>done? The executable is run as root.

Try the "stat" function in perlfunc.


Mike Guy


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

Date: 14 Jul 1997 11:36:15 -0700
From: chrissch@cs.uoregon.edu (Chris Schleicher)
Subject: Re: Help needed: Regexps (pattern matching) with hashes?!
Message-Id: <5qdriv$bss@psychotix.cs.uoregon.edu>

In article <33C8DB9A.5D91BE9B@ping.de>,
Roman Blvth <R.Bloeth@ping.de> wrote:
> This all works fine and fast, but I wonder whether it would be
> possible to look up the keys using pattern-matching, so that a search
> for "dogs" will also reveal pages with the word "cyberdogs" - so to
> say I'm wanting something like $hash{/dogs/}, but surely this won't
> work.

How about:

    @matches = grep { /dogs/ } keys %hash;


Hope this helps,

--Chris
-- 
     Chris Schleicher                      Office:  541/346-3998
     Univ of Oregon CIS GTF                email: chrissch@cs.uoregon.edu
                URL: http://www.cs.uoregon.edu/~chrissch/


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

Date: Fri, 11 Jul 1997 10:21:34 -0700
From: Joshua Senecal <jsenecal@ucsd.edu>
Subject: Help! Need to run a script!
Message-Id: <33C66B9E.5365@ucsd.edu>

I'm new to the PERL scene. I have a PERL script (.pl file) that I need
to run, but I haven't a clue how. Can anyone help me out?

Please reply by mail.

Thanks!

---Matt
   msenecal@ucsd.edu


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

Date: 14 Jul 1997 08:49:04 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: help-print using labels gives error
Message-Id: <5qd780$8ja@panix.com>

In <33c77d69.1763804@news.erols.com> cdoxey@erols.com (Clay Doxey) writes:

>I am using Perl Version 5.003 onm salaris.

>Can anyone tell me what I'm doing wrong?

>When I run the following script, I receive "Can't find string
>terminator "VVVVV" anywhere before EOF at test.cgi line 2."

>#!/opt/gnu/bin/perl 
>print  <<VVVVV
>Test Line 1
>Test Line 2
>VVVVV

It runs fine with Solaris 2.4 and SunOS with Perl 5.003 -- Are there
any spaces before the terminating "VVVVV" in the real program?

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: 14 Jul 1997 18:49:19 GMT
From: clin@cs.umd.edu (Charles Lin)
Subject: Re: Learning Perl ..Help??
Message-Id: <5qdsbf$43t@mimsy.cs.umd.edu>

Brian Lavender (brian@brie.com) wrote:
|| [mailed,posted]

|| You ask about Randal's first example from the book Learning Perl.That
|| example works all by itsself in the unix shell. I found that example
|| gave me a big bite of perl all at once. I was quite overwhelmed by it.
|| I had to take a few hours to understand and absorb it. The rest of the
|| book is gradual and well developed, but on the second edition of the
|| book which should be out soon if it is now out already will hopefully
|| be more tame in the beginning. I think that example may scare people
|| off. 

    I wonder if this is an O'Reilly style?    That is, the first chapter
is a quick run through everything, and the rest of the book deals with
smaller portions.   I think it's a weird idea, if this is true.   Why
try to cram everything into one chapter when you should start gently
and work your way through?   If you need a "do-it-all" chapter, make
it an appendix, and direct non-beginners there.

--
Charles Lin
clin@cs.umd.edu


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

Date: 14 Jul 1997 18:34:43 GMT
From: kdr@cs.buffalo.edu (Kevin D Ruggiero)
Subject: Learning Perl book
Message-Id: <5qdrg3$pq5@prometheus.acsu.buffalo.edu>


has anybody checked out the new Learning Perl, Second Edition by O'Reilly
yet?  I think it just came out this month (July), and I was wondering if
it was any good.  I'd like to learn the basics of Perl as quickly as
possible, and I heard the first one edition of this book was pretty good.

-Kevin Ruggiero
kdr@cs.buffalo.edu


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

Date: Fri, 11 Jul 1997 10:30:36 -0500
From: Kermit Tensmeyer <kermit@ticnet.com>
Subject: Re: Lotus Notes && PERL
Message-Id: <33C6519C.31665931@ticnet.com>

Uma Shanker wrote:

> Olaf Menzel wrote:
> >
> > Hello,
> > -------
> > I am writing on a project for solving the IP-traffic of our LAN.
> > Therefore I have a Accounting Daemon working on a UNIX machine. I
> ist
> > written in PERL.
> > I like to put the accouting data to a Notes database. Does anybody
> know of a
> > PERL - Notes API. I don't like to put the data first to
> SQL-Database, hello Olaf,
>         we also spended lots of time looking after Notes - Perl
> interface. At
> last we are doing like this.
> Our agent is running in domino, which reqularly reads data
> files(ascii)
> , created by PERL Programms.
> Not a good idea but its working because we don't wanna change existing
>
> PERL programms so much. And don't want to write in lotus script so
> much.
>

  Since there is an odbc interface to Notes, why not update the data
views for a given database, and let the other notes views present the
information for the dominio server?






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

Date: Mon, 14 Jul 1997 09:30:23 -0700
From: Bob Eisner <boei@trifox.com>
To: Olaf Menzel <menzel@tfh-berlin.de>
Subject: Re: Lotus Notes && PERL
Message-Id: <33CA541F.67DE@trifox.com>

Olaf Menzel wrote:
> 
> Hello,
> -------
> I am writing on a project for solving the IP-traffic of our LAN.
> Therefore I have a Accounting Daemon working on a UNIX machine. I ist
> written in PERL.
> I like to put the accouting data to a Notes database. Does anybody know of a
> PERL - Notes API. I don't like to put the data first to SQL-Database, like
> DB-2 or Sybase and import the data from Sybase with Notes.
> 
> Thank you for your help
> 
> Olaf
> 
> --
> ---
> OLAF MENZEL    < menzel@tfh-berlin.de >
> Maximilianstr. 12 B | D-13187 Berlin    | GERMANY | Tel: +49 30 47303266
> "Where the Spirit of the Lord is,there is liberty." Bible: 2.Cor. 3:17

Hi Olaf,

What platform do you have Lotus Notes running on? (Windows NT, OS/2,
etc).

If Notes is running on Windows NT, then we can provide a solution with
our
VORTEXperl product.  It uses Perl Sockets so there is no need to
re-build
the Perl runtime.  The VORTEXperl product communicates with our
VORTEXserver
product (just like a type 3 JDBC driver would) via TCP/IP.  Our
VORTEXserver
product has an ODBC compatible driver (a plug) which can communicated
with
Notes via their ODBC driver.

     Unix machine            Windows NT machine

      Perl                     
       VORTEXperl    <---->   VORTEXserver
                                ODBC driver
                                  Lotus Notes



VORTEXPerl provides a simple interface for Perl applications to
access all leading relational and legacy databases via the
VORTEX database access and performance boosters, like
VORTEXaccelerator, the industry-leading high performance
transaction process monitor. With VORTEXPerl you can quickly
access DBMS information from CGI applications and spend your
time making your application great without bothering with DBMS
details. 

Please see http://www.trifox.com/j/vortex/vtxperl.html for details.

The VORTEXserver evaluation for Windows NT (Intel) can be obtained
from our FTP server at:
  
    ftp://ftp.trifox.com/pub/products/nt/eval.zip

The VORTEXserver evaluation for Windows NT (Alpha) can be obtained
from our FTP server at:
  
    ftp://ftp.trifox.com/pub/products/nt_alpha/eval.zip


Regards,

Bob Eisner
408 369-2392



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

Date: 14 Jul 1997 14:09:29 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Re: Newbie needs help with searching an array
Message-Id: <5qdq0p$i31$1@auto.med.ohio-state.edu>

Here is what I would do

@Result = ();
foreach $User (@FirstArray)
  {
  if (grep($_ eq $User, @SecondArray))  
    {
    push (@Result,$User);
    print "$User found in second array.\n";
    }
  else {print "$User not found in second array.\n";}
  }


-- 
---------------------------------------------------------------------------
Mark Nielsen	men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University


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

Date: Mon, 14 Jul 1997 11:44:02 -0700
From: ran <ran@ventura.co.il>
Subject: PERLIS.dll? from activeware
Message-Id: <33CA7372.7FE2@ventura.co.il>

Hi,

I've downloaded PERL5.003 (not beta) from activeware.com a few
days ago. When I downloaded it I saw that there is also an extention for
IIS that can be downloaded but I didn't DL it that instance.

I can execute scripts in PERL from IIS (which uses ".pl as
c:\perl\bin\perl.exe %s %s") but I cannot pass variables to the
scripts.

I guess that I need that extention BUT! I can't reach www.activeware.com
anymore, does anyone know what happened to them or their DNS?

can anyone point me to the most recent perlIS.dll?

Thanks alot,
and it you can please EMAIL me directly the response: ran@ventura.co.il

bye,
ran.
-- 
Ran Weber
Vice President, R&D
VCI - Ventura Communications
http://www.vci.co.il
Tel: 972-3-6392564 Ext. 116
Fax: 972-3-5377319


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

Date: 14 Jul 1997 11:42:39 -0700
From: chrissch@cs.uoregon.edu (Chris Schleicher)
Subject: Re: PERLIS.dll? from activeware
Message-Id: <5qdruv$cu1@psychotix.cs.uoregon.edu>

In article <33CA7372.7FE2@ventura.co.il>, ran  <ran@ventura.co.il> wrote:
>I guess that I need that extention BUT! I can't reach www.activeware.com
>anymore, does anyone know what happened to them or their DNS?

Hmm, works for me.  :-)  If all else fails, you can point your browser
directly at 199.60.48.4.


Hope this helps,

--chris
-- 
     Chris Schleicher                      Office:  541/346-3998
     Univ of Oregon CIS GTF                email: chrissch@cs.uoregon.edu
                URL: http://www.cs.uoregon.edu/~chrissch/


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

Date: Mon, 14 Jul 1997 03:21:46 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Regex with nested ()'s, ?
Message-Id: <tcyangEDAHCA.KtH@netcom.com>

How about matching in two expressions, like

   if (($file =~ /\/lib\//) &&
       ($file =~ /dol|doc|dog|con/)){}

===============================================
Philip Carinhas wrote after zapping the scum of the universe:
: I am trying to match a qualified filename with several fields.
: One is a directory the other is the first part of the name:
: Example matches:

: /usr/lib/terminfo/c/concept108-w8p
: /usr/bin/terminfo/c/any/number/of/dirs/bonzai

: Say I want 2 sets of these: 

: the /lib/ and any of (dol|doc|dog|con)  (like the con in concept108-w8p)
: and
: the /bin/ and any of (rol|roc|rox|bon)  (like the bon in bonzai)

: What I have tried (variants as well, plenty of them).

: /(lib|bin).*(dol|doc|dog|con|rol|roc|rox|bon)/ # This is rather blind.

: /(lib).*(dol|doc|dog|con).*|(bin).*(rol|roc|rox|bon).*/      #matches nothing
: /((lib).*(dol|doc|dog|con).*)|((bin).*(rol|roc|rox|bon).*)/  #matches nothing

:  I think that the nested () are killing me. It was unclear from
: the manuals if I needed any .*'s inbetween (atoms).. 
: I was able to get some matching on a single set, but the double is 
: not behaving. Do the /'s have any bad behavior? 

--
====== Try the low-crossposting robomoderated 'alt.culture.taiwan' ======

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: 14 Jul 1997 17:50:08 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: regexp- capturing matched pattern with an alternation character
Message-Id: <5qdosg$m60@lyra.csx.cam.ac.uk>
Keywords: regexp pattern_match, $1 $2 variables, alternation pattern

Dave Naden <dnaden@dgs.dgsys.com> wrote:
>I've encountered a thorny problem.  I want to use regexps to read a file 
>containing a list of files (eg, a DOS "DIR" listing).  I need to pick out the 
>filename in 8.3 format, such as "FILE.TXT" or some such.  Since files may or 
>may not have an extention, the pattern has to allow for both possibilities, as 
>in:
>
>   /[a-zA-Z0-9]{1,8}\.[a-zA-Z0-9]{1,3}/   # (regular 8.3 format)
>
>   /[a-zA-Z0-9]{1,8}(\.[a-zA-Z0-9]{1,3})?/  # (choice of 8 or 8.3 formats)
>
>
>The problem comes when I want to capture the filename with the $& or the $1, 
>$2 variables; the second pattern above only gives the easiest match (the 8 
>chars) and then stops before matching the 8.3 even if it's there.  But the 

Are you sure about that?   Perl regexps normally match the longest string
they can.   (Well, it's more complicated than that but ... )
Can you post an example of input which it fails to match, preferably as
a complete program?

Also you should avoid $& except in trivial programs.   It can cause a
big performance hit.


Mike Guy


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

Date: Mon, 14 Jul 1997 13:25:08 GMT
From: "stephen" <bison@enterprise.net>
Subject: Search and replace problem.
Message-Id: <01bc9059$922c5800$a3cb989e@bob>

	I think the problems started when I accidentally picked up the
Serbocroat/Greek/Latin version of 'Programming Perl'. Is the object of Perl
to be as deliberately unintelligible as it's possible to be?
	Anyway, I thought that if I at least got some pointers, kind of the main
framework of what I need, I could struggle through the rest by checking up
in that book piece by piece.

	I've created this really great Javascript application for editing web
pages from scratch, and now I want to modify it so that it can edit
sections of existing web pages. There's no way I can see to get the source
of an existing web page into a Javascript string variable without actually
typing it in there yourself, so I thought that the way to do it would be to
use a Perl script.

Firstly, the script should determine what the referring page was as that
will be the page to be edited. It then needs to open the HTML file
containing the Javascript editor and insert the URL of the page in the
correct location. I guess the best way of doing this would be to have
'marker' text in there. Something distinctive to search for and replace. It
would then use the same technique to insert the whole contents of that file
to the specified variable. The problem here is that I believe there's a
limit to line length in Javascript, so the file would have to be chopped up
into multiple lines if any are too long, and the whole lot needs to look
something like this:

variable =	'...HTML content...' +
		'...HTML content...' +
		'...HTML content...'

It could be set up so that the whole HTML page is editable, but I want it
so that only a 'content' section can be changed. That way all the code, the
pictures, the navigation can be hid and the whole lot will be easier. Plus
if you're going to modify the whole thing then you're probably better of
doing it in a proper editor off-line. 
So in all the HTML files to be modified, the content will be separated by
being placed between two pairs of comment tags, so that it will display but
can be distinguished.

In the Javascript editor, a text box will be used to modify the content.
When it's done the form will submit the contents of this text box to the
second Perl script.

This second script needs to open the original file - which it will know
because that URL the first script inserted into the editor will be passed
back to this script - and swap the new modified content for the original
content between the comment tags. And then obviously save the result and
pass it back to the browser for viewing.


So er, easy eh?   It's just some search and replace. Is there a way to
search for everything BETWEEN two markers in one go, or do you have to
identify the location of both markers and use those locations to
substitute.
Oh, and there's that potentially sticky point about line lengths and
chopping them up in the right place, then putting them between ' and ' + 
characters.

I suppose I'm whining and saying "please please someone do it for me..."
which would be great but that's not going to happen. But if someone could
just lay out the steps I need to go through. Or maybe even show me any code
that's likely to look like "s/\t+/' 'x(length($&)*8-length($')%8)/e;" which
is of course the kind of random nonsense used to pick lottery numbers.
Anything at all really... anything...
Or how about a collaboration? Someone with Perl experience could put
together the back end scripts, while I finish off the Javascript editor. It
isn't particularly technically difficult or anything, but it works in a
really nice way that I haven't seen done before. It's working in Explorer,
but dies in Communicator.. a little work to be done. Whadeye say? We'd end
up with a useful little tool.

Cheers,
Stephen.


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

Date: 14 Jul 1997 15:10:42 GMT
From: chrish@superior.net (Christopher Hamilton)
Subject: Re: String Comparison
Message-Id: <5qdfhi$j91@snews5.zippo.com>

: cut and paste.  That's pretty simple, but I would like to be able to
: compare strings IGNORING CASE.  Any suggestions?

I usually do something like:

   if(lc($string1) eq lc($string2)) {
      ...
      ...
   }

: also, what is a good perl book for someone still learning perl.  Right now
: I have a really awful book.  Thanks again

[Taken from: http://www.ora.com/catalog/pperl2/]

Programming Perl, 2nd Edition

By Larry Wall, Tom Christiansen & Randal L. Schwartz
2nd Edition September 1996
1-56592-149-6, Order Number: 1496
670 pages, $39.95

 ...............................................................
Christopher Hamilton            http://www.superior.net/~chrish
chrish@superior.net             perl -e 'while(fork){sleep 1};'




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

Date: Mon, 14 Jul 1997 11:30:31 +0200
From: Uma Shanker <uma@heidelbg.ibm.com>
Subject: Total Environment allocation failure
Message-Id: <33C9F1B7.41C6@heidelbg.ibm.com>

hello alls, 
	I am getting Total Environment allocation failure error while
connecting to the DB2 server. what it means :

uma@podu:~/lang/perl/db2>erste.pl
DB2_HOME set to /usr/lpp/db2_02_01
Cannot connect to DB2 server: Total Environment allocation failure!
(DBD: Total Environment allocation failure!)

any help
-- 
uma shanker           
uma@heidelbg.ibm.com
bad mail go to /dev/null <<


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

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

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