[11032] in Perl-Users-Digest
Perl-Users Digest, Issue: 4632 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 12 17:02:36 1999
Date: Tue, 12 Jan 99 14:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 12 Jan 1999 Volume: 8 Number: 4632
Today's topics:
Re: background server (Mick Ghazey)
Can anybody help me with PERLSHOP !! <gerry.u@planetinternet.be>
Re: CONCLUSIVE PROOF: Jesus *is* King of the Jews ! ! ! (Peter Besenbruch)
Re: cut (Bart Lateur)
Re: cut <kistler@gmx.net>
Executing Script (Mode ?) <mullenk@cae.wisc.edu>
Re: Executing Script (Mode ?) <mullenk@cae.wisc.edu>
File IO (Corrected reply address this time) smoothasice@geocities.com
File IO commands antonisnow@home.com
format NAME= <jackfitts@hotmail.com>
Re: Getting program to restart (HUP) more than once (Alastair)
global search and replace in files <jcody@triibune.com>
Re: global search and replace in files <cdkaiser@delete.these.four.words.concentric.net>
Re: global search and replace in files <pixel_@geocities.com>
Re: grep with boundaries and regex (Tad McClellan)
Re: High resolution timing ! (Martien Verbruggen)
How to Timeout a Perl Socket Connect?? lbrown2@uswest.net
Re: If Larry Wall's listening out there.... dhosek@webley.com
Re: Low level perl <shum@cig.mot.com>
Re: Making perl do tasks at specific times.. dhosek@webley.com
Re: Perl and LDAP <indy@NOSPAMdemobuilder.com>
Re: Perl Criticism (I R A Aggie)
Re: Perl Criticism (I R A Aggie)
Re: Perl Criticism <jeromeo@atrieva.com>
Re: Perl Criticism <ramune@zarathustra.calstatela.edu>
Re: Perl Criticism droby@copyright.com
Re: Problem reading files from a remote server <kistler@gmx.net>
Re: prog1 lookalike in Perl? <kistler@gmx.net>
Re: prog1 lookalike in Perl? <hniksic@srce.hr>
Proxy for e-mail... (Luca DP)
Re: regexp in a var ? (Tad McClellan)
Re: regulart expression dhosek@webley.com
Re: regulart expression (Tad McClellan)
Re: SUMMARY: Optimizing `eval' in a loop (Sean McAfee)
Re: SUMMARY: Optimizing `eval' in a loop (Bart Lateur)
Re: Text manipulation (Tad McClellan)
Re: tied hashed hash looses item #1 <ebohlman@netcom.com>
Re: Verify an email address (John Stanley)
Re: Verify an email address <upsetter@ziplink.net>
Re: Verify an email address (Clay Irving)
Re: Verify an email address (Randal L. Schwartz)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Jan 1999 20:56:49 GMT
From: mghazey@exchange.ml.com (Mick Ghazey)
Subject: Re: background server
Message-Id: <369bb6ee.10523859@news.ml.com>
Services run whether a user is logged in or not.
On 5 Jan 1999 18:04:28 GMT, ehammerv@tricity.wsu.edu (Eric Hammervold)
wrote:
>
>Ok, i took a look at Win32:Service and all it does is manage the
>services. Thats not what i want to do, i want to create a service that
>will run in the background even though your not loged in, use perl of
>course. So has anyone done it? and how? I found the admin information
>i needed so all i need now is this.
>
>Any ideas or information would be greatly appreciated!
>
>Thanks again!
>
>Eric,
>
>Martien Verbruggen (mgjv@comdyn.com.au) wrote:
>: In article <76rmng$nci$1@leopard.it.wsu.edu>,
>: ehammerv@tricity.wsu.edu (Eric Hammervold) writes:
>
>: > I need some information on generating background servers for windows
>: > NT. Specificly is it possible for a perl program to be running as a
>: > server program while nobody is loged into the machine? If so, how
>: > do you do it?
>
>: I believe those things are called 'services' on NT. There's a module
>: Win32::Servic available from CPAN (http://www.perl.com/CPAN/) which
>: probably does what you want.
>
>: You should also check out www.activestate.com for Win32 specific perl stuff.
>
>: Martien
>: --
>: Martien Verbruggen |
>: Webmaster www.tradingpost.com.au | The gene pool could use a little
>: Commercial Dynamics Pty. Ltd. | chlorine.
>: NSW, Australia |
------------------------------
Date: Tue, 12 Jan 1999 21:56:38 +0100
From: "gerry.u" <gerry.u@planetinternet.be>
Subject: Can anybody help me with PERLSHOP !!
Message-Id: <77gcu2$bhh$1@antwerpen.planetinternet.be>
I would like to get the perlshop running for my online store
I want to use MS personal web server for testing
What program do i need to run 'test' it on this server"my own system"??
I can't get it done...
I'm editing the cgi script in winword...
I would apriciate any help..
Best regards,
Gerry
email : Delete the NOSPAM gerry.u@NOSPAM.planetinternet.be
------------------------------
Date: Tue, 12 Jan 1999 20:33:10 GMT
From: prb@nobulk.lava.net (Peter Besenbruch)
Subject: Re: CONCLUSIVE PROOF: Jesus *is* King of the Jews ! ! !
Message-Id: <36a2acf4.11191648@news.lava.net>
On Mon, 11 Jan 1999 18:57:12 +0000, Dave Storey
<dave@quik.demon.co.uk> wrote:
>I figure he tail-gated AndersonRM ? Then the question becomes how ARM
>got in ..
The message got spammed to more appropriate groups like
alt.christnet.bible, alt.christnet.philosophy, and
alt.christnet.theology. It took a second person to put it there and
ask if it was legit. I answered it there, as well.
As for here, I wonder which planetarium program prints out a report
like that?
___________________________________________________
Hawaiian Astronomical Society http://www.hawastsoc.org
HAS Deepsky Atlas http://www.hawastsoc.org/deepsky
Delete the "nobulk." for the true e-mail address.
------------------------------
Date: Tue, 12 Jan 1999 20:23:42 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: cut
Message-Id: <369cae50.568858@news.skynet.be>
Gump wrote:
> Is there a function in perl which can do task just like
>"cut" command in Unix?
>for example, get third part ("1.2.0") from below string:
>
>"KingSoftware StarTest 1.2.0 01-01-1999"
There are several, all with their specific uses. For your example:
@one = /(\S+)/g;
@two = split /\s+/;
@three = /^(\w+)\s+(\w+)\s([0-9.]+)\s+([0-9-]+)$/;
These will not just take one part, but all of them. Take the third
(remember that the first is number 0), by for example:
print $one[2];
HTH,
Bart.
------------------------------
Date: Tue, 12 Jan 1999 21:48:28 +0100
From: Per Kistler <kistler@gmx.net>
To: Gump <a14203@cig.mot.com>
Subject: Re: cut
Message-Id: <369BB51C.CBFF7310@gmx.net>
#!/usr/bin/perl
use strict;
my $string = "KingSoftware StarTest 1.2.0 01-01-1999";
my $wanted = (split(' ',$string))[2];
print $wanted,"\n";
Per.
> Is there a function in perl which can do task just like
> "cut" command in Unix?
> for example, get third part ("1.2.0") from below string:
>
> "KingSoftware StarTest 1.2.0 01-01-1999"
>
> thanks,
> Gump
--
Per Kistler kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Tue, 12 Jan 1999 14:40:02 -0600
From: Kevin Richard Mullen <mullenk@cae.wisc.edu>
Subject: Executing Script (Mode ?)
Message-Id: <369BB322.E2B9DDB9@cae.wisc.edu>
I am learning Perl on a Sun Ultra 10. (Unix System V Release 4.0). When
I write a script and then try to run it, the system complains that it
cannot find the command. I tried changing the mode so that the file is
an executable, but still the system will not run my script. (Yes, first
line of code is #! /usr/bin/perl -w ) I have resorted to typing the
command :
perl -w try1.prl
in order to get it to run. Advice ?
KRM
--
------------------------------
Date: Tue, 12 Jan 1999 14:44:51 -0600
From: Kevin Richard Mullen <mullenk@cae.wisc.edu>
Subject: Re: Executing Script (Mode ?)
Message-Id: <369BB443.8F0BB928@cae.wisc.edu>
Kevin Richard Mullen wrote:
> I am learning Perl on a Sun Ultra 10. (Unix System V Release 4.0). When
> I write a script and then try to run it, the system complains that it
> cannot find the command. I tried changing the mode so that the file is
> an executable, but still the system will not run my script. (Yes, first
> line of code is #! /usr/bin/perl -w ) I have resorted to typing the
> command :
>
> perl -w try1.prl
>
> in order to get it to run. Advice ?
>
> KRM
> --
Disregard ! Porting from an HP station (HP UX) to the Sun workstation, I
found out the (stupid) hard way that the Perl program is located in a
different directory.
KRM
------------------------------
Date: Tue, 12 Jan 1999 21:18:20 GMT
From: smoothasice@geocities.com
Subject: File IO (Corrected reply address this time)
Message-Id: <369BBD7F.BF7142F@geocities.com>
I was wondering if there was a command or a sequence of commands that I
could use to actually cut a piece of information out of a file and store
it in a variable...if not, what commands can I use to make the "Print"
command print to the beginning of the file instead of the end.
Thanks,
Friend
------------------------------
Date: Tue, 12 Jan 1999 21:17:00 GMT
From: antonisnow@home.com
Subject: File IO commands
Message-Id: <369BBD2F.7B1865D7@home.com>
I was wondering if there was a command or a sequence of commands that I
could use to actually cut a piece of information out of a file and store
it in a variable...if not, what commands can I use to make the "Print"
command print to the beginning of the file instead of the end.
Thanks,
Friend
------------------------------
Date: Tue, 12 Jan 1999 14:52:41 -0600
From: Jack Fitts <jackfitts@hotmail.com>
Subject: format NAME=
Message-Id: <369BB618.BC837490@hotmail.com>
how does one join two formats?
I tried the following code with no success.
Thank you in advance for help you may provide.
format NAME1=
Program @<<<<<<< Does thus and so @<<<<<<<< page @<<
$prog, $date, $page
.
format NAME2=
Sequence Field1 Field2
..
format NAME3=
sequence Field1 Field2 Field3 Field4.
.
if ($file1){
format .STDOUT_TOP= NAME1 . NAME2;
}
else{
format STDOUT_TOP= NAME1 . NAME3;
}
write;
------------------------------
Date: Tue, 12 Jan 1999 21:48:17 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Getting program to restart (HUP) more than once
Message-Id: <slrn79ngq3.5b.alastair@calliope.demon.co.uk>
Fluffy <meowing@banet.net> wrote:
>
>The following version works. Notice that I have to test *outside* the
>handler to see if the signal has been tripped (that gets flagged in the
>$HUPPED variable), and then call my exec.
Thanks for the response, once again. Your program certainly works and has helped
to re-formulate my effort.
Much appreciated!
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Tue, 12 Jan 1999 13:53:06 -0600
From: "John Cody" <jcody@triibune.com>
Subject: global search and replace in files
Message-Id: <77g98m$ijm5@news.tis-in.trb>
I'm just starting out with perl, and have gotten stuck on this one. I'm
trying to open an existing file, search for a string, and replace it in the
same file. This is what I have so far:
#!/usr/local/bin/perl
$file = "test";
open (FILE, "+<$file") || die "Can't open $file: $!";
while (<FILE>) {
s/foo/bar/;
}
close (FILE);
A little help is appreciated.
Thanks!
John
jcody@tribune.com
------------------------------
Date: 12 Jan 1999 12:39:47 PST
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: global search and replace in files
Message-Id: <77gbuj$iuk@journal.concentric.net>
"John Cody" <jcody@triibune.com> writes:
>I'm just starting out with perl, and have gotten stuck on this one. I'm
>trying to open an existing file, search for a string, and replace it in the
>same file.
open(S, "$file") || die("can't open $file: $!\n");
undef $/;
$j = <S>; close(S);
$j =~ s/foo/bar/g;
open(S, ">$file") || die("can't write $file: $!\n");
print S $j;
close(S);
would be one conceivable way. Also look at the -i option in Perl, which
is even easier:
#!/ulb/perl -pi.bak
s/foo/bar/;
Provide the filename on the command line, and the output is in filename.bak.
--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
-- supporting the Commodore 64/128: http://www.armory.com/~spectre/cwi/ --
head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"
------------------------------
Date: 12 Jan 1999 21:32:22 +0100
From: Pascal Rigaux <pixel_@geocities.com>
Subject: Re: global search and replace in files
Message-Id: <4wpv8kmdux.fsf@dre2.polytechnique.fr>
here is the script i use :
#!/usr/bin/perl -pi
BEGIN {
@ARGV < 3 and die "usage: replAll <text to replace> <replacement text> <files>\n";
$before = shift @ARGV;
$after = shift @ARGV;
}
s/\Q$before/$after/g;
Pixel.
------------------------------
Date: Tue, 12 Jan 1999 14:34:54 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: grep with boundaries and regex
Message-Id: <elbg77.j9g.ln@magna.metronet.com>
Jason Q. (pigs_can_fly@mindless.com) wrote:
: From @temp, I need to grep $word, which might be "=F".
: It works fine with this line,
: @temp = grep(/$word/,@temp);
: However, when I want to restrict to only whole word greps using this:
: @temp = grep(/\b$word\b/,@temp);
: it fails to identify "=F"
: I suppose it's due to the \b and think I need to specify $word as a
: regex because of the "=".
OK. Let's try this again.
The reason we're going 'round and 'round' is you haven't
completely specified the problem.
each "line" has a single word? Multiple words?
If it matches more that once for a "line" what should it do?
Include the first word? last word? all words that match?
Match the whole line if the word appears anywhere on the line?
...
: How do I achieve this?
The quality of the help you get will be in direct proportion
to the quality of the information given.
The easier you make it for us to help, the more help you will get.
Through all of these followups, we still don't know what your
data looks like!
Knowing what the data looks like is *crucial* when dealing
with regular expressions to operate on the data.
Don't be scared of posting. If you have made a good faith
effort to find the answer yourself (like reading about \b
in perlre.pod), then you can get good, free help here.
I would suggest posting a _complete_ (ie. something we
can run unchanged) and short program that illustrates
your problem. Along with what you _want_ it to do, and
what it is doing instead.
Something like:
"When I run the program below, it matches the second line,
and does not match the first line":
----------------------
#!/usr/bin/perl -w
chomp(@words = <DATA>);
$word = 'year';
@matched = grep /\b$word\b/, @words;
foreach (@matched) {
print "$_\n";
}
__DATA__
four score and seven years ago
nineteen seventy five was a good year
this has a 'standalone' =F (equal F) in it
this has a 'embedded' RT=FM (equal F) in it
----------------------
"This works great!"
"But if I change
$word = '=F';
then it matches NO lines"
"I want it to match the third line, but not match the fourth line"
If you had done that, then someone might have said:
"change it to
@matched = grep /(:?^|\W)$word\b/, @words;
if the first character of $word is a "non-word" character or
@matched = grep /\b$word(:?\W|$)/, @words;
if the _last_ character of $word is a "non-word" character.
And then you would have your answer!
;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Jan 1999 21:48:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: High resolution timing !
Message-Id: <erPm2.41$6e.2714@nsw.nnrp.telstra.net>
In article <369B07B6.D29D0EC0@cec.be>,
Stefan Nonneman <stefan.nonneman@cec.be> writes:
> Dear all,
>
> I am looking for a high-resolution timer (1ms or finer) that can be used
> in PERL.
# perldoc perlfaq8
Two questions in here which you may be interested in:
How can I sleep() or alarm() for under a second?
How can I measure time under a second?
The answer to the second one suggests the Time::HiRes module, which
will work on some systems.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: Tue, 12 Jan 1999 19:26:02 GMT
From: lbrown2@uswest.net
Subject: How to Timeout a Perl Socket Connect??
Message-Id: <77g7kv$eo1$1@nnrp2.dejanews.com>
Hello,
I am using a script that attempts connections to various servers. I find
that, if I can make the socket and bind but the server is not responding, the
Connect can take up to three minutes to time out.
I would like the timeout to occur at closer to one minute (or less)...
Is there a way to specify timeout for the socket Connect?
Please email!
THANKS!!!
-TroutMask
www.troutmask.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 12 Jan 1999 19:22:37 GMT
From: dhosek@webley.com
Subject: Re: If Larry Wall's listening out there....
Message-Id: <77g7ei$eh6$1@nnrp2.dejanews.com>
In article <F5GCG1.2A4@news.boeing.com>,
"Sam Patton" <samuel.patton@wichita.boeing.com> wrote:
> Ronald J Kimball wrote in message
> <1dladrd.n0uc301e8lt86N@bay1-324.quincy.ziplink.net>...
> >Andrew Mayo <andrew@geac.co.nz> wrote:
> >> Those of us working in a Windows environment generally will use notepad
> as a
> >> text editor. Simple-mindedly, notepad does *not* display line numbers.
> (it
> >> also doesn't do brace matching, but this I can live with)
> Heres a strange suggestion for you.
> I use the editor that came with my C++ 5.0. I can have multiple windows
> with it and it give me all the line numbers I
> need.
or grab emacs for NT. Not only will it give you line numbers, it's a friend,
it's a companion, it's the only product you will ever need.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 12 Jan 1999 15:05:03 -0600
From: Edmond Shum <shum@cig.mot.com>
Subject: Re: Low level perl
Message-Id: <369BB8FF.9FD5FEB@cig.mot.com>
No. It is not a "low" level language. Going back to IP packets
inspecting, I guess it needs tcpdump or snoop, etc.
If you are trying to do things with tcp/ip, it has a whole
module/section
on creating different tcp/ip communication but in a very high level
sense.
--
Edmond Shum System and Network Administration
Motorola CIG email: shum@cig.mot.com
Arlington Heights, IL phone: 847-632-6702
------------------------------
Date: Tue, 12 Jan 1999 19:13:32 GMT
From: dhosek@webley.com
Subject: Re: Making perl do tasks at specific times..
Message-Id: <77g6th$d0b$1@nnrp2.dejanews.com>
In article <19990112103201.18732.00004462@ng-ft1.aol.com>,
firstagyg@aol.com (FirstAGYG) wrote:
> Thanks for all the suggestions. the server's on linux.
> someone asked for a specific task or reason...mostly for sending mail on a day
> to day basis from a files already specified to go out that day.
>From a shell prompt, type man cron.
This isn't a perl problem; if you can't figure out cron on your own, ask on
one of the Unix groups.
Also, be aware that many systems restrict access to cron to prevent abuse; if
they do that, other options such as setting up your own daemon to schedule the
job will likely also be restricted.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 12 Jan 1999 15:31:03 -0500
From: "Indy" <indy@NOSPAMdemobuilder.com>
Subject: Re: Perl and LDAP
Message-Id: <77gbe6$qrg$1@nntp2.uunet.ca>
The PerlDap module you are refering to is the one by Clayton Donley. It is
a wrapper to an LDAP API. The LDAP API itself in implemented in a windows
DLL from Netscape.
Implementing an LDAP involves encoding and decoding ASN data structures and
low level bit manipulation. Writing such a thing in Perl is not practical.
It would be equivalent to writing the Perl interpreter in Perl - not
impossible, but impractical. For this reason I don't think you will find a
pure Perl implementation of LDAP out there.
Indy
www.perl2exe.com
Brian Sullivan wrote in message ...
>I have been confused by all the LDAP modules for Perl that seem to be
>around.
>
>What I would like is a Perl only module/code that would allow me to do
>some simple monitoring of an LDAP server ( is it up, how many current
>entries). Does such a beast exist ? Most of what I have seen seems to
>require addition of a .dll in windows. I would like to avoid that and
>keep as portable as possible. Am I dreaming here?
>
>Brian Sullivan (mailto:brians@meetingbywire.com)
>Meeting by Wire (http://www.meetingbywire.com)
>
>--
>Brian Sullivan (mailto:brians@meetingbywire.com)
>Meeting by Wire (http://www.meetingbywire.com)
>
>
------------------------------
Date: Tue, 12 Jan 1999 14:59:20 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-1201991459200001@aggie.coaps.fsu.edu>
In article <369c78c3.30816879@news.skynet.be>, bart.lateur@skynet.be (Bart
Lateur) wrote:
+ I R A Aggie wrote:
+
+ >Even so, there are times when I mutter "what was I thinking? what was I
+ >DRINKING??"... :)
+
+ ... and do I have any of it left?
...and where the heck did I put it? Perhaps in %liquour_cabinet? where's
the KEY! AAAAAIIIIIIIEEEEEEEEE
+ ;-)
Indeed...
James
------------------------------
Date: Tue, 12 Jan 1999 15:00:32 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-1201991500320001@aggie.coaps.fsu.edu>
In article <369B85F6.B68B0E1@mail.uca.edu>, Cameron Dorey
<camerond@mail.uca.edu> wrote:
+ I thought that cartooning was done by computers now. I wonder which
+ brand does the drawing for Mr. Adams?
I think its the Adams Mk I, Rev 0.
James
------------------------------
Date: Tue, 12 Jan 1999 12:08:25 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Perl Criticism
Message-Id: <369BABB9.E4117B70@atrieva.com>
Sean McAfee wrote:
> >> I'll take that wager. If you loose, you go away and never come back.
>
> >You lose;
> > "@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#";
> >is runnable.
>
> Not quite:
>
> In string, @tol now must be written as \@tol at -e line 1, near "$@#crypt=++||#@tol"
> Execution of -e aborted due to compilation errors.
>
> Using single quotes makes it runnable, though.
Rats... It seems there is always some guy who can break *anything* into
a one-liner!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 12 Jan 1999 12:53:09 -0800
From: Graffiti <ramune@zarathustra.calstatela.edu>
Subject: Re: Perl Criticism
Message-Id: <77gcnl$8dk$1@zarathustra.calstatela.edu>
In article <773obe$c0d$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, the oxymoronically named topmind@technologist.com
>mumbles:
>Oh, but in `programming languages', we do? And who is `we'? Is this
>your extensive research team? Could we please have their names as well,
>along with credentials and a list of their publications? I'd like
>to see the original sources that your team drew its conclusions from.
Are you *sure* you want to see the names? I'd bet Scott Nudds is one
of them. :-)
-- DN
------------------------------
Date: Tue, 12 Jan 1999 20:54:39 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <77gcqg$s9b$1@nnrp2.dejanews.com>
In article <7798qf$ilm$1@nnrp1.dejanews.com>,
dturley@pobox.com wrote:
> Two questions I have are, if Perl is such a terrible language, why are you
> wasting time using it? Use something else if you don't like it! If you think
> things could be done better, the source is freely available, why don't you fix
> it to suit your tastes?
>
> I suspect you can't.
>
It would require programming in C, which he doesn't like either.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 12 Jan 1999 21:53:51 +0100
From: Per Kistler <kistler@gmx.net>
To: Mickael Khalfa <mickaelk@milcse.cig.mot.com>
Subject: Re: Problem reading files from a remote server
Message-Id: <369BB65F.5612FAB@gmx.net>
> $path = " \\Nebula\projects " ;
...looses one '\', so rather: '\\Nebula\...'
or "\\\\Nebula\\..." :-)
Per.
--
Per Kistler kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: Tue, 12 Jan 1999 22:11:56 +0100
From: Per Kistler <kistler@gmx.net>
To: Hrvoje Niksic <hniksic@srce.hr>
Subject: Re: prog1 lookalike in Perl?
Message-Id: <369BBA9C.DCF65B31@gmx.net>
Do you mean like this?:
#!/usr/bin/perl
use strict;
my $change;
sub foo($);
sub foo($){
$_ = $_[0];
/^begin/ and $change = 1 and return "# $_";
/^end/ and $change = 0;
$_;
}
print foo "begin", "\n";
print foo "end", "\n";
print foo "blah", "\n";
Per.
Hrvoje Niksic wrote:
> Is there a Perl equivalent of the Lisp PROG1 form? PROG1 is very
> useful when you want to do something along the lines of
> (value, commands...)
> and have the whole expression return value. For example:
> # $change is a global boolean variable, initialized by the time &foo()
> # is invoked.
> sub foo ($)
> {
> my $new;
> $_ = shift;
> /^begin/ && ($change = 1);
> $new = $change ? "# $_" : $_;
> /^end/ && ($change = 0);
> $new;
> }
> ...
--
Per Kistler kistler@gmx.net
------------------------------------------------------------
------------------------------
Date: 12 Jan 1999 22:29:08 +0100
From: Hrvoje Niksic <hniksic@srce.hr>
Subject: Re: prog1 lookalike in Perl?
Message-Id: <kigsodgch97.fsf@jagor.srce.hr>
Per Kistler <kistler@gmx.net> writes:
> Do you mean like this?:
[...]
> sub foo($);
> sub foo($){
> $_ = $_[0];
> /^begin/ and $change = 1 and return "# $_";
> /^end/ and $change = 0;
> $_;
> }
In this example, you wiggled out by return-ing from the sub. However,
in the general case you cannot use return.
------------------------------
Date: Tue, 12 Jan 1999 20:41:09 GMT
From: lucadip@flashnet.it (Luca DP)
Subject: Proxy for e-mail...
Message-Id: <369cb33f.4273507@news.flashnet.it>
Hy! I have to write a proxy for e-mail that supports APOP. Could anyone help me? Thanks,
bye!
Luca
mailto:lucadip@flashnet.it
------------------------------
Date: Tue, 12 Jan 1999 15:07:49 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regexp in a var ?
Message-Id: <5jdg77.uog.ln@magna.metronet.com>
Thomas M. Vogel (vogel@pixelpark.com) wrote:
: what i need is something like this:
: $my_replace = 's/(\d).(\d)/$2.$1/' ;
: $new =~ $my_replace ;
: any idea ?
--------------------
#!/usr/bin/perl -w
$my_pattern = q/(\d).(\d)/; # regular expression
$my_replace = q/"$2.$1"/; # replacement code
$new = '1.2';
$new =~ s/$my_pattern/$my_replace/ee;
print "$new\n";
--------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Jan 1999 19:26:17 GMT
From: dhosek@webley.com
Subject: Re: regulart expression
Message-Id: <77g7kq$ent$1@nnrp2.dejanews.com>
In article <369B6FEC.C0F40AEA@adan.kingston.net>,
Andre Arpin <arpin@adan.kingston.net> wrote:
> I have an array and would like to find out if any element of the array
> does not contain the word 'not'
> what I would like is the eqivalent of
> grep -v not
Have you tried typing perldoc -f grep? you will learn quickly that you can do
things like
@RESULTS = grep (!/not/, @ARRAY);
to get what you want.
Learn to use perldoc. It is your friend.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 12 Jan 1999 13:55:02 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regulart expression
Message-Id: <ma9g77.j9g.ln@magna.metronet.com>
Andre Arpin (arpin@adan.kingston.net) wrote:
: what I would like is the eqivalent of
: grep -v not
grep $_ !~ /not/, @array; # preferred
or
grep !/not/, @array;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Jan 1999 19:57:40 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: SUMMARY: Optimizing `eval' in a loop
Message-Id: <UONm2.1748$Ge3.8743408@news.itd.umich.edu>
In article <kigr9t0e13b.fsf@jagor.srce.hr>,
Hrvoje Niksic <hniksic@srce.hr> wrote:
>Thanks to everyone who replied; as proposed by most people, I now use
>this:
>$closure = eval "sub { $expr }"
> || die "Error while compiling code: $expr\n";
^^
This is probably better written as "or".
>loop {
> ...
> eval { &$closure; } || die "Error while evaluating code: $expr\n";
> ...
>}
>(Of course, the second eval is merely to trap runtime errors.)
There's a bug here (besides the obvious one that "loop { }" is actually a
seldom-used method-dispatch syntax, most likely not what you intended).
The result of eval { } is the value of the last expression evaluated, so
if your $closure subroutine happens to return a false value, your script
will die. Use $@ to check on the success of eval:
eval { &$closure };
die "Error while evaluating code: $expr\n" if $@;
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Tue, 12 Jan 1999 21:41:20 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: SUMMARY: Optimizing `eval' in a loop
Message-Id: <369bc13d.1259759@news.skynet.be>
Sean McAfee wrote:
>eval { &$closure };
>die "Error while evaluating code: $expr\n" if $@;
No reason to throw away the exact contents of $@ either. It contains
useful info to what is wrong!
Bart.
------------------------------
Date: Tue, 12 Jan 1999 14:43:15 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Text manipulation
Message-Id: <35cg77.j9g.ln@magna.metronet.com>
icebeerberg@my-dejanews.com wrote:
: I am attempting to parse through a comma delimited text file to take each
: component and print out the components in a different format based on string
^^^^^
: length.
But you are not going to share what is to be the basis?
If it is unspecified, then it doesn't matter to you, and
we get to pick whatever string length basis we choose.
I choose to stick each field into a 10 char field (padded with
leading spaces) and a one space separator between each field.
If you want some other basis, then either code it up, or
explicitly ask for it ;-)
: Does anyone have a simple program example that is able to do this,
: or a module which may be able to accomplish this task.
: Any help would be appreciated.
--------------------------------
#!/usr/bin/perl -w
while (<DATA>) {
chomp;
printf "%10s %10s %10s %10s\n", split /,/;
}
__DATA__
one,two,three,four
five,six,seven,eight
--------------------------------
output:
one two three four
five six seven eight
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Jan 1999 21:14:15 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: tied hashed hash looses item #1
Message-Id: <ebohlmanF5Gtnr.A9s@netcom.com>
JPAH-FLA <mymail@nospam.com> wrote:
: I'm finding that an anon hashed hash tied with dbmopen consistently
: looses the fist item of each hash. I've demonstrated it in W32 as well
: as unix. I couldn't find any reference to this issue in Camel or this
: newsgroup or websites, but not for lack of trying!
: I created a hashed hash similar to the example in camel 2nd Ed P 270. It
: worked fine:
: $h{tom}{ctype} = "cat"; $h{tom}{colour} = "brown"; $h{tom}{build} =
: "fat";
There's your problem. A "hash of hashes" or "two-dimensional hash" is
actually implemented as a hash of references to hashes. The problem is
that when you store it in a DBM file, the references cease to refer to
anything when they're read back. You have to somehow "serialize" your
hash values before storing them. Modules like Data::Dumper and Storable
will help. Also check out the chapter on persistence in _Advanced Perl
Programming_.
------------------------------
Date: 12 Jan 1999 20:00:17 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Verify an email address
Message-Id: <77g9kh$n33$1@news.NERO.NET>
In article <m3ww2stl64.fsf@moiraine.dimensional.com>,
Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
>Does your employer understand that you have decided that some of
>their customers aren't important? Does your employer understand
>that you have made an arbitrary decision to disallow contact with
>an undetermined number of customers? Does your employer understand
>that the only net effect of this is to drive potential paying
>clients away?
Most businesses already think that some potential customers are not
important. If you ever visit a web site where there are imagemaps used
for site navigation but no plain text links, or where you get a page
that says "You must use Java to access this page; don't come back until
you update your browser", you have found a business that has decided to
drive away potential paying customers.
I found an ISP that sells web design services that has web pages like
this. Go figure.
>More importantly, do your employer's customers understand that because
>they don't match your sensibilities of what is and is not valid that
>they will not be allowed to communicate with your employer? Do you really
>think that this is justifiable under any circumstances?
Yes.
You keep referring to these people as customers. They aren't. They are
potential customers. Customers have a warantee registration card with an
email address to which to send comments.
------------------------------
Date: Tue, 12 Jan 1999 21:02:30 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Verify an email address
Message-Id: <GLOm2.69$N4.10552@news.shore.net>
Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
: Scratchie <upsetter@ziplink.net> writes:
:> So, for my purposes, I find it useful to use a regex which (among other
:> things) does not allow spaces in user names, even though
:> "a f &#$% "@someserver.com
:> may be a perfectly valid user name.
: Does your employer understand that you have decided that some of
: their customers aren't important? Does your employer understand
: that you have made an arbitrary decision to disallow contact with
: an undetermined number of customers? Does your employer understand
: that the only net effect of this is to drive potential paying
: clients away?
As I already explained, my opinion is that a solution such as the one
suggested in the FAQ would drive off many more potential users (no one is
a customer; no one has to pay for anything).
Furthermore, if I ever explained it to my boss in so many terms, he would
agree with me 100%. If we had to explain it to our clients or their
clients ("adding this feature will make the software run better, create
fewer hassles with your ISP and help weed out mis-typed email addresses,
but some people with extremely unusual email addresses will have to sign
up under a different email address"), I don't think it would be a problem.
In one of the the actual applications I maintain, over 8000 people signed
up with no email validation whatsoever. When I ran the email checker on
it, all the errors I came up with were clearly wrong (things like
"myName@aol" or "my Name@aol.com") and I didn't see a single "user@ip
address", "fred&barney@stonehenge.com" or any of the other contrived
examples that always come up in this newsgroup whenever the subject is
raised. I'm comfortable with that.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------
------------------------------
Date: 12 Jan 1999 21:08:07 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Verify an email address
Message-Id: <77gdjn$a19$1@news.panix.com>
The Email::Valid module apparently does a pretty good job:
#!/usr/local/bin/perl -w
use Email::Valid;
while ($address = <DATA>) {
chomp $address;
$valid = new Email::Valid;
if ($valid->address( -address => $address)) {
print "$address is valid\n";
} else {
print "$address is not valid\n";
}
}
__DATA__
user@[207.82.252.251]
postmaster@[127.0.0.1]
fred&barney@stonehenge.com
art cohen@aol.com
"a f &#$% "@someserver.com
prints:
user@[207.82.252.251] is valid
postmaster@[127.0.0.1] is valid
fred&barney@stonehenge.com is valid
art cohen@aol.com is not valid
"a f &#$% "@someserver.com is valid
--
Clay Irving
clay@panix.com
------------------------------
Date: 12 Jan 1999 13:32:37 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Verify an email address
Message-Id: <m1hftw89e2.fsf@halfdome.holdit.com>
>>>>> "Clay" == Clay Irving <clay@panix.com> writes:
Clay> The Email::Valid module apparently does a pretty good job:
Clay> #!/usr/local/bin/perl -w
Clay> use Email::Valid;
What "Email::Valid" module?
cpan> install Email::Valid
Warning: Cannot install Email::Valid, don't know what it is.
Try the command
i /Email::Valid/
to find objects with similar identifiers.
If it's not in the CPAN, it doesn't exist.
print "Just another CPAN user,"
--
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@teleport.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: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4632
**************************************