[6999] in Perl-Users-Digest
Perl-Users Digest, Issue: 624 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 17 13:07:55 1997
Date: Tue, 17 Jun 97 10:00:27 -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 Tue, 17 Jun 1997 Volume: 8 Number: 624
Today's topics:
Re: Big-Endian <--> little Endian conversion? <hartje@etech.hs-bremen.de>
Re: Case Conversion (M.J.T. Guy)
Re: CGI scripting in Perl <m.v.rodriguez@ieee.org>
Re: Checking existence of file in other people's direct (Even Holen)
Re: Closures and objects. <justinb@cray.com>
Re: Data extractaction from a character delimited file. (A. Deckers)
easytcp with TermReadKey (Max Heiman)
Re: file date in perl ? (Tad McClellan)
Re: horrible idea <merlyn@stonehenge.com>
LinkExtor problem, how to add base href? (Calle ]sman)
Mail-Filter <dc@xmp.priconet.de>
Re: multiple white spaces md4calle@mdstud.chalmers.se
Re: multiple white spaces <sfairey@metrica.co.uk>
Re: Ouputting a Simple GIF Image (Nathan V. Patwardhan)
Re: Perl 5.004 failing posix.t test (Solaris 2.4) (Stucki)
Re: Perl 5.004 failing posix.t test (Solaris 2.4) (Casper H.S. Dik - Network Security Engineer)
Re: Perl and tar not cooperating in a shell script <bmurdock@wat.hookup.net>
Re: perl joke of the day ? <merlyn@stonehenge.com>
Re: Perl language question - a regular expressions. <danboo@ixl.com>
Perl Reg Exp (Brett Borger)
Re: Perl Reg Exp <sfairey@metrica.co.uk>
PERL to Oracle <duncan.hudson@us.gases.boc.com>
Programmers wanted <np33ab@mail.telepac.pt>
Redefining Methods in objects? HOW??? (Calle ]sman)
Reg. Exp. how to use AND? (Calle ]sman)
Re: Reg. Exp. how to use AND? <sfairey@metrica.co.uk>
Re: Reg. Exp. how to use AND? <pdcawley@aladdin.net>
Re: Reg. Exp. how to use AND? <danboo@ixl.com>
Re: Script to verify email addresses? <merlyn@stonehenge.com>
US--MA--Cambridge: Perl programmers wanted <sweeney@cinteractive.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Jun 1997 16:34:22 +0200
From: "Dr. Michael Hartje" <hartje@etech.hs-bremen.de>
To: Doug Seay <seay@absyss.fr>
Subject: Re: Big-Endian <--> little Endian conversion?
Message-Id: <33A6A06E.7EDE@etech.hs-bremen.de>
Doug Seay wrote:
> Mike Stok already answered your question, but I'd like to add that life
> becomes easier if you can modify the creation of this binary file you
> are reading.
In deed, but in this case we get a file out of an oszilloscope. -- We
are very lucky to get the information, and now we know how data are
organized inside this binary file. And binary data are in structures of
8 Byte double floating point data as well as other information is given
in 4 Byte Long Integer or 2 Byte Short Integer.
There is no way know to me to do in Your way. We think of doing it
manual in a perl procedure during reading the binary file.
> If you can, make sure that you pack all integers with "n"
> or "N" and unpack with the same letter. By doing this, everything is
> always in "network order" and you don't have to do any complicated logic
> to exchange this binary file between big and little endian systems.
Sorry again, this does fit partly but not for the very "complex" double
floating point structures.
Are there any new ideas out there?
Thanks for thinking about.
Michael
--
Hochschule Bremen Labor fuer Hochspannungstechnik
Prof. Dr. Michael Hartje Neustadtswall 30; 28199 Bremen
Telefon: +49 421 5905-444 FAX: +49 421 5905-476
mailto:hartje@etech.hs-bremen.de http://www.hs-bremen.de
------------------------------
Date: 17 Jun 1997 14:26:16 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Case Conversion
Message-Id: <5o66q8$2s3@lyra.csx.cam.ac.uk>
Jahwan Kim <jahwan@supernova.math.lsa.umich.edu> wrote:
> There are *many* kinds of locale which *should not* have lc or uc.
'lc' and 'uc' are perl functions (dependent on the current locale) which
are always available for all characters. If the concept of upper or
lower case does not exist in a particular locale, they are both identity
functions, and lc(x) eq x and uc(x) eq x for all characters, and
the suggested algorithm will work fine (and do nothing).
Mike Guy
------------------------------
Date: Tue, 17 Jun 1997 09:43:12 -0400
From: Michel Rodriguez <m.v.rodriguez@ieee.org>
Subject: Re: CGI scripting in Perl
Message-Id: <33A69470.3CA@ieee.org>
James Esler wrote:
>
> I'm trying to write a CGI script in Perl which will take the information
> from an HTML interactive form and feed it to a DBM file. The form is
> read and parsed correctly by my CGI library and the associative array
> used to reference the DBM gets the info from the form. But for some
> reason, it doesn't feed it to the DBM file itself. When I go to the
> UNIX command prompt to access the DBM, the file comes up empty. Does
> anyone have any idea why this may be occurring?
Usual answer: this is not a perl question, it is a CGI question...
Try reading http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
Hint: check your access rights
Michel Rodriguez
------------------------------
Date: 17 Jun 1997 15:43:06 GMT
From: evenh@bigblue.pvv.ntnu.no (Even Holen)
Subject: Re: Checking existence of file in other people's directories...
Message-Id: <slrn5qdc4a.14l4.evenh@bigblue.pvv.ntnu.no>
In article <33A4835B.10770B27@babylon5fan.com>, Keys wrote:
>I've written a simple Perl script that prints a list of a system's users
>and links to their homepages, iff (if and only if) they exist. The
>problem is, when I run it from the webserver as a CGI, it works fine,
>since the webserver has access to all web dirs, but when I execute it
>under my uid (from my login shell or as a crontab), I don;t have the
>permissions to go sniffing for index.html in others' webdirs... Here is
>the main part of the script, from the getpwent func at the beginning to
>the actual section that looks for the indices:
Why do you need to run it from your login shell? If you don't then why
not use webserver to access this pages?
If your argument is that you want to be able to generate a static page
at given intervals using cron then one solution is simply to make your
cronjob launch a script which starts lynx. And then set lynx to get a
page which is the script which you want to access. Save the output from
lynx and your done.
If you're worried about others using this script then you might restrict
access to the script to the host from which you start lynx. And if you
want you might chmod the script so that it's executable just when you
start your cronjob.
You don't need to open 250 simultaneous lynx. You start one lynx, which
gets one script which collects every page through the local file system
running as nobody.
Hope this gives you some idea on how to do this... If it doesn't I
suggest you clarify what you actually want to be done.
Regards,
Even Holen
--
<>< Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/ :-)
------------------------------
Date: Tue, 17 Jun 1997 07:38:52 -0500
From: Justin Banks <justinb@cray.com>
Subject: Re: Closures and objects.
Message-Id: <33A6855C.63DA@cray.com>
Brian Mcandrews wrote:
>
> I apologize if this topic is somewhat out of scope for this group, but since
> it came from the Camel book, I think that it's relevant.
>
> What's the difference between closures and objects/classes? As I understand
> it, closures allow you to assign a state at declaration, much like objects, and
> then the closure "remembers" its assigned state at invocation. How is this
> different than calling an object method?
>
> Brian
If I remember correctly, a closure is an anonymous sub. Objects
generally have named subs. Also, the object as a whole maintains it's
internal state via access through the instance, while any scalar can
contain the reference to the anon. sub.
--
Justin Banks
Silicon Graphics Cray Research
Eagan, Minnesota
------------------------------
Date: 15 Jun 1997 15:16:52 GMT
From: deckers@man.ac.uk (A. Deckers)
Subject: Re: Data extractaction from a character delimited file..
Message-Id: <slrn5q81r0.br5.deckers@nessie.mcc.ac.uk>
In <19970615143801.KAA21969@ladder02.news.aol.com>,
CT2963 <ct2963@aol.com> wrote:
>Hey there,
>
>I have the following problem and I want to see if I can solve it in Perl.
>I have a text file (20 meg) and I want to search for a partial string of
>numerics, each line of the file could have any number of 10digit stings
>seperated by a char(253), I basically want to pull out any of the 10digit
>strings that match my criteria.
>
>I have tried this myself but am having no luck.. Can somebody point me in
>the right direction ??
You'll have to pull them out sequentially. Easiest way seems to me to
set the "input record separator" to chr(253), then read a "record" from
the file, see if it matches and do whatever you want to do with it if
it does or if it doesn't, then get the next one:
#!/usr/bin/perl -w
$/ = chr(253);
my $file = '/path/to/your/file';
open IN, $file or die "Couldn't open $file: $!\n";
while (<IN>) {
chomp; # loose the trailing $/
if ( some_condition($_) ) {
# do something with the input contained in $_
} else {
# do something else with the input contained in $_
}
}
close IN;
__END__
HTH,
Alain
--
Perl information: <URL:http://www.perl.com/perl/>
Perl FAQ: <URL:http://www.perl.com/perl/faq/>
Perl archive: <URL:http://www.perl.com/CPAN/>
>>>>>>>> comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<
------------------------------
Date: Tue, 17 Jun 1997 10:50:06 -0400
From: maxwell@minerva.yale.edu (Max Heiman)
Subject: easytcp with TermReadKey
Message-Id: <maxwell-1706971050220001@commons-107-node.net.yale.edu>
I'm trying to use the easytcp and TermReadKey libraries together to write
a server that is capable of two-way character-at-a-time transmissions. I
have each library working individually under UNIX but when I try to use
the ReadKey functions from within an easytcp server it quits, saying "Bad
filehandle." Can someone explain to me why this happens and, especially,
how I can work around it? Thanks very much.
Max
maxwell@minerva.yale.edu
------------------------------
Date: Tue, 17 Jun 1997 06:31:30 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: file date in perl ?
Message-Id: <iis5o5.bn.ln@localhost>
Paul S. Cutt (cutt@netcom.com) wrote:
: I wonder how I can get the date of a file in perl formatted in
: day month year ? Loked at the stat command but does not seem to give the
: time in
: the right format or I do not know how to convert it.
: ThaThanks,
-------------------------------
#! /usr/bin/perl -w
$filetime = (stat("data"))[9]; # get last modify time
($day, $mon, $year) = (localtime($filetime))[3..5]; # convert to dd mm yy
$mon++; # adjust for zero-based month counting
print "$day-$mon-$year\n";
-------------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 17 Jun 1997 09:16:29 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: horrible idea
Message-Id: <8cd8plurvm.fsf@gadget.cscaper.com>
>>>>> "Charles" == Charles DeRykus <ced@bcstec.ca.boeing.com> writes:
Charles> Perhaps something like this which would eliminate the eval
Charles> altogether:
Charles> $_ = "java java java java java ...";
Charles> s/java/perl/ until $count++ == 3; # leaves a trailing java :)
That won't work if you are changing "java" to "java-is-dangerous" :-),
because you're scanning from the beginning of the string each time.
See my other psting in this thread for a more powerful method of
handling this task.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 440 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 17 Jun 1997 18:48:13 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: LinkExtor problem, how to add base href?
Message-Id: <w7pk9jt9nw2.fsf@rizzo6.mdstud.chalmers.se>
I use the example described in the man page:
require HTML::LinkExtor;
$p = HTML::LinkExtor->new(\&cb, "http://www.sn.no/");
sub cb {
my($tag, %links);
print "$tag @{[%links]}\n";
}
$p->parse_file("index.html");
for some reason it doesn't work like that for me, so I've written it like:
require HTML::LinkExtor;
$p = HTML::LinkExtor->new(\&cb, "http://huga");
sub cb {
local ($tag, %links) = @_;
if ((links{"base"} ne ""){
# what shall I do with the base href ?
}
while (($key,$value) = each %links) {
print "$key = $value\n";
}
}
$p->parse_file("frame.html");
the thing is this, I want it to read the base href and insert it in the
same way that http://huga are inserted (in front of the relative links)
how do I do this?
/Calle
**************************************************************************
* * My homepage about the author Tom Holt: *
* /_\ http://www.mdstud.chalmers.se/~md4calle/holt/ *
* { ~._.~ } *
* ( Y ) other things like OnLine Guitar Archive linkpage *
* ( )~*~( ) and heaps of musiclinks can be found at *
* (__)-(__) http://www.mdstud.chalmers.se/~md4calle/ *
**************************************************************************
------------------------------
Date: Tue, 17 Jun 1997 18:12:26 +0200
From: David Capelle <dc@xmp.priconet.de>
Subject: Mail-Filter
Message-Id: <Pine.LNX.3.95.970617181056.692A-100000@dc.xmp.priconet.de>
Hi!
I'm trying to write a Mail Filter in Perl5. It is supposed to remove Mails
fom /var/spool/mail/user. How can I remove lines from a file?
bye,
David
\||/
oo
---------ooO-()-Ooo-------------------------
David Capelle Tel.: +49-531-371439 IRC: dc (#linuxger)
------------------------------
Date: Tue, 17 Jun 1997 09:41:31 -0600
From: md4calle@mdstud.chalmers.se
Subject: Re: multiple white spaces
Message-Id: <866558420.7524@dejanews.com>
In article <5nmeha$bf0@tsunami.traveller.com>,
gbacon@adtran.com wrote:
>
> [Posted and mailed]
>
> In article <EBL6ru.9on@seas.ucla.edu>,
> trit@olympic.seas.ucla.edu (Tri Duy Tram) writes:
> : I am wondering how do you change multiple white spaces to just one single
> : white space?
>
> $str =~ s/\s+/ /g;
When I do this it removes all newlines as well? Is there a way to do
it without removing newlines?
/Calle
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 17 Jun 1997 16:17:18 +0100
From: Simon Fairey <sfairey@metrica.co.uk>
To: md4calle@mdstud.chalmers.se
Subject: Re: multiple white spaces
Message-Id: <33A6AA7E.3F54@metrica.co.uk>
md4calle@mdstud.chalmers.se wrote:
>
> In article <5nmeha$bf0@tsunami.traveller.com>,
> gbacon@adtran.com wrote:
> >
> > [Posted and mailed]
> >
> > In article <EBL6ru.9on@seas.ucla.edu>,
> > trit@olympic.seas.ucla.edu (Tri Duy Tram) writes:
> > : I am wondering how do you change multiple white spaces to just one single
> > : white space?
> >
> > $str =~ s/\s+/ /g;
> When I do this it removes all newlines as well? Is there a way to do
> it without removing newlines?
>
> /Calle
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
I believe you need the 'm' flag so that it treats the string as multiple
lines.
i.e.
$str =~ s/\s+/ /gm;
Simon
------------------------------
Date: 15 Jun 1997 07:09:35 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Ouputting a Simple GIF Image
Message-Id: <5o04ff$b66@fridge-nf0.shore.net>
Bear (clary@cruzio.com) wrote:
: Hi, I have no idea of were to start but I want to be able to output
: some farily basic GIF 87a files with Perl 5 to my web browser. I
have
Regardless of using a webserver (which is irrelevant in this
newsgroup, by the way), you should pick up the GD module available at:
http://www.perl.com/CPAN/modules/by-module/GD/
This module is well-documented in POD, and you should have no problem
with it.
: Also, this is a general GIF question, do you have to use LZW
: compression?
I dunno; look at the module.
: I am also interested in not-so basic (transparent BGs, LZW
: compression, etc) code for outputting GIFs, but thats for the future.
GD does transparencies from what I recall.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 17 Jun 97 14:40:14 GMT
From: stucki@math.fu-berlin.de (Stucki)
Subject: Re: Perl 5.004 failing posix.t test (Solaris 2.4)
Message-Id: <stucki.866558414@petzval>
steintr@intac.com (Russell Steinthal) writes:
>The problem test is:
>print &_POSIX_OPEN_MAX > $fds[1] ? "ok 12\n" : "not ok 12\n";
in my case: ^ = 16 ^ = 31
Well, I have the same here on SunOS 4.1.3, and it comes from
'/usr/include/limits.h' defining POSIX_OPEN_MAX to be 16 (sixteen!)
while in reality on SunOS there are max. 256 and in Solaris 1024
open filedescriptors allowed. As far as I followed the problem
the test says (of course :-) that the open filedescriptor it uses
is larger than the maximum of the POSIX environment of SUN.
(I assume this to be a kind of minimal sanity check.)
So now I know what to blame, but cannot find out what to fix ;-)
Thanks a lot for helps and explanations ...
Lost too :-) Stucki <stucki@math.fu-berlin.de>
PS.: Please MAIL answers, as I'm not normally getting this newsgroup!
--
Christoph von Stuckrad * * | talk to | <stucki@math.fu-berlin.de> \
Freie Universitaet Berlin |/_* | nickname | ...!unido!fub!leibniz!stucki|
Fachbereich Mathematik, EDV |\ * | 'stucki' | Tel:+49 30 838-7545{9|8} |
Arnimallee 2-6/14195 Berlin * * | on IRC | Fax:+49 30 838-5913 /
------------------------------
Date: 17 Jun 1997 16:02:28 GMT
From: Casper.Dik@Holland.Sun.COM (Casper H.S. Dik - Network Security Engineer)
Subject: Re: Perl 5.004 failing posix.t test (Solaris 2.4)
Message-Id: <casper.866563108@uk-usenet.uk.sun.com>
stucki@math.fu-berlin.de (Stucki) writes:
>steintr@intac.com (Russell Steinthal) writes:
>>The problem test is:
>>print &_POSIX_OPEN_MAX > $fds[1] ? "ok 12\n" : "not ok 12\n";
>in my case: ^ = 16 ^ = 31
>Well, I have the same here on SunOS 4.1.3, and it comes from
>'/usr/include/limits.h' defining POSIX_OPEN_MAX to be 16 (sixteen!)
>while in reality on SunOS there are max. 256 and in Solaris 1024
>open filedescriptors allowed. As far as I followed the problem
>the test says (of course :-) that the open filedescriptor it uses
>is larger than the maximum of the POSIX environment of SUN.
>(I assume this to be a kind of minimal sanity check.)
Perfectly legal; the _POSIX_OPEN_MAX value is not the a maximum enforced by
the environment; it's the maximum an application using POSIX_OPEN_MAX
can expect:
/*
* POSIX conformant definitions - An implementation may define
* other symbols which reflect the actual implementation. Alternate
* definitions may not be as restrictive as the POSIX definitions.
*/
Meaning; these must be compile time constants and a dynamic interface
that returns a less restrictive value may exist. So the test is broken.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
------------------------------
Date: Tue, 17 Jun 1997 09:23:55 -0400
From: Matt Murdock <bmurdock@wat.hookup.net>
Subject: Re: Perl and tar not cooperating in a shell script
Message-Id: <33A68FEB.2F94A91C@wat.hookup.net>
Tom Fawcett wrote:
>
> Matt Murdock <bmurdock@wat.hookup.net> writes:
> > I've been having problems with my (homemade) backup system.
> > Occasionally, tar is asked to back up file with spaces or other odd
> > characters in their names. These files are _always_ lost in the
> > backup. What I would like to do, is to encapsulate each filename within
> > quotes. I.e., tar file1 file2 file number 3
> > Would become: tar "file1" "file2" "file number 3" etc..
> >
-- snip snip --
> > **THE PROBLEM**
> > tar _ALWAYS_ reports that it cannot find the files output by
> > quoteEncapsulate.pl. I think that it is possible that the (') character
> > returned by the perl script may be of a different code value than that
> > expected by tar. I have also tried (\") in place of (') in the above
> > code snippet. Neither seem to work.
>
> I think this is a shell/tar problem, not a perl problem. I suggest
> ditching your perl script and just doing:
>
> tar cf $backup_device --files-from $temporary_file
>
> which is faster, easier, and won't violate any command line argument limits
> your shell might impose. Also it works.
>
> -Tom
Your solution works! Thank you!
Matt
------------------------------
Date: 17 Jun 1997 09:19:13 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Nick Vargish <nav@patriot.net>
Subject: Re: perl joke of the day ?
Message-Id: <8cafkpurr2.fsf@gadget.cscaper.com>
>>>>> "Nick" == Nick Vargish <nav@patriot.net> writes:
Nick> Never mind the slice where a scalar was intended ("perl -wc" reported
Nick> 373 such warnings the first time I checked the filter), I just did:
Nick> $line = join ("~", @opyrf) . "~";
Actually, my slick trick for "append to all" is:
$line = join "~", @opyrf, "";
Neat thing to remember.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 440 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 17 Jun 1997 10:20:34 -0400
From: Dan Boorstein <danboo@ixl.com>
To: Henrik Schmiediche <henrik@stat.tamu.edu>
Subject: Re: Perl language question - a regular expressions.
Message-Id: <33A69D32.50CAE23C@ixl.com>
Henrik Schmiediche wrote:
>
> Hello,
> I am trying to configure a database server written in perl. I need
> to restrict access to the server from IP addresses:
>
> 165.91.*.*
> 128.194.*.*
>
> I do this by specifying a variable called AddressMask:
>
> AddressMask = 165\.91\.*
*CUT*
> The code in the perl program that checks for the correct address
> is:
>
> if ($Config{'AddressMask'}) { # Check address
> unless ($inetaddr =~ /$Config{'AddressMask'}/) {
> print NS
> "010 Connections from address $inetaddr" .
> " not allowed on this server\n";
> close NS;
> exit;
> }
> }
>
> Is there a Regular Expression I can create to allow access
> from both IP address ranges?
>
If the list of allowable addresses is really only two, unlikely
to change and only used in this location, I would just
incorporate them into your 'unless' test:
unless ($inetaddr =~ m/^165\.91/o || $inetaddr =~ m/^128\.194/o) {
# fail
}
or as a single regex (which I believe is slower to fail and about
even to match):
unless ($inetaddr =~ m/^(?:165\.91)|(?:128\.194)/o) {
# fail
}
Good Luck!
Dan Boorstein
danboo@ixl.com
------------------------------
Date: 17 Jun 1997 14:35:44 GMT
From: bxb121@psu.edu (Brett Borger)
Subject: Perl Reg Exp
Message-Id: <5o67c0$vta@r02n01.cac.psu.edu>
In my continuing battle against a mangled version of 4.??? perl for
Novell:
I'm trying to perform a s// on a file....here is the string I want to
find:
isNew(60,"somedatehere")
where somedatehere is a date that I don't know ahead of time.
I want to replace it with:
isNew(60, "newdate")
where newdate is what you would expect. The line I'm using is:
$temp=~s/isNew\(+\)/isNew(60,"$date")/o;
But this doesn't find the line. Why?
Also, what is a good net.resource to learn the RegExp rules? I'm pretty
much guessing at these.
Thanks,
Brett Borger
OPP Webmaster, Penn State University
------------------------------
Date: Tue, 17 Jun 1997 16:28:44 +0100
From: Simon Fairey <sfairey@metrica.co.uk>
To: Brett Borger <bxb121@psu.edu>
Subject: Re: Perl Reg Exp
Message-Id: <33A6AD2C.FF6@metrica.co.uk>
Brett Borger wrote:
>
> In my continuing battle against a mangled version of 4.??? perl for
> Novell:
>
> I'm trying to perform a s// on a file....here is the string I want to
> find:
> isNew(60,"somedatehere")
> where somedatehere is a date that I don't know ahead of time.
> I want to replace it with:
> isNew(60, "newdate")
> where newdate is what you would expect. The line I'm using is:
> $temp=~s/isNew\(+\)/isNew(60,"$date")/o;
You are missing a '.' after the first left brace,
i.e:
$temp=~s/isNew\(.+\)/isNew(60,"$date")/o;
What is was trying to do was match one or more left braces followed by a
right brace...
BTW remember with the 'o' flag if this is in a loop and the variable
$date changes it will always substitute with whatever $date was on the
first pass through the loop.
>
> But this doesn't find the line. Why?
> Also, what is a good net.resource to learn the RegExp rules? I'm pretty
> much guessing at these.
There is a good regexp document in the documentation section at
www.perl.com, I think it is by Tom Christiansen and is well worth a
read. Sorry I can't remember the exact location but you should be able
to find it. The two Perl books are also very useful as is the Perl
Journal which has had a couple of good articles on regexp ( I know they
are not net resources but they are useful )
Have fun.
Simon
------------------------------
Date: 17 Jun 1997 14:48:10 GMT
From: "C. Duncan Hudson" <duncan.hudson@us.gases.boc.com>
Subject: PERL to Oracle
Message-Id: <01bc7b2d$8f08e1c0$8add76a2@unity-94.us.gases.boc.com>
I have a need to read a file off a Windows NT machine and update an Oracle
7 (also NT) database from the records contained in the file. Is this
something that I can do with PERL, without having to buy canned software?
If so, how would I go about doing it? Thanks in advance,
C. Duncan Hudson
duncan.hudson@us.gases.boc.com
------------------------------
Date: Tue, 17 Jun 1997 15:57:37 +0100
From: Renato <np33ab@mail.telepac.pt>
Subject: Programmers wanted
Message-Id: <33A6A5E1.6A25@mail.telepac.pt>
Dear Newsgroup Readers,
As I often receive requests for programming for the Web, I would like to
build a small database with people I can rely on when it comes to
programming and deadlines. I am looking for freelance programmers in
Java, C, Perl and ActiveX.
If you would like to be contacted from time to time to collaborate,
please reply to this message, mentioning your name, the language you are
best at, an estimate of how much time we can count on you and your price
per hour.
Thanks!
Renato Pedrosa
------------------------------
Date: 17 Jun 1997 13:57:22 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: Redefining Methods in objects? HOW???
Message-Id: <w7phgexwifx.fsf@fraggel79.mdstud.chalmers.se>
I've been trying to do it all day, and it drives me nuts!
How does one do it? I try to do something like this in the mainprogram:
sub HTML::Formatter::h1_start { print"WWWWWWWWWWWWWWWWWWWWWWWWWW";}
but it still uses the old sub. of h1_start ?
can someone enlighten me? please?
/Calle
**************************************************************************
* * My homepage about the author Tom Holt: *
* /_\ http://www.mdstud.chalmers.se/~md4calle/holt/ *
* { ~._.~ } *
* ( Y ) other things like OnLine Guitar Archive linkpage *
* ( )~*~( ) and heaps of musiclinks can be found at *
* (__)-(__) http://www.mdstud.chalmers.se/~md4calle/ *
**************************************************************************
------------------------------
Date: 17 Jun 1997 15:38:11 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: Reg. Exp. how to use AND?
Message-Id: <w7pzpsp1ha4.fsf@fraggel79.mdstud.chalmers.se>
I want to do a search for
all non-alphanumerics except for \n and whitespace?
how do I do this?
/Calle
**************************************************************************
* * My homepage about the author Tom Holt: *
* /_\ http://www.mdstud.chalmers.se/~md4calle/holt/ *
* { ~._.~ } *
* ( Y ) other things like OnLine Guitar Archive linkpage *
* ( )~*~( ) and heaps of musiclinks can be found at *
* (__)-(__) http://www.mdstud.chalmers.se/~md4calle/ *
**************************************************************************
------------------------------
Date: Tue, 17 Jun 1997 15:13:37 +0100
From: Simon Fairey <sfairey@metrica.co.uk>
To: Calle ]sman <md4calle@mdstud.chalmers.se>
Subject: Re: Reg. Exp. how to use AND?
Message-Id: <33A69B91.446B@metrica.co.uk>
Calle ]sman wrote:
>
> I want to do a search for
>
> all non-alphanumerics except for \n and whitespace?
>
> how do I do this?
>
> /Calle
>
> **************************************************************************
> * * My homepage about the author Tom Holt: *
> * /_\ http://www.mdstud.chalmers.se/~md4calle/holt/ *
> * { ~._.~ } *
> * ( Y ) other things like OnLine Guitar Archive linkpage *
> * ( )~*~( ) and heaps of musiclinks can be found at *
> * (__)-(__) http://www.mdstud.chalmers.se/~md4calle/ *
> **************************************************************************
How about:
#!/bin/perl
open( FILE, shift );
undef $/;
$file = <FILE>;
$file =~ s/(\W)/ ($1 eq "\n") ? $1 : ($1 eq " ") ? $1 : "" /gme;
print "File is now:\n$file";
The 'e' in the s/// treats the right hand side as an expression and so
allows
the additional check to see if a newline or space has been found.
Have fun
Simon
------------------------------
Date: 17 Jun 1997 15:09:13 +0100
From: Piers Cawley <pdcawley@aladdin.net>
Subject: Re: Reg. Exp. how to use AND?
Message-Id: <54wwnt7246.fsf@gunnar.aladdin.net>
md4calle@mdstud.chalmers.se (Calle ]sman) writes:
> I want to do a search for
>
> all non-alphanumerics except for \n and whitespace?
>
> how do I do this?
This is a trick question right? The standard answer at this point is
RTFM, after all, if you're capable of getting Emacs to post news you
should certainly be capable of typing 'man perlre' or even 'man perl'
followed closely by 'man perlre'.
However, because I'm in a surprisingly good mood (having just coaxed
GNUS into doing approximately what I want it to), the regexp you are
looking for is: /[^\w\n]+/. You owe the Oracle a brace of camels and
a trained llama.
--
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow
------------------------------
Date: Tue, 17 Jun 1997 10:47:38 -0400
From: Dan Boorstein <danboo@ixl.com>
To: "Calle ]sman" <md4calle@mdstud.chalmers.se>
Subject: Re: Reg. Exp. how to use AND?
Message-Id: <33A6A38A.53D252D8@ixl.com>
Calle ]sman wrote:
>
> I want to do a search for
>
> all non-alphanumerics except for \n and whitespace?
>
> how do I do this?
>
assuming your test string is in '$_':
if(!m/[a-zA-Z0-9]|\s/o) {
print "all desirable characters\n";
}
else {
print "has undesirable characters\n";
}
Dan Boorstein
danboo@ixl.com
------------------------------
Date: 17 Jun 1997 09:27:07 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: aak2@Ra.MsState.Edu (Atif Ahmad Khan)
Subject: Re: Script to verify email addresses?
Message-Id: <8c67vdurdw.fsf@gadget.cscaper.com>
>>>>> "Atif" == Atif Ahmad Khan <aak2@Ra.MsState.Edu> writes:
Atif> I know from searching the dejanews archive and altavista that this
Atif> is a rather frequently asked question. However I have not been able
Atif> to find a good solution to the problem yet.
That's because there is *no* solution that works. Your search
demonstrated that.
Atif> I know that I can telnet to port 25 on a sever and verify the email
Atif> address of (most users) and if the server isn't the mail handler then
Atif> find the mail handler and telnet there. I would like to automate this
Atif> process so that I can use it a cgi script.
Nope. Won't work. Will get false positives and false negatives.
Makes it worthless.
And I'm posting this *yet again* so that the next person will see
*this* message as well.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 440 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 17 Jun 1997 10:42:00 -0600
From: Ann Sweeney <sweeney@cinteractive.com>
To: sweeney@cinteractive.com
Subject: US--MA--Cambridge: Perl programmers wanted
Message-Id: <866560615.10019@dejanews.com>
Cambridge, MA: Job opportunity! Perl 5 Programmer
Perl/CGI programmers wanted to build interesting and sophisticated Web
applications on a UNIX platform with Cambridge Interactive, an innovative
software applications company in Harvard Square (Cambridge), MA. This is
a full or part-time (20-40 hours/week) contract, totaling about 120 hours
of work that can end at the end of the project OR can turn into a regular
FT position. Compensation is negotiable.
Requirements: Proficiency in Perl 5 and UNIX. Experience in CGI
scripting.
Interested? Call 617.520.2100 for more information or send email to
sweeney@cinteractive.com.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
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 624
*************************************