[12745] in Perl-Users-Digest
Perl-Users Digest, Issue: 155 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 15 13:07:21 1999
Date: Thu, 15 Jul 1999 10:05:12 -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 Thu, 15 Jul 1999 Volume: 9 Number: 155
Today's topics:
Re: C-like #define macros in Perl <uri@sysarch.com>
Re: file test for existence of path? (Randal L. Schwartz)
Getting the debugger to break at a warning <lucs@cam.org>
Re: How to get hostname? <gellyfish@gellyfish.com>
Re: How to get hostname? simon@whitestar99.demon.co.uk
Re: How to get hostname? <ckaiser@stockholm.ptloma.edu>
How to output derived value as float <tom.kralidis@ccrs.nrcanDOTgc.ca>
Re: How to output derived value as float (Larry Rosler)
Re: HTTP and Perl <ckaiser@stockholm.ptloma.edu>
ipc::shareable and solaris-2.6 francesc_guasch@my-deja.com
Re: learning perl (Randal L. Schwartz)
mod_perl question kirk@kaybee.org
Re: newby Q- how:perl script to cgi? <gellyfish@gellyfish.com>
Re: newby Q- how:perl script to cgi? (Andreas Fehr)
Non-roman character set <mtgonzls@stanford.edu>
Re: Old database is erased when I add new information (John Stanley)
Re: Old database is erased when I add new information (John Stanley)
Re: Opposite of chr() <hiller@email.com>
Re: Problem with MacPerl - thanks for help (Guy Cavet)
SOLVED: regex help needed <prlawrence@lehigh.edu>
Re: Statistics for comp.lang.perl.misc (Gabriel Russell)
Tiny error in perlfaq5 (John Borwick)
Re: Tiny error in perlfaq5 <tchrist@mox.perl.com>
Re: Variable limitations (Tad McClellan)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Jul 1999 12:05:31 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: C-like #define macros in Perl
Message-Id: <x7n1wxnbjo.fsf@home.sysarch.com>
>>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:
JS> Abigail <abigail@delanet.com> wrote:
>> Uri Guttman (uri@sysarch.com) wrote on MMCXLIV September MCMXCIII in
>> <URL:news:x7u2r6muhk.fsf@home.sysarch.com>:
>> ??
>> ?? normally i would agree that macros makes little sense in perl. i
>> ?? probably would never use them in production code since you may not have
>> ?? control over the cpp and it will slow things down. but i found a very
>> ?? good use for -P in a sort benchmark system i am creating. see the thread
>> ?? in moderated (-P is in the title) from a couple of weeks ago.
>>
>>
>> The system admin of my machine has declared that access to clp.mod is
>> forbidden.
>>
JS> And the worrying thing is that Abigail *is* that admin ;-}
d'oh! i knew that! can she allow her lusers to use deja? here is the url
for the post with the whole description of how i used -P
http://x28.deja.com/[ST_rn=ps]/getdoc.xp?AN=490954942&search=thread&CONTEXT=932054565.1150877726&HIT_CONTEXT=932054565.1150877726&HIT_NUM=3&hitnum=9
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 15 Jul 1999 09:12:13 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: file test for existence of path?
Message-Id: <m1vhblsxia.fsf@halfdome.holdit.com>
>>>>> "Vladimir" == Vladimir Gabrielescu <vgabriel@lochaber.rutgers.edu> writes:
Vladimir> Interestingly enough, "-e" seems to identify the existence of any
Vladimir> file type except dangling links. I assume this is because of a
Vladimir> stat versus lstat issue. Is this intentional or a bug? I can't
Vladimir> seem to find this behavior documented anywhere.
That's intentional...
"find all broken links":
find2perl /some/place -eval '-l and not -e' -ls | perl
If you want to know if something exists even if it's a dangling
symlink, use stat($thing) and check for a non-empty return. That's
the same cost as a -e anyway. :)
print "Just another dangling Perl hacker,"
--
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: 15 Jul 1999 12:27:47 +0000
From: Luc St-Louis <lucs@cam.org>
Subject: Getting the debugger to break at a warning
Message-Id: <m3lnci5c8s.fsf@haydn.lucs.org>
Some code I'm running (not mine), generates a lot of "Use of
uninitialized value at ...". How difficult would it be to set up
things so that the debugger would automatically break when reaching
the lines that cause those warnings to be emitted?
The idea is to do this without having to insert breakpoints manually,
and without modifying the offending code.
Easy or hard?
--
Luc St-Louis
lucs@cam.org
------------------------------
Date: 15 Jul 1999 17:07:16 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to get hostname?
Message-Id: <378e0734@newsread3.dircon.co.uk>
Nabil Courdy <moab@emirates.net.ae> wrote:
>
>
> What function to use to get the nodename of
> the host machine?
>sh$ perldoc Sys::Hostname
Sys::Hostname(3User Contributed Perl DocumentatioSys::Hostname(3)
NAME
Sys::Hostname - Try every conceivable way to get hostname
SYNOPSIS
use Sys::Hostname;
$host = hostname;
DESCRIPTION
Attempts several methods of getting the system hostname
and then caches the result. It tries
syscall(SYS_gethostname), `hostname`, `uname -n`, and the
file /com/host. If all that fails it croaks.
....
/J\
--
"How much fun can a girl have with a rabbit?" - Channel 4 Continuity
Announcer
------------------------------
Date: Thu, 15 Jul 1999 15:57:51 GMT
From: simon@whitestar99.demon.co.uk
Subject: Re: How to get hostname?
Message-Id: <7ml0dm$jld$1@nnrp1.deja.com>
In article <7mkvp1$jc8$1@nnrp1.deja.com>,
Nabil Courdy <moab@emirates.net.ae> wrote:
>
>
> What function to use to get the nodename of
> the host machine?
>
> --
> Nabil Courdy
> mooab@emirates.net.ae (Sub moab for mooab)
> ======================
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Um..
my $host = `hostname`;
Or are you looking for a Perl only solution
Simon
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 15 Jul 1999 11:12:02 -0500
From: Cameron Kaiser <ckaiser@stockholm.ptloma.edu>
Subject: Re: How to get hostname?
Message-Id: <zKnj3.5937$be.155640@newscene.newscene.com>
Nabil Courdy <moab@emirates.net.ae> writes:
>What function to use to get the nodename of
>the host machine?
chomp($hostname = `hostname`);
if you're on Unix.
--
Cameron Kaiser * ckaiser@stockholm.ptloma.edu * posting with a Commodore 128
http://calvin.ptloma.edu/~spectre/ * "When in doubt, take a pawn." -- M:I
-- Supporting the Commodore 64 and 128: http://www.armory.com/~spectre/cwi/ --
head moderator comp.binaries.cbm * cbm special forces unit $ea31 [tincsf]
------------------------------
Date: Thu, 15 Jul 1999 11:34:37 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: How to output derived value as float
Message-Id: <378DFF8D.9855CC2F@ccrs.nrcanDOTgc.ca>
I am writing a script to extract given values from a text file and print
them to another file. One of the derived values involves some
calculations, assigning this value to a variable. The values involve
floats.
eg. $value = 5464085.0 + ((400 -1) * 5);
print "$value";
..gives me 5466080
whereas if I alter the equation to:
eg. $value = 5464085.1 + (400 -1) * 5);
print "$value";
..gives me 5466080.1, picking up the decimal place if not a zero value.
How can I print out the first example as 5466080.0, to show one decimal
place when 0?
Any advice is appreciated.
Thanks
..Tom
-----------------------------------------------------------------------------------------
Tom Kralidis Geo-Spatial Technologist
Canada Centre for Remote Sensing Tel: (613) 947-1828
588 Booth Street , Room 241 Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7
http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------
------------------------------
Date: Thu, 15 Jul 1999 09:29:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to output derived value as float
Message-Id: <MPG.11f7ac53ad10d182989cd7@nntp.hpl.hp.com>
In article <378DFF8D.9855CC2F@ccrs.nrcanDOTgc.ca> on Thu, 15 Jul 1999
11:34:37 -0400, Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> says...
...
> How can I print out the first example as 5466080.0, to show one decimal
> place when 0?
printf '%.1f', 5466080;
`perldoc -f sprintf`
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 15 Jul 1999 11:07:06 -0500
From: Cameron Kaiser <ckaiser@stockholm.ptloma.edu>
Subject: Re: HTTP and Perl
Message-Id: <tGnj3.5925$be.160606@newscene.newscene.com>
David Greer <dgreer@connectnet.com> writes:
>Know of any good resources dealing with getting HTTP with Perl and/or
>Perl socket scripting?
<plug shameless>
You could try
http://httpi.ptloma.edu/
</plug>
--
Cameron Kaiser * ckaiser@stockholm.ptloma.edu * posting with a Commodore 128
http://calvin.ptloma.edu/~spectre/ * "When in doubt, take a pawn." -- M:I
-- Supporting the Commodore 64 and 128: http://www.armory.com/~spectre/cwi/ --
head moderator comp.binaries.cbm * cbm special forces unit $ea31 [tincsf]
------------------------------
Date: Thu, 15 Jul 1999 16:09:09 GMT
From: francesc_guasch@my-deja.com
Subject: ipc::shareable and solaris-2.6
Message-Id: <7ml12p$jui$1@nnrp1.deja.com>
Hi.
I need to install ipc::shareable. I succeeded with linux
but It fails to do the tests in solaris-2.6
#make test
ok (1..7)
shmget returned undef: Invalid argument at test.pl line 128
make: *** [test_dynamic] Error 22
parra:/usr/src/ipc_shareable-0.30# shmget returned undef: Invalid
argument at test.pl line 112
The test are the real IPC test:
# --- Now try some real IPC
$ok = 1;
++$number;
$SIG{'CHLD'} = 'IGNORE';
$pid = fork;
defined $pid or die $!;
if ($pid == 0) {
# --- Child
sleep 3;
tie($scalar, IPC::Shareable, 'data', { 'create' => 'yes', 'destroy'
=> 'no' })
My environment:
ld: Software Generation Utilities - Solaris/ELF (3.0)
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
SunOS 5.6 Generic_105181-14 sun4u sparc SUNW,Ultra-1
perl 5.005_03 built for sun4-solaris
I tried:
- I read the README it tells about decreasing SHM_BUFSIZ, I decreased
from 32768 till 4096 unsuccessfull.
- I reinstalled perl.
- I tried two latest versions of egcs
- I tried gcc-2.8.1
- I modified Makefile so it uses the solaris ld in /usr/ccs/bin
- I installed the latest recommended solaris patches
What else can I do ?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 15 Jul 1999 09:17:20 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: learning perl
Message-Id: <m1r9m9sx9r.fsf@halfdome.holdit.com>
>>>>> "messmer" == messmer <messmer@sirius.com> writes:
messmer> Im having trouble with exersize one in chapter 5. The answer
messmer> given in the back of the book seems neither to work, or to
messmer> make any sense whatsoever.
According to my notes (mental and otherwise), we've had no reports of
any typos in any edition/printing of the llama against Chapter 5,
exercise 1. And Stonehenge teaches that class about every other week
for at least the past few years, so I can't imagine we would have
overlooked a missing piece of the answer.
Could you perhaps paste your code here and let us see where you've
typo'ed it when you typed it in? :)
--
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: 15 Jul 1999 16:44:18 GMT
From: kirk@kaybee.org
Subject: mod_perl question
Message-Id: <7ml352$lt2$1@news-int.gatech.edu>
I don't know if this is the right newsgroup... but here goes.
I have tried running this perl script through Apache's mod_perl
on both Red Hat 5.2 and 6.0 (with all updates applied).
However, all I ever get is an empty page in my web browser and
an error in the error log:
[notice] child pid 2765 exit signal Segmentation fault (11)
Here is the script, what am I doing wrong?
#!/usr/bin/perl -w
use strict;
use CGI;
my $cgi = new CGI;
print $cgi->header;
print $cgi->start_html("Test Page");
print "<H1> Test Page </H1>\n";
--
Kirk Bauer -- Georgia Tech -- kirk@kaybee.org <== Finger for PGP
http://www.kaybee.org/~kirk ResNet RTA Computer Engineering
GT Sport Parachuting Club! http://cyberbuzz.gatech.edu/skydive
------------------------------
Date: 15 Jul 1999 17:05:21 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newby Q- how:perl script to cgi?
Message-Id: <378e06c1@newsread3.dircon.co.uk>
monotone@my-deja.com wrote:
> I've been trying to create the beginning cgi's in "Learning PERL" by
> O'Reilly but I can't get my browzer to recognize them as cgi's.
>
> I've made them executables, given them names like "hello.html" and
> "hello.cgi" but they still come accross as plain text.
>
> What am I not doing?
>
Reading the documentation for the Web Server you are using and asking
the question in the right group for a start ...
/J\
--
"Conservatives have called on Sports Minister, Tony Banks, to resign
after calling William Hague a foetus" - BBC News Website
------------------------------
Date: Thu, 15 Jul 1999 13:51:42 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: newby Q- how:perl script to cgi?
Message-Id: <378de6fb.20015901@news.uniplus.ch>
On Thu, 15 Jul 1999 02:06:53 GMT, monotone@my-deja.com wrote:
>
>What am I not doing?
>
Reading the documentation of your WEB server...
(The one I know uses some directory called cgi-bin, but this
may be different on your system/configuration)
Andreas
------------------------------
Date: Thu, 15 Jul 1999 09:07:02 -0700
From: "L Gonzales" <mtgonzls@stanford.edu>
Subject: Non-roman character set
Message-Id: <7ml0v6$lio$1@nntp.Stanford.EDU>
Hi all!
I've been looking through perl.com for info on non-roman character sets that
perl is capable of parsing. I've seen only cyrillic character sets modules,
but has anyone actually used perl for text that is non-roman?
Thanks,
Lisa
------------------------------
Date: 15 Jul 1999 16:21:51 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Old database is erased when I add new information
Message-Id: <7ml1qv$mst$1@news.NERO.NET>
In article <7mjsrm$1er$0@216.39.141.200>, Neko <tgy@chocobo.org> wrote:
>On 15 Jul 1999 04:10:55 GMT, stanley@skyking.OCE.ORST.EDU (John Stanley)
>wrote:
>
>>In article <87hfn6mzkm.fsf@a2b01118.paralynx.bconnected.net>,
>>Brad Murray <bjm@a2b01118.paralynx.bconnected.net> wrote:
>>
>>>Perhaps better than hiding source is a tamper-proof label. Say an MD5
>>>message digest of it or something.
>>
>>You missed the point completely. Your reputation is hurt much less by
>>someone who cannot edit your code and claim you gave them bad code in
>>the first place than by someone who can do that. Your time is wasted
>>much less often by someone who cannot edit the code and demand you fix
>>than than someone who can.
>
>Your reputation is enhanced by someone who can edit your code and send in
>patches for overlooked bugs than by someone who cannot do that.
Yes, perhaps, but unfortunately the person who can do that is much less
likely to go around the net announcing his praise for you than the idiot
who "fixes" your code and calls you unethical because you won't fix it
for him.
>Your time is
>saved everytime by someone who can edit your code and offers to fix it for
>you than by someone can't.
Ummm, no actually it isn't. It takes me much less time to be told of a
bug and fix it myself than to try incorporating changes made by someone
else. I currently have some code that is being used to two other people.
They have both made enhancements to that code, as have I. I am now faced
with trying to merge all three versions. I saved time on the front end
by not making the changes myself, but lose time because I still have to
incorporate their sometimes conflicting fixes with my code which is now
different from what they have.
If doing this were such a wonderful timesaver, nobody would have written
any of the several version control systems (e.g. SCCS, RCS ...). They
would have had so much time saved by having multiple versions that they
wouldn't need to control them.
An additional benefit of doing the fixes yourself is that you can give
the user code that has had other bugs that he hasn't found fixed, and
won't he think you are a wonderful person for giving him a free update?
------------------------------
Date: 15 Jul 1999 16:48:05 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Old database is erased when I add new information
Message-Id: <7ml3c5$niv$1@news.NERO.NET>
In article <7mkrkr$q9v$1@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <7mjn0f$2ol$1@news.nero.net>,
> stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
>: In article <87hfn6mzkm.fsf@a2b01118.paralynx.bconnected.net>,
>: Brad Murray <bjm@a2b01118.paralynx.bconnected.net> wrote:
>: >Everyone has *something* they could use to bash a truck to
>: >pieces.
>:
>: Right. There is absolutely no difference between someone who thinks
>: they can fix their truck with a sledgehammer and someone who thinks
>: they can add a feature to a working piece of perl code using a text
>: editor.
>
>Thank you for admitting this.
I see that sarcasm is a new concept to you.
>People who aren't qualified to do
>work on automobiles shouldn't be accommodated, so neither should
>people who aren't qualified to do work on code.
Yes, and by giving people who are not qualified to work on code the
source you are accommodating them. When you do that, you are quite
likely to be wasting time later fixing what they break. If you have a
support agreement where you get paid for this time, AND you want to be
spending your time doing this, that's fine. Please feel free to give
people all the source YOU want to. Just accept that some people don't
want to spend the rest of their life supporting something they wrote,
especially when that support is fixing user-broken code.
>: Nobody would ever be confused into thinking they
>: can add features without understanding the whole program, ever.
>
>Are you trying to intimidate us by whipping that straw man's ass?
I'm not sure why you think the actions of someone who is not qualified
to modify code is a straw man when we are discussing the problem of
people who are not qualified to modify code breaking the code and
expecting fixes from the author.
>People can still screw things up by making local changes.
They cannot screw up the code if they do not have the code.
>One of the
>most common calls to electricians starts when people try to wire
>three-way switches for themselves and end up hosing it. It's just
>a simple light switch, though. Right?
I have never seen anyone coming to USENET calling the local electrician
unethical because he would not answer his phone or come out to fix wiring
the user broke. We've just had a case of a software author being called
unethical for not fixing a user-created problem. You figure it out.
>: And most of all, nobody has ever come to this newsgroup telling us
>: that the programmer who sold him some code that used to work until the
>: user tried fixing is unethical.
>
>What's your point? There will always be people with stupid opinions
>or who believe that which is demonstrably false.
You may feel that you lose nothing defending yourself against these
people, but I expect that most people would rather not have to spend
their time defending themselves against baseless charges. Even if you do
spend the time, most people will not remember the defense, only the
accusation. I have no idea who "Matt" is, I have never seen his code.
All I remember is "Matt's code" is something to stay away from. Even if
Matt came here in person to defend what he had written, which he may
have, I wouldn't remember that as much as the accusation. You do
remember that Carol Burnett is an alcoholic, right? It was on the front
page of a tabloid. The fact that she sued the tabloid and won is a
historical footnote.
>: Good for you. That's your right. Just as it is the right for someone
>: else to not want to deal with code broken by foolish users.
>
>Good. We both agree that such users are foolish. Just do yourself
>a favor and don't suffer a fool.
The way not to "suffer the fool" is to not give him the code.
>: Why is it
>: that those who oppose hiding source are so free to tell others that they
>: cannot do it, even though those who want to hide their code never tell
>: others they can't do what they want to?
>
>Poor little mistreated John.
Give it a rest, Greg.
>You might do better if you would.. oh, I
>don't know.. *READ* what people write. No one is telling you what to
>do; we're just pointing out your bad logic.
Hmmm. Then all those people who respond "you should't do that", and "if
you do that you shouldn't be using perl" aren't trying to tell people
what they should do?
>ESR talks about when it makes sense to stay closed.
So those who make blanket statements are wrong? Fine. Glad you agree.
Now if we could get them to stop telling people that they shouldn't use
perl we'd be one step ahead.
>Perhaps you should consider another line of work if your reputation
>is so shaky and easily toppled.
Yes, of course, there is no difference between "hurt" and "easily
toppled". Oops, sorry, I forgot. Sarcasm doesn't work here.
>: Your time is wasted
>: much less often by someone who cannot edit the code and demand you fix
>: than than someone who can.
>
>Your time is wasted much less when you protect yourself with a decent
>contract. Time spent suffering a fool will always be time wasted.
I do wish someone would explain how a contract prevents people from
modfiying code. Contracts do not prevent copyright violations, they do
not prevent code modification, they do not prevent reverse engineering.
All they do is provide legal remedies when it happens, IF you can afford
to hire the lawyers to enforce the contract and the other guy cannot. They
do not stop the person who says "I need this change today, I cannot get
ahold of the author, so I will change it myself. OOps, where did my
extremely valuable database go? It's the fault of the software author..."
------------------------------
Date: Thu, 15 Jul 1999 16:06:24 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: Opposite of chr()
Message-Id: <378E0703.ECB8E208@email.com>
Ronald J Kimball wrote:
>
> Jordan Hiller <hiller@email.com> wrote:
>
> Returns the character represented by that NUMBER in the character
> set. For example, chr(65) is "A" in ASCII. For the reverse, use ord
> in the manpage.
>
Oops...
------------------------------
Date: 15 Jul 1999 09:50:52 -0700
From: gcavet@pmgm.Stanford.EDU (Guy Cavet)
Subject: Re: Problem with MacPerl - thanks for help
Message-Id: <7ml3hc$q3o@pmgm.Stanford.EDU>
Big thanks to Chris Nandor and Paul Schinder for their help.
The MacPerl FAQ was also useful.
I installed system 7.6.1 and the CFM68K MacPerl and now everything is
hunky-dory.
Guy
------------------------------
Date: Thu, 15 Jul 1999 12:00:35 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: SOLVED: regex help needed
Message-Id: <7ml0j9$1ubk@fidoii.cc.Lehigh.EDU>
#!/usr/local/bin/perl -w
use strict;
my @x = ('m','f','u','m u','m,f,u','mf','m,m','u f,m','f u f','m f u m');
my $r = <<'';
(?ix) # case-insensitive, allow whitespace
^
(?: # Start 1st non-backrefing group
\s*([MFU])\s* # Save matched char for later use
(?!.*\1.*) # Fail if matched char recurs later in string
(?: # Start 2nd non-backrefing group
[\,\s]\s* # Require delimitation by comma and/or whitespace
([MFU])\s* # Save matched char for later use
(?!.*\2.*) # Fail if matched char recurs later in string
(?: # Start 3rd non-backrefing group
[\,\s]\s* # Require delimitation by comma and/or whitespace
[MFU]\s*
)? # 3rd group not required
)? # 2nd group not required
)
$
foreach (@x) {
if ( m{$r} ) {
print "$_ passed\n";
print " \$1 was $1\n" if ($1);
print " \$2 was $2\n" if ($2);
print " \$3 was $3\n" if ($3);
} else {
print "$_ failed\n";
print " \$1 was $1\n" if ($1);
print " \$2 was $2\n" if ($2);
print " \$3 was $3\n" if ($3);
}
}
__END__
Thanks to chipmunk for [,\s]\s*
Thanks to Jim Eshleman for reminding me about (?!...)
And everyone but me seemed to remember [MFU] is more efficient than (M|F|U)
(duh, I just attended Mark-Jason's YAPC regex talk where he told me so!)
ANY FURTHER INPROVEMENTS WELCOME!
- Phil R Lawrence
------------------------------
Date: Thu, 15 Jul 1999 16:04:20 GMT
From: grussell@hushmail.com (Gabriel Russell)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <378e066a.173363583@news.supernews.com>
On Wed, 23 Jun 1999 11:03:52 -0700, David Cassell
<cassell@mail.cor.epa.gov> wrote:
>Because everyone's scared of Tom? I dunno. I think
I know that I'm scared of Tom.
------------------------------
Date: Thu, 15 Jul 1999 15:49:24 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Tiny error in perlfaq5
Message-Id: <379002a7.13164499@newshost.unx.sas.com>
In perlfaq5, under "I still don't get locking. I just want to
increment the number in the file. How can I do this?"
The code $hits = int( (time() - 850_000_000) / rand(1_000) );
will occasionally generate a division by zero error.
Just noticed it as I was looking for something else.
--
John Borwick
------------------------------
Date: 15 Jul 1999 10:59:02 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Tiny error in perlfaq5
Message-Id: <378e1356@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, jobosw@unx.sas.com writes:
:In perlfaq5, under "I still don't get locking. I just want to
:increment the number in the file. How can I do this?"
:The code $hits = int( (time() - 850_000_000) / rand(1_000) );
:will occasionally generate a division by zero error.
Either you don't know what rand(1_000) does, or else
you have a remarkably sparse notion of occasionally. :-)
--tom
--
"The number of Unix installations has grown to 10, with more expected."
- _The Unix Programmer's Manual_, Second Edition, June, 1972.
------------------------------
Date: Thu, 15 Jul 1999 07:23:06 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Variable limitations
Message-Id: <qagkm7.oel.ln@magna.metronet.com>
Rasmus Aaen (rasmus@aen.dk) wrote:
: Is it true, that scalar variables in Perl has a size limit?
Yes.
: If so, how do
: you change that limit?
Buy more RAM, or increase swap space :-)
Perl will allow as much as your system has the resources to support.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 155
*************************************