[12964] in Perl-Users-Digest
Perl-Users Digest, Issue: 374 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 4 21:07:34 1999
Date: Wed, 4 Aug 1999 18:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 4 Aug 1999 Volume: 9 Number: 374
Today's topics:
Re: [offtopic]RE:Quot St and the Jeop Gm <tchrist@mox.perl.com>
Auto FTP? <andycha@globalnet.co.uk>
Cannot get pws to run perl scripts <Spam@IsBadForTheInternet.com>
Re: Cannot get pws to run perl scripts (elephant)
Re: Cannot get pws to run perl scripts <the.werners@mcleodusa.net>
Re: Change User & Export Dipslay (Abigail)
Re: hash ???- sort/changing keys. (Larry Rosler)
Re: Help getting Perl to work on Windows 98 <dchristensen@california.com>
Re: How can I know what modules are installed on server (Lou Hevly)
How to test the write permissions ? marcza@my-deja.com
Re: How to test the write permissions ? <jeffp@crusoe.net>
Re: How to turn off cashing in perl??? <cassell@mail.cor.epa.gov>
Re: Invalid cross link error message <gnielson@charlotte.com>
Re: Newbie has <FILE> Problem - please help <rlarson@monmouth.com>
Re: Newbie has <FILE> Problem - please help <rlarson@monmouth.com>
Re: Newbie: how do I send shell script output to my per <cassell@mail.cor.epa.gov>
Re: regexp can be your friend (elephant)
Re: Regular expression for matching an e-mail address. <revjack@radix.net>
Re: Repetition in RE substitutions (Abigail)
Re: server-side databases <cassell@mail.cor.epa.gov>
Re: Why is it.... feinster@my-deja.com
Re: Why is it.... <llornkcor@llornkcor.com>
Re: Why is it.... <cassell@mail.cor.epa.gov>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 Aug 1999 18:07:42 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: [offtopic]RE:Quot St and the Jeop Gm
Message-Id: <37a8d5ce@cs.colorado.edu>
In comp.lang.perl.misc, llornkcor <llornkcor@llornkcor.com> writes:
:>> 2) HTML is the opiate of the masses. Learn to use real tools.
:
:2) personal choice, one man's trash is another man's treasure.
Ah, back to cultural relativism I see. Lovely. Wouldn't it be nice if
it were true? Sorry, this is a technical forum. Cultural relativism
fails before quantitative analysis.
Please tell us the tools that do the equivalent with HTML that
your basic utility set can do with basic files. You can look at
http://language.perl.com/ppt/what.html for a set of basic tools.
Please provide web-oriented versions of these commands:
apropos ar awk basename cat cmp col colrm comm cp cut
deroff dd diction diff du ed egrep expand fgrep file
find fmt fold from grep glob head join ln locate look
ls more mv paste pr rev rm rmdir sed shar sort spell
split strings sum tac tail tar touch tr ul unexpand
uniq uuencode wc what whatis
Some may not make complete sense, but most do. Just how,
praytell, do you expect to do these fundamental activities
in webworld?
--tom
--
X-Windows: More than enough rope.
--Jamie Zawinski
------------------------------
Date: Thu, 5 Aug 1999 01:19:03 +0100
From: "Andy Chantrill" <andycha@globalnet.co.uk>
Subject: Auto FTP?
Message-Id: <7oalcp$ht9$1@gxsn.com>
Hey there,
I am a lil stuck here... I need to be able to use FTP to connect to a remote
host, download a few files, and then say +ACI-bye bye+ACI-... I would need to cron
the script to run once per night... how would I go about doing this?
And to make things a lil harder, the host requires a password :o)
Thanks for your help,
Andy.
------------------------------
Date: 4 Aug 1999 19:06:03 -0500
From: "99% Energy" <Spam@IsBadForTheInternet.com>
Subject: Cannot get pws to run perl scripts
Message-Id: <iz4q3.8563$k8.299460@newscene.newscene.com>
I have tried configuring the registry at
\HKEY_LOCAL_MACHINES\System\CurrentControlSet\Services\w3svc\parameters\Scri
pt Map
with the following entry: Name: .pl Data: "c:\perl\bin\perl.exe %s %s" (I
also tried perlis.dll %s %s) according to the the MS Knowledge base article:
http://support.microsoft.com/support/kb/articles/Q150/6/29.asp (thanks to
"elephant" jason).
Perl script runs fine directly at the command prompt with c:\perl\bin\perl
Envtest.pl -w
Executables can be run at the browser (example
http:/\localhost/cgi-bin/htimage.exe)
If I rename the file Envtest.pl to Envtest.txt, I can view the source at the
browser.
What I am doing wrong?
Thanks in advance
99% Energy
------------------------------
Date: Thu, 5 Aug 1999 10:16:29 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Cannot get pws to run perl scripts
Message-Id: <MPG.121382ed61857d60989be2@news-server>
99% Energy writes ..
>I have tried configuring the registry at
>
>\HKEY_LOCAL_MACHINES\System\CurrentControlSet\Services\w3svc\parameters\Scri
>pt Map
>with the following entry: Name: .pl Data: "c:\perl\bin\perl.exe %s %s" (I
>also tried perlis.dll %s %s) according to the the MS Knowledge base article:
>http://support.microsoft.com/support/kb/articles/Q150/6/29.asp (thanks to
>"elephant" jason).
did you also read the ActiveState documentation on your machine ? ..
specifically the question "How do I configure Microsoft Personal Web
Server 1.0x for Windows 95 to support Perl for Win32?" in perlwin32faq6
(Web Server Config) ? .. it'll probably help .. especially the bit about
the virtual directory with execute access
read it
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Wed, 4 Aug 1999 19:59:26 -0500
From: "Kevin and Andrea Werner" <the.werners@mcleodusa.net>
Subject: Re: Cannot get pws to run perl scripts
Message-Id: <jh5q3.176$F22.363@newsfeed.slurp.net>
We seem to be having the same problem. I also posted a message about this
problem (see "Help getting Perl to work on Windows 98").
No one has responded to my post yet, so I'm afraid I don't have any words of
wisdom.
I am going to keep pounding on it and will post something if I figure it
out.
99% Energy <Spam@IsBadForTheInternet.com> wrote in message
news:iz4q3.8563$k8.299460@newscene.newscene.com...
> I have tried configuring the registry at
>
>
\HKEY_LOCAL_MACHINES\System\CurrentControlSet\Services\w3svc\parameters\Scri
> pt Map
> with the following entry: Name: .pl Data: "c:\perl\bin\perl.exe %s %s" (I
> also tried perlis.dll %s %s) according to the the MS Knowledge base
article:
> http://support.microsoft.com/support/kb/articles/Q150/6/29.asp (thanks to
> "elephant" jason).
>
> Perl script runs fine directly at the command prompt with c:\perl\bin\perl
> Envtest.pl -w
> Executables can be run at the browser (example
> http:/\localhost/cgi-bin/htimage.exe)
> If I rename the file Envtest.pl to Envtest.txt, I can view the source at
the
> browser.
>
> What I am doing wrong?
> Thanks in advance
>
> 99% Energy
>
>
------------------------------
Date: 4 Aug 1999 19:19:42 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Change User & Export Dipslay
Message-Id: <slrn7qhm3n.tec.abigail@alexandra.delanet.com>
Greg Guerin (gregory_guerin@hp.com) wrote on MMCLXIV September MCMXCIII
in <URL:news:37A89AE1.B9EF903A@hp.com>:
:: I cannot seem to get my export DISPLAY command to work when running the
:: code below nor will the following code accept my unix 'su - user'
:: command. These two snippets are in separte scripts but they should be
:: enough to show the problem. Is there a module to handle these
:: environment and user issues? All suggestions are appreciated! Thanks.
::
:: $cmd = 'export DISPLAY=machine_name:0';
:: system("$cmd"); # Doesn't Change the Display
Sure it does:
system ("$cmd; echo \$DISPLAY");
But you might read the faq on finding out why it doesn't do what you
think it does. Which isn't a Perl issue though, but a general OS thing.
It's not even Unix specific.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 4 Aug 1999 16:58:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: hash ???- sort/changing keys.
Message-Id: <MPG.1212736c58b9d40989dd5@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7oah77$6bm$1@nnrp1.deja.com> on Wed, 04 Aug 1999 23:09:36
GMT, bhaskaracharya@my-deja.com <bhaskaracharya@my-deja.com> says...
> i want to sort this hash of hashes
>
> $hash = {
> a10_msblck => {name => black},
> a5_mrjoe => { name=> joe},
> a15_msblck => {name => black},
> b10_me => {name = me},
> default => {name = default}
> };
>
> i read the faq but note that a5 has to come before a10
> and default has to come at d. the faq solution prints out
> as a10,a15,a5,b10,default.
That would be the result of a default lexicographic sort on the keys.
If you want something different, you have to extract the field or fields
you want to sort by. There is lots of documentation on how to do that,
and on how to use the resulting fields. Read the FAQ again (perlfaq4:
"How do I sort an array by (anything)"), or the FMTYEWTK, or the
Guttman/Rosler paper at
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/> or ...
> also how can i change the keys alone of a hash from an array
> without building another hash??
>
> my @new_keys = qw ( 1 2 3 4);
> my @old_keys = keys (%hash);
You can't. You can add keys to the same hash and delete the old ones,
but you can't change the keys alone.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 4 Aug 1999 18:04:10 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: Help getting Perl to work on Windows 98
Message-Id: <37a8e0b3@news5.newsfeeds.com>
I use the FSF DJGPP kit on Win98, which includes Perl 5.004_02.
For text-mode stuff, Bash and Perl work great. I doubt that there
is networking/ web server/ CGI stuff available under DJGPP, but...
Microsoft's answer to the Perl question seems to be NT4 sp3+,
ActiveState, and VC++.
If and when I get into Perl/CGI, my solution will be an old 386
running Linux and Apache networked to a P5 Win98 box running IE.
--
David Christensen
dchristensen@california.com
Kevin and Andrea Werner wrote in message ...
>I cannot get Perl to run my CGI scripts under Windows 98. I can
run Perl
>scripts from the command line, and I can use PerlScript in ASP
pages.
>However, if I call a .pl file from the Address bar, Perl locks up.
I have
>the correct settings in my Registry's script map (I think), and I
have
>correctly set up my virtual directory (for Execute but not Read).
>
>Incidentally, something similar happens when I try to run PHP3
scripts.
>Instead of PHP crashing, however, I get an "HTTP/1.1 500 Server
Error"
>message.
>
>This really is frustrating me because I am sure that at one time I
had Perl
>running just fine. However, for some reason I had to rebuild my
system and
>everything went to hell.
>
>Any help would be appreciated.
>
>Thanks!
>
>
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 05 Aug 1999 00:28:06 GMT
From: lou@visca.com (Lou Hevly)
Subject: Re: How can I know what modules are installed on server?
Message-Id: <37a8d8a9.9611744@spamkiller.newsfeeds.com>
David Cassell <cassell@mail.cor.epa.gov> wrote:
>Ray Cadmus wrote:
>> "99% Energy" wrote:
>> > How can I tell what modules are installed on a server? How can I replicate
>[my snip]
>> I found this somewhere (probably on this newsgroup). Sorry, I don't have the
>> author's name.
>> Anyway, if the server has a couple basics this will dump the environment via
>> your browser.
>>
>> #!/perl/bin/perl -w
>>
>> use lib '.';
>>
>> use CGI;
>> use File::Find;
>> use strict;
>[my snip of code]
>
>But bear in mind that if your ISP has a really old Perl, or
>just hasn't properly installed a recent Perl, it may not have
>these modules either.. in which case the program will fail
>and you should get another ISP.
Along with my apologies for erroneously posting earlier that it
couldn't be done, here's a little program that doesn't require
File::Find that will print out all the modules, neatly sorted and
indented, to a file. It's adapted from a script (scandir.pl) posted
here 1998/04/15 by Andreas Pidde.
#!/usr/bin/perl -w
use strict;
use diagnostics;
my $pmlist = '/www/visca/test.txt';
open (PM, ">$pmlist") or die "Can't open $pmlist because $!\n";
my @pms = ();
my $dirsep = '/'; # "\\" for Windows
for my $dir (@INC) {
scandir($dir, '') unless $dir =~ /^\.\.?$/;
}
sub scandir {
my $dirname = shift;
my $indent = shift;
opendir DIR, $dirname or die $!;
my @allfiles = grep{/pm$/ or -d "$dirname$dirsep$_" and ! /^\.\.?/}
readdir DIR;
closedir DIR or warn $!;
my @files = grep {!-d "$dirname$dirsep$_"} sort @allfiles;
my @dirs = grep {-d "$dirname$dirsep$_"} sort @allfiles;
for my $filename (@files, @dirs) {
push @pms, "$indent$dirname$dirsep$filename" unless
-d "$dirname$dirsep$filename";
scandir("$dirname$dirsep$filename", $indent."\t") if
-d "$dirname$dirsep$filename";
}
}
for (@pms) {print PM "$_\n"}
--
Lou Hevly (JAPHW)
lou@visca.com
http://www.visca.com
------------------------------
Date: Thu, 05 Aug 1999 00:00:03 GMT
From: marcza@my-deja.com
Subject: How to test the write permissions ?
Message-Id: <7oak5v$8do$1@nnrp1.deja.com>
Assuming we want to find out if a certain file has appropriate
file permissions to write like
rw-rw-rw-
^
|
Especially this
How can we test if the world wide write permission (=third "w"))
is set or not (without trying to write something to the file)
Bye
Marcus
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 4 Aug 1999 20:45:19 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: How to test the write permissions ?
Message-Id: <Pine.GSO.4.10.9908042043150.25966-100000@crusoe.crusoe.net>
[posted & mailed]
On Aug 5, marcza@my-deja.com blah blah blah:
> How can we test if the world wide write permission (=third "w"))
> is set or not (without trying to write something to the file)
First, that can be done using bit math:
$perm = (stat $file)[2] & 0777;
if ($perm & 001){ print "file is other-executable\n" }
if ($perm & 002){ print "file is other-writeable\n" }
if ($perm & 004){ print "file is other-readable\n" }
Second, I intend to include functionality like this in File::chmod 0.40,
due sometime later in my lifetime. :)
--
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: Wed, 04 Aug 1999 17:41:28 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to turn off cashing in perl???
Message-Id: <37A8DDB8.C37F51F4@mail.cor.epa.gov>
Scott wrote:
>
> Dear Sir/Madame,
>
> I am working on a project in Japan at the moment and
> live in Tokyo. I am having trouble with the code as it
> keeps going to the cache and I want it to refresh on the
> first time around.
You'll want to look up buffering. Type:
perldoc -q buffer
to get some in-depth discussion. But the short answer
is to stick this near the top of your program:
$|=1;
[snip]
> #!/perl/bin/perl.exe -w
That's good, but you're missing -T and 'use strict;' here.
$|=1;
use CGI qw/:standard/;
[snip of sundry attempts]
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 04 Aug 1999 18:33:48 -0400
From: Gary Nielson <gnielson@charlotte.com>
To: Malcolm Ray <M.Ray@ulcc.ac.uk>
Subject: Re: Invalid cross link error message
Message-Id: <37A8BFCC.1D06753@charlotte.com>
Thanks for your help. I am still perplexed -- there's something I don't
understand. I moved the files onto the same filesystem and am using unlink instead
of system. The script, as always, works fine from the command line, but not from a
cron job. As a cron it produces the error "No such file or directory at
/home/gnielson/bin/scripts/perl/thatsracin/votemonitor.pl line 112" so it does
remove the file, but then does not move the other file over to replace it. Yet
when run from the command line, like I said, works fine. I looked at the system
perldoc and perldoc perlop but dont understand how the operators have something to
do with it.
Making sense?
106 else
107 {
108 # system(`/bin/rm $LastGoodOneStored`);
109 print "Now deleting $LastGoodOneStored\n";
110 unlink $LastGoodOneStored or warn "Error removing
$LastGoodOneStored: $!";
111 print "Now moving $TheOneJustDownloaded to $LastGoodOneStored\n";
112 move($TheOneJustDownloaded, $LastGoodOneStored) || warn $!;
113 print "Now changing permissions to $LastGoodOneStored\n";
114 chmod 0777, $LastGoodOneStored;
115 print "Now logging this activity to $Logfile\n";
116 open(LOGFILE, ">>$Logfile") or die "Cannot open $Logfile.";
117 print LOGFILE "No need to replace file $curr_time\n";
118 close (LOGFILE);
119 print "Done!\n";
120
121 }
Malcolm Ray wrote:
> On Wed, 04 Aug 1999 09:12:45 -0400, Gary Nielson <gnielson@charlotte.infi.net>
> wrote:
> >Trying to figure out a problem with a perl script I am writing.
> >Basically, it seems to work fine when I run it from the command line but
> >when run as a cron job I get the error message:
> >
> >Invalid cross-device link at line 109.
>
> That means that the source and destination files of the move are on
> different filesystems. Add some debugging code to display
> $TheOneJustDownloaded and $LastGoodOneStored immediately before the
> move, and probably all will become clear.
>
> I have to comment on this line:
>
> > system(`/bin/rm $LastGoodOneStored`);
>
> You really need to read up on the use of system and backticks:
>
> perldoc -f system
> perldoc perlop
>
> The line above does not mean what I think you think it means. In any case,
> it would be better to do:
>
> unlink($LastGoodOneStored)
> or warn "Error removing $LastGoodOneStored: $!";
> --
> Malcolm Ray University of London Computer Centre
------------------------------
Date: Wed, 04 Aug 1999 20:17:26 -0400
From: Eric Larson <rlarson@monmouth.com>
Subject: Re: Newbie has <FILE> Problem - please help
Message-Id: <37A8D816.6E4C3E29@monmouth.com>
Sorry about that -
when I typed my message I used C syntax instead of perl - it
should have been open(FILE,$filename) of course.
But that doesn't affect my $line = <FILE> problem. Any ideas?
Larry Rosler wrote:
>
> [Posted and a courtesy copy mailed.]
>
> In article <37A8CB00.119B137F@monmouth.com> on Wed, 04 Aug 1999 19:21:36
> -0400, Eric Larson <rlarson@monmouth.com> says...
> > I am trying to use file i/o in the following fashion, but have
> > problems with it. I'm looking for suggestions as to what I am doing
> > wrong, or how I can trace down what I am doing wrong.
> ...
> > FILE = open($thisfile) || next;
> > OUTPUT = open($thisfile . "_static.html");
>
> perldoc -f open
>
> What you have is more like C, nothing like Perl.
>
> And by the way, once you figure out how to open the file, don't forget
> to deal with failure. You have done that on the first line, but not the
> second.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Wed, 04 Aug 1999 20:20:08 -0400
From: Eric Larson <rlarson@monmouth.com>
Subject: Re: Newbie has <FILE> Problem - please help
Message-Id: <37A8D8B8.5243BF79@monmouth.com>
elephant wrote:
>
> Eric Larson writes ..
> >When I run the following, most of the time the first $line works like it
> >was in
> >list more and reads in the ENTIRE FILE. Any subsequent attempt to read
> >that file comes up giving me $line as undef, to no great surprise. What
> >really frosts my butt is that sometimes
> >it runs as if $line was scalar and gives me the result I think it
> >should. On the EXACT
> >SAME FILES.
> >
> >Why?????
>
> probably because you're messing with $/ outside the function .. try
> adding
>
> local $/ = "\n";
>
> as the first line in your function
>
> --
> jason - elephant@squirrelgroup.com -
That's it, another function I pasted into my program was undef'ing $/.
Time for some my's and stricts.
Many thanks.
------------------------------
Date: Wed, 04 Aug 1999 17:46:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Newbie: how do I send shell script output to my perl program?
Message-Id: <37A8DEFD.A4BA5900@mail.cor.epa.gov>
Russell Zah wrote:
>
> Hi,
>
> How do I send a shell script's output to my perl program for processing?
Look up system(), open(), and qx// in the docs. [You can do
a pipe open to read another program's output.]
perldoc -f system
perldoc -f open
perldoc -f qx [which will refer you to the 'perlop' manpage]
> It's sort of complex because my boss had me write a shell program to get
> data out of an SQL database, then take that data and use the perl
> program to format it and put it up on a webpage.
Yuck! That sure doesn't sound optimal. Unless your boss is
supposed to make all programming decisions, that sounds like micro-managing.
Does your boss also tell you how to click on
your mouse properly [that's a Dilbert joke]? I would have
used DBI and one of the DBD::* modules to access the database
directly inside Perl, then the CGI module to throw the formatted
output onto the webpage.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 5 Aug 1999 10:08:58 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: regexp can be your friend
Message-Id: <MPG.12138124d1fdc726989be1@news-server>
Uri Guttman writes ..
>i tried a lookahead version but it doesn't seem to work:
>
>perl -pe 's/(ab)(?=\1)/xx/'
>
>maybe ilya could exlain why? and i am sure he has new tricks which can
>do this too.
works for me .. sure you're not expecting it to do this
s/(ab)(?=.*\1)/xx/
??
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: 5 Aug 1999 00:07:48 GMT
From: revjack <revjack@radix.net>
Subject: Re: Regular expression for matching an e-mail address.
Message-Id: <7oakkk$7ri$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Makarand Kulkarni explains it all:
:[Daniel Doreika wrote..]
:> Can someone please provide me with
:> the best possible regular expression for matching an e-mail address?
:The Regular Expression is
:/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/
:I will leave it to you to decide if this is the best one.
Here we go again. :)
Has anyone ever typed in Jeffrey Friedl's monster regex, so we can point
the questioner to it on the web, like Abigail's regex for URLs? That
should drive the point home.
RJ, who asked the same question six months ago
------------------------------
Date: 4 Aug 1999 19:12:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Repetition in RE substitutions
Message-Id: <slrn7qhlmf.tec.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCLXIV September MCMXCIII in
<URL:news:x73dxzk1i1.fsf@home.sysarch.com>:
<>
<> my code became:
<>
<> s/(?<=\([:\d]+):(?=[:\d]+\))/%/g ;
<>
<> that worked great.
It's great that it worked for you, but according to the manual, it's
not supposed to!
From 'man perlre':
(?<=pattern)
A zero-width positive lookbehind assertion. For
example, /(?<=\t)\w+/ matches a word following a
tab, without including the tab in $&. Works
only for fixed-width lookbehind.
With the + there, it isn't fixed width. Either you're lucky, or the
manual is wrong.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 04 Aug 1999 17:52:19 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: server-side databases
Message-Id: <37A8E043.CCB60F69@mail.cor.epa.gov>
John Casey wrote:
>
> I really can't educate you too much on what to do as I am a newbie
> myself, but this is one of the first perl db files I wrote so it is
> fairly simple. USE WIN32::ODBC, IT IS PAINLESS. The example is very
> simple, but you will get the idea.
I would recommend DBI and the DBD::* modules as an alternative.
That would also make portability and database-changes less of
an issue.
[snip of code with no '-w', no 'use strict', no check on
return values, no 'use CGI', no here-doc for printing, ...]
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 04 Aug 1999 23:58:00 GMT
From: feinster@my-deja.com
Subject: Re: Why is it....
Message-Id: <7oak23$862$1@nnrp1.deja.com>
I was merely pointing out why some people post messages here, using
exaggeration and a metaphor.
> No, I don't. If you have to spend hours searching the docs, you may
want
> to consider a different line of work...
>
> James
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 04 Aug 1999 18:02:23 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Why is it....
Message-Id: <7lnb14ds.fsf@wind.localdomain>
abigail@delanet.com (Abigail) writes:
>I don't believe in this crap. Programming isn't some gift or art.
>Programming is something you can learn. Just like car mechanics.
>Or surgery. Or glass blowing. Or shoe repair.
>
>Some people are better learners than others. Some people aren't interested
>to learn programming, or how to repair shoes. Some jobs require more
>learning than others. But there's no such thing as a born programmer.
wow, I actually agree with you on this...
------------------------------
Date: Wed, 04 Aug 1999 18:02:44 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Why is it....
Message-Id: <37A8E2B4.370013F0@mail.cor.epa.gov>
Abigail wrote:
>
> David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXIV September
> MCMXCIII in <URL:news:37A88A10.A96611AC@mail.cor.epa.gov>:
> ()
> () BTW, why is it acceptable to tell people that they have no
> () athletic ability, no musical ability, etc., but you
> () are a creep if you try to tell someone they have no gift
> () for programming?
>
> I don't believe in this crap. Programming isn't some gift or art.
> Programming is something you can learn. Just like car mechanics.
> Or surgery. Or glass blowing. Or shoe repair.
Yes, but some people can't learn *everything*.
> Some people are better learners than others. Some people aren't interested
> to learn programming, or how to repair shoes. Some jobs require more
> learning than others. But there's no such thing as a born programmer.
I agree. But is there a born baseball-player? At some point,
someone has to introduce you to a field of endeavor and get
you started. Then you either take to it, or you don't. You
may need more help - that's fine. You may have a different
learning style, or take longer to get around to learning X -
that's fine too. But if you can never get past X - if can
never pick up an insight in constructing algorithms, or if
you can never hit the curveball, or if you can never sight-read,
or... Well, for every arena there is Spartacus, and there
are lion-burgers.
My wife comes from a home ec background and never touched
a computer until she was in grad school. So what? She's
an accomplished programmer in SAS now. Why? Because she
was willing to learn the syntax, to read the manuals, to
try experiments to learn what works, etc. Others with
more hard-science training may be utter failures at the
same tasks, because they just don't grok the concepts
that underlie the code.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 V9 Issue 374
*************************************