[6501] in Perl-Users-Digest
Perl-Users Digest, Issue: 126 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 16 06:07:20 1997
Date: Sun, 16 Mar 97 03:00:22 -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 Sun, 16 Mar 1997 Volume: 8 Number: 126
Today's topics:
Re: a tricky regex (Jeffrey)
AntiSPAM is as bad as SPAM (was Can you help me with th <dbenhur@egames.com>
Re: Can you help me with this script? <dbenhur@egames.com>
Re: Help: Regular Expression (Jeffrey)
Re: Installing Modules under Macperl & Getting the best mel@west.net
Re: matching whitespace? (Jeffrey)
No such thing as "soft reference" (was Re: Is globbing <dbenhur@egames.com>
Re: Pattern matching on stream (Jeffrey)
Re: Perl 5 manual <tchrist@mox.perl.com>
Re: Perl for WIN32 - Can't Run Scripts From Web Server (Eric Bohlman)
Re: Perl for Windows NT (Clay Irving)
Re: Perl5.003 3x memory inefficient, Perl4.003 better? (Gurusamy Sarathy)
Re: Perl5.003 3x memory inefficient, Perl4.003 better? (Eric Arnold)
Re: Reg. expression question <dbenhur@egames.com>
Re: Simple question of Exclusion rosenthd@erols.com
Re: Sorting help (Eric Bohlman)
Re: Sorting help (Clay Irving)
Re: Standard "Reaper" procedure doesn't work on Solaris (Jason C Austin)
Re: What language do Perl REs recognize? (Eric Bohlman)
Re: What language do Perl REs recognize? (Jeffrey)
Re: Who makes more $$ - Windows vs. Unix programmers? (Jason C Austin)
Re: Win32: How to use a MessageBox or Dialog <agruskin@melbpc.org.au>
Re: year 2000 question (Brendan O'Dea)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Mar 1997 20:34:54 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: tadmc@flash.net (Tad McClellan)
Subject: Re: a tricky regex
Message-Id: <JFRIEDL.97Mar15053454@tubby.nff.ncl.omron.co.jp>
[mail & post]
Bryan Hart (bryan@eai.com) wrote:
|> > I'm looking for a regex (or some other way) to remove whitespace from a
|> > string EXCEPT when the whitespace is enclosed in quotes("").
Try:
s/("[^\"]+")|\s+/$1/g;
The regex has two alternatives, one which has things you want to keep, and one
that has things you want to get rid of.
Tad McClellan <tadmc@flash.net> wrote:
|> As I'm yet only a lowly apprentice, it seems likely that the Master
|> will be able to improve upon it, but it will work in the mean time ;-)
Tad, see the example starting at the top of p173. :-)
Jeffrey
------------------------------
Date: Wed, 12 Mar 1997 09:43:22 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
Subject: AntiSPAM is as bad as SPAM (was Can you help me with this script?)
Message-Id: <3326EB3A.6772@egames.com>
> Subject: Can you help me with this script?
> From: BOB <somebody@somewhere.com>
^^^^^^^^^^^^^^^^^^^^^^
> Message-ID: <5g4ndo$96e@qualcuno.nettuno.it>
Hey, BOB!
If you're going to partake of this public
resource for free help and advise, please be a
good citizen and use a real email address in your
postings.
Consider that long bounced message replies are
every bit as annoying and unsolicited to their
recipients as SPAM (unsolicited commercial email)
is to you. I didn't appreciate the bounce from
somewhere.com in my mailbox this morning. It
shouldn't be my job to deal with your bogus address
when replying to your public postings.
And that goes for the rest of you who think
it's clever to change your address to
dweeb@myplace.com.oh.please.dont.spam.me.
The results of your email address mangling is
often to effectively SPAM those who have taken
some time to actually try to help you.
I use a real address and I'm a frequent USENET
poster, but I get at least as many bounced replies
from my courtesy responces to anti-spam addressees
as I get actual spam from bulk emailers.
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: Wed, 12 Mar 1997 00:10:58 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: BOB <somebody@somewhere.com>
Subject: Re: Can you help me with this script?
Message-Id: <33266512.7F42@egames.com>
[mailed & posted]
BOB wrote:
> I use MacPerl 5 as a port to Perl: I've wrote a simple script that
[snip]
> 2. the brief script is the following:
[snip]
> print CTP <<"EndOfLetter";
> Dear People:
> find enclosed $premium of the annual premium for insuring
> my $beastie against $hazard.
> EndOfLetter
> print CTP"\f";
> }
[snip]
> 4. But the script doesn't work: macPerl give me the following error:
> #Missing right bracket, at end of line
> what does it mean? I've changed all the parentheses but without luck...
> Any help will be appreciated!!
I don't see anything obvious wrong, but something that often
goes wrong when you move a script from unix to DOS or
Mac without specifying an ASCII transfer mode is that the
end-of-line characters don't get translated. Most Perl
code won't care, but the "here-doc" format is sensitive
to what a "line" is on the native system. You might
want to check that the "EndOfLetter" line above ends
with the CR (^M) the Mac expects and not a LF (^J) as
unix uses.
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: 15 Mar 1997 16:12:08 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: vtolbert@mindspring.com (Victor Tolbert)
Subject: Re: Help: Regular Expression
Message-Id: <JFRIEDL.97Mar16011208@tubby.nff.ncl.omron.co.jp>
[mail & post]
Victor Tolbert <vtolbert@mindspring.com> wrote:
|[data looks like:]
|> Name: Julie Jackson
|> Company: Corp
|> Home:
|> Email: jacksj8@mail.place.edu
|>
|> Comments:
|> Header
|>
|> Name: Michael Williams
|> Company: ABC Company
|> Email: Mic.Will@abc.com
|>
|> Comments:
|> ...
|> +++++
|>
|> I would like to create a regular expression to extract the name and email
|> addresses an put it in a pipe delimited format like this.
|>
|> Julie Jackson|jacksj8@mail.place.edu
|> Michael Williams|Mic.Will@abc.com
|> ...
Probably the easiest way is to read the data in "paragraph mode"
(see discussion of $/ in the Perl docs, or on p132 of Programming Perl)
and then extract the name and email.
Something like the following should work (although untested -- I'm
typing directly into my newsreader):
open(MAILLIST, maillist);
$/ = ""; ## input in paragraph mode
my($name, $email);
while (<MAILLIST>)
{
if (($name) = /^Name:\s+(.*)/
and
($email) = /^Email:\s+(.*)/)
{
print "$name|$email\n";
}
}
If a name or email address is not found (or, pedantically, if either are
the string "0" :-), nothing will be printed. But when both are found,
they'll be printed as you wanted.
Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
O'Reilly & Associates' _Mastering Regular Expressions_
http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: 15 Mar 1997 10:06:50 -0800
From: mel@west.net
Subject: Re: Installing Modules under Macperl & Getting the best out of Makemaker
Message-Id: <5geofq$lb9@lana.zippo.com>
In article , schinder@leprss.gsfc.nasa.gov says...
>
>In article <332599EE.5E7E@no.spam>, geoff@no.spam.leeds.ac.uk wrote:
>}
>} My objective is to install the libwww modules(s). (To be honest, at this
>} stage, I would be pleased to receive guidance on installing any module).
>
><ftp://mors.gsfc.nasa.gov/pub/MacPerl/Scripts/libwww-perl-5.07.sit.hqx>.
>I've already done the work needed. This archive includes libnet-1.04, but
>not MD5 (MD5 is written in C, but you don't really need it).
>}
>} The biggest obstacle so far is the fact that Makemaker seems to crash
>} reliably on the Mac (this has been reported before).
>}
>} Even if Makemaker worked well, I would be left with a makefile, and the
>} Mac does not have a make.
>
>Yes indeed. The standard Perl installer should have been written in
>platform neutral Perl. It wasn't, and so we're stuck with trying to get
>around a lack of make. Personally what I usually do is install what I
>want on my Sun workstation and then transfer the files to my Mac. This
>also gets around the problem that without make it's hard to Autosplit the
>files that need Autosplitting.
>}
>Installation was apparently not intended to be done on anything but Unix
>boxes. Some modules can just be copied into the appropriate places in
>@INC, but some take more serious work.
>}
>} Ben.
>--
>Paul J. Schinder
>schinder@leprss.gsfc.nasa.gov
I just tried taking your advice for installing libnet-1.04. I downloaded the entire folder, uploaded it to my ISP's UNIX server, and tried to run Makefile during a Telnet session within my cgi-bin directory. I set all permissions 755. Here is what I got:
$ perl Makefile.PL
make (No targets specified and no makefile found. Stop.)
make test (No rule to make target 'test'. Stop.)
make install (Nothing to be done for install)
Any ideas on what I did wrong, or what's missing here?
Thanks
Milt
mel@west.net
------------------------------
Date: 14 Mar 1997 20:36:31 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
Subject: Re: matching whitespace?
Message-Id: <JFRIEDL.97Mar15053631@tubby.nff.ncl.omron.co.jp>
Brian L Matthews <blm@halcyon.com> wrote:
|> |I could answer, but I'm 20 Minutes away from any news reader :)
|>
|> Too bad you really weren't. If you were, you might not have posted an
|> incorrect answer.
Yeah, but it was worth it to get the ``20 minutes away'' crack in :-)
(the original poster certainly deserved it)
Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: Sat, 15 Mar 1997 22:49:37 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: "Andrew M. Langmead" <aml@world.std.com>
Subject: No such thing as "soft reference" (was Re: Is globbing still useful?)
Message-Id: <332B9801.2473@egames.com>
[mailed & posted]
Andrew M. Langmead wrote:
> Mike Nakagawa <mikenak@best.com> writes:
> >require "file1.pl"
> >$string = "file1";
> >&$string; # this runs file1, since when can you run a scalar?
> >#end whatever.pl
> This construct is refered to as "soft references" and details about
> them can be found in the perlref man page. And yes, soft references do
<NITPICK>
Well, actually, if you checkout the perlref man page and
search for "soft reference" you will not find anything
(eg: 'man perlref | grep -i soft' produces no output).
The real name of this feature is "symbolic reference." This
is the name used in the man pages and in the Camel. I've
seen a lot of people call these "soft" references (I suppose
they think of it as an alternative to "hard references"),
but there's no such thing, and misuse of this term makes it
hard to follow up by actually going to the documentation
because neither the man pages or the camel have any entry
for "soft references."
</NITPICK>
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: 14 Mar 1997 20:37:59 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
Subject: Re: Pattern matching on stream
Message-Id: <JFRIEDL.97Mar15053759@tubby.nff.ncl.omron.co.jp>
On 12 Mar 1997 18:09:30 GMT, Peter Scott wrote:
> This sounds a bit odd but it would be useful. I am wondering if
> there is such a thing as a streaming pattern match, which is the
> best term I can come up with.
There's a great way to do it in perl:
system("expect")
:-)
[Expect is a tool that does, among other things, continual matching on an
input stream]
Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: 16 Mar 1997 06:06:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl 5 manual
Message-Id: <5gg2kb$dka$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
dralex@usa.net (Dragos Alexandru) writes:
: I've been looking for a good perl 5 manual. I would
:prefer it in HTML format. If you know where I can find
:it, please let me know.
http://www.perl.com/perl/nmanual/
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"What is the sound of Perl? Is it not the sound of a wall that
people have stopped banging their heads against?"
--Larry Wall in <1992Aug26.184221.29627@netlabs.com>
------------------------------
Date: Sun, 16 Mar 1997 07:45:31 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl for WIN32 - Can't Run Scripts From Web Server
Message-Id: <ebohlmanE74LJw.4D@netcom.com>
swasey (swasey@wpdiss1.wpafb.af.mil) wrote:
: Whenever I try to call any of my PERL scripts from either http server, my
: browser tries to save the script file to disk rather than run it, even though I
: went into Netscape's Helpers and told it to open PL extensions with PERL.EXE.
When you access a URL via HTTP, Netscape (and any correctly-written user
agent) determines what to do with it by looking at the MIME content-type
that the server sends it, *not* the file's extension. The helper settings
involving extensions only govern what happens when you access a URL (such
as a local file or FTP URL) that doesn't involve sending a content-type.
What you need to do is configure your server to send out a specific
content-type for ".pl" files and then configure Netscape to run Perl when
it receives that content-type.
------------------------------
Date: 16 Mar 1997 05:22:57 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Perl for Windows NT
Message-Id: <5gghm1$t3o@panix.com>
In <01bc2f08$67417c40$9a0082c2@salmon> "Jonathan Tracey" <jont@uunet.pipex.com> writes:
>I am very new to Perl and am unsure of where to look for the information I
>need.
>Can anyone recommend a newsgroup, website or book which details perl
>control of applications such as excel.
>I wish to write scripts to perform excel functions on files without user
>intervention and therefore require the commands for excel.
>Any help would be appreciated.
You may want to check the Windows 95 and Windows NT section of Perl Reference,
http://www.panix.com/~clay/perl/query.cgi?windows+index -- Specifically, the
link to
LAOLA
http://wwwwbs.cs.tu-berlin.de/~schwartz/pmh/laola.html
A perl library, that gives access to OLE documents like Word and Excel
without Microsoft code. You can read documents, read and modify existing
streams and read and modify garbage. Supports a litte bit property sets. A
quick reference file for this library is now available. The code should be
rather system independent. However, at MS DOS and some Unix systems it
worked well.
HTH.
[ mailed and posted ]
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 16 Mar 1997 06:46:00 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Perl5.003 3x memory inefficient, Perl4.003 better?
Message-Id: <5gg4v8$i4t$1@news.eecs.umich.edu>
[ mailed and posted ]
In article <ERIC.97Mar15234229@m-e-ir1.sun.com>,
Eric Arnold <eric.arnold@sun.com> wrote:
>I notice that this:
>
>perl -le 'for($i=0;$i<10_000;$i++){$s.="x"x1_000};'
>
>uses about 30Mbytes, where Perl4 only used 10Mbytes. Is this fixed
>in Perl5.004?
Is it possible that you have your numbers reversed?
% perl5.00393 -le 'for($i=0;$i<10_000;$i++){$s.="x"x1_000} print `ps l $$`'
FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
100000 501 424 171 10 0 11320 10540 0 R p0 0:04 perl5.00393
% perl4 -le 'for($i=0;$i<10_000;$i++){$s.="x"x1_000} print `ps l $$`'
FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
100000 501 426 171 9 0 33892 24660 129f79 S p0 0:01 perl4 -le
Linux 2.0.28 (system malloc used in both perls).
- Sarathy.
gsar@umich.edu
------------------------------
Date: 16 Mar 97 07:20:19 GMT
From: eric.arnold@sun.com (Eric Arnold)
Subject: Re: Perl5.003 3x memory inefficient, Perl4.003 better?
Message-Id: <ERIC.97Mar16072019@m-e-ir1.sun.com>
No I didn't have my numbers switched, but it is because I was compiling
with Perl's malloc (I recompiled Perl5.003 with the system malloc, and it
used an appropriate amount of memory). It sounds like it would be good
to be using Perl's malloc in Perl5.004 for the new enhancements, but ...
-Eric
P.S. Sorry about the Subject line, I don't know why I typed "Perl4.003";
I obviously meant Perl5.004.
In article <5gg4v8$i4t$1@news.eecs.umich.edu>
gsar@engin.umich.edu (Gurusamy Sarathy) writes:
> [ mailed and posted ]
>
>In article <ERIC.97Mar15234229@m-e-ir1.sun.com>,
>Eric Arnold <eric.arnold@sun.com> wrote:
>>I notice that this:
>>
>>perl -le 'for($i=0;$i<10_000;$i++){$s.="x"x1_000};'
>>
>>uses about 30Mbytes, where Perl4 only used 10Mbytes. Is this fixed
>>in Perl5.004?
>
>Is it possible that you have your numbers reversed?
>
> % perl5.00393 -le 'for($i=0;$i<10_000;$i++){$s.="x"x1_000} print `ps l $$`'
> FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
> 100000 501 424 171 10 0 11320 10540 0 R p0 0:04 perl5.00393
>
> % perl4 -le 'for($i=0;$i<10_000;$i++){$s.="x"x1_000} print `ps l $$`'
> FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND
> 100000 501 426 171 9 0 33892 24660 129f79 S p0 0:01 perl4 -le
>
>Linux 2.0.28 (system malloc used in both perls).
>
> - Sarathy.
> gsar@umich.edu
>
>
------------------------------
Date: Sat, 15 Mar 1997 23:04:24 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Matt Bieber <mattdb@syntrillium.com>
Subject: Re: Reg. expression question
Message-Id: <332B9B78.4A12@egames.com>
[mailed & posted]
Matt Bieber wrote:
> I'm trying to weed out any string that contains anything other than:
>
> a-zA-Z0-9_, .'s, or @
>
> And isn't formatted ____@____
Here's what I use:
$email =~ s/,/./g; # compuserve addresses , -> .
$email =~ tr/ \t\n\r//d; # remove white space
if ($email =~ m/[^A-Za-z0-9\@\.+%#!_\-]/ or # invalid chars or
$email !~ m/^[^\@]+\@[^\@]+\.[^\@]+$/ # not user@site.domain
) {
# reject
}
It isn't perfect, but I haven't had any complaints from
people.
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks" O-
-- Sonia Orin Lyris
------------------------------
Date: Sun, 16 Mar 1997 08:57:20 GMT
From: rosenthd@erols.com
Subject: Re: Simple question of Exclusion
Message-Id: <5ggcnj$kl5@boursy.news.erols.com>
The simplest way that I know of to solve this problem would be to
assign each key into a the found_key hash array.
# READ IN DATABASE
while <DBFILE>
{
if ($found_key{$key} != 1)
{ $found_key{$key} = 1;}
else
{ print "Duplicate key found $key}
}
# Add new rows
if (!$found{$key})
{
unshift stuff;
.....
}
You can use delete $found{$key}; to remove elements from the
found_key array when you are done with them. This should help
slightly if you have 1M+ records.
Good Luck,
Dan
slacker@dixonillinois.com wrote:
>I'm trying to make additions to a comma seperated variable database
>while excluding entries that have already been added. This is what I
>have stumbled to so far:
>#!/usr/bin/perl
># update_daemon1.pl
>$quit = 0;
>while ($quit != 1) {
> ##### open initial_dbase and read each line into variables #####
> open(ADD,"initial_dbase.csv") ;
>
> while($line =<ADD>) {
> ($key, $date, $first_name, $last_name, $email,
>$address1, $address2,
> $city, $country, $state, $zip, $phone, $check_phone,
>$fax, $check_fax, $contact,
> $check_contact, $file, $category, $info, $check_call,
>$new_category,
> $check_new_category, $check_update, $graphic_url,
>$ad_type, $listing,
> $time, $language, $ad_headline, $price, $payby,
>$cardtype, $cardholder,
> $cardnumber, $cardexp, $compile_time) = split(/,/,
>$line);
>#print "$category\n" ;
>#print "$file\n" ;
> ##### check to see if file exists or not and add new lines #####
> if (-e $file){
> open(READ_TEMP, "$file") or die "Can't open
>$file, $!";
> @some_lines = <READ_TEMP> ;
> close READ_TEMP ;
> unless (/$key/) {
> unshift (@some_lines, $line) ;
> @sorted_lines = sort by_number
>@some_lines ;
>
> open(NEW_FILE, ">$file") ;
> print NEW_FILE @sorted_lines ;
> close NEW_FILE ;
> }
>
> }
> }
>$quit = 1 ;
>}
>sub by_number {
> $a <=> $b;
>}
>The part that is screwed up is the unless (/$key/) part.
>What I'm trying to say is "Unless you find the key already in a line
>(one complete record) in READ_TEMP unshift the new entry and sort the
>results. I then want to print this to the NEW_FILE (READ_TEMP with the
>added lines).
>I don't know if this makes sense to anyone but I could sure use the
>help.
>Thanks in advance,
>Greg McKean
>slacker@dixonillinois.com
>Just another slacker!!!!
------------------------------
Date: Sun, 16 Mar 1997 07:32:27 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Sorting help
Message-Id: <ebohlmanE74Ky3.MKo@netcom.com>
Efigenio Ataide (ataide@planetarium.com.br) wrote:
: @stuff = ('James', 'adam', 'robert', 'Michael');
: @sorted = sort byname (@stuff);
: foreach (@sorted) {
: print $_, "\n";
: }
: sub byname {
: my ($aa, $bb);
: $_ = $a; tr/A-Z/a-z/; $aa = $_;
: $_ = $b; tr/A-Z/a-z/; $bb = $_;
: $aa cmp $bb;
: }
@stuff = ('James', 'adam', 'robert', 'Michael');
@sorted = sort {uc $a cmp uc $b} (@stuff);
foreach (@sorted) {
print $_, "\n";
}
As our favorite camel suggests on p.218.
------------------------------
Date: 16 Mar 1997 05:30:50 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Sorting help
Message-Id: <5ggi4q$8u@panix.com>
In <332a4749.38304890@news.inetw.net> niksun@lconn.net (Niksun) writes:
>Here's my problem. Let's say that:
>@stuff = ("aaaa","BBBB");
>When I sort @stuff:
>@sorted = sort (@stuff);
>the order gets switched to ("BBBB","aaaa") because capital letters are
>placed before lowercase letters. I don't want this. I want to be
>able to sort an array so that everything is sorted by letter,
>regardless of case. In other words, an example final sort would be:
>adam
>James
>Michael
>robert
Try:
@stuff = ("aaaa","BBBB");
@sorted = sort { lc($a) cmp lc($b) } @stuff;
HTH,
[ mailed and posted ]
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 13 Mar 1997 12:49:25 GMT
From: jason@wisteria.cs.odu.edu (Jason C Austin)
Subject: Re: Standard "Reaper" procedure doesn't work on Solaris.
Message-Id: <JASON.97Mar13074925@wisteria.cs.odu.edu>
You may be hitting problems since it looks like you're making
a library call (printing something) from inside the signal handler.
That's not usually a good idea, since it will work on some systems and
cause erratic behavior on others.
--
Jason C. Austin
austin@visi.net
In article <5g54o1$1s6$1@celebrian.otago.ac.nz> gideon@csarc.otago.ac.nz (Gideon King) writes:
=> Solaris, Perl 5.002 - doesn't work
=> Solaris, Perl 5.003 - doesn't work
=>
=> The offending code is:
=> sub REAPER
=> {
=> $SIG{CHLD} = \&REAPER; # loathe sysV
=> $waitedpid = wait;
=> logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
=> }
=> $SIG{CHLD} = \&REAPER;
=>
=> The observed behaviour is:
=> First time it's called, it works, but the server reports two "reaped"
=> messages, the second one having a pid of -1.
=> The second time, the client thinks it has connected, but the server
=> doesn't register anything, and the client reports "uninitialized value"
=> for anything that should be returned from the server.
=> Third time, it works.
=> Fourth time, it doesn't, etc.
------------------------------
Date: Sun, 16 Mar 1997 07:13:33 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: What language do Perl REs recognize?
Message-Id: <ebohlmanE74K2L.Jxv@netcom.com>
Bernie Cosell (bernie@fantasyfarm.com) wrote:
: Fascinating, and it also brings up the question of exactly what *is* the
: power of the automaton that recognizes Perl's REs. If it recognizes some
: langauges that are beyond context-free, does that mean that the _automaton_
: is powerful enough to do CF languages, and so all we need to do is figure
: out some simple extension ['simple' in the same way that the backreference
: machinery is conceptually simple to describe] that'd make Perl RE's include
: the context free languages? AND then there's the next step: If perl REs
: are already beyond CF and so on-the-way to CS, is there some additional
: "simple" extension to REs that'd make them full-blown context sensitive??
A reasonably simple way to write patterns that could recognize CF
languages would be to allow patterns to contain references to other
patterns (this can't be done by variable interpolation into patterns
because recursive grammars would lead to an endless interpolation loop;
the recursion has to be implemented at run time, not compile time). For
example, $pat='/\((?+pat)\)|.{0,0}/' would be a pattern that would match
balanced parens, assuming that "(?+<pattern-name>)" was the syntax for
including a pattern reference whose semantics were "match anything
matched by the pattern whose text is found in $pattern-name."
The big problem, though, would be how to meaningfully extract information
from strings in the language matched; the current $n scheme assumes a
linear structure rather than a tree structure to the string to be matched,
but a match of a CF language would need to have a tree as a result. It
would probably have to be something like a list of references to lists,
each of which would need "header" entries indicating which pattern matched
(lists for matches that include only non-terminals would be empty except
for the header entry).
------------------------------
Date: 14 Mar 1997 20:28:30 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: bernie@fantasyfarm.com (Bernie Cosell)
Subject: Re: What language do Perl REs recognize?
Message-Id: <JFRIEDL.97Mar15052830@tubby.nff.ncl.omron.co.jp>
[mail and post]
Bernie Cosell <bernie@fantasyfarm.com> wrote:
|> I was wondering if anyone has characterized the languages accepted by Perl
|> Regular Expressions.
As you note, they're not strictly regular. Rather, they're regular Perl. :-)
Seriously, I'm really rusty on my automata theory, but I think you'll have
a hard time formally classifying Perl regexes. If you remove about half the
features, they are indeed regular. Backreferences add something special, as
does the lookahead. But whatever you call it, or however you classify it,
knowing what you can and can't do with it is more important (at least to
those of us more into practice than theory :-)
|> is... [also, any ideas on what sort of machine implements Perl REs?
It's a modification of an NFA. (If you think how an NFA works, you can
realize how easy it is to add backrefernces, general lookahead, and
non-greediness.)
Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
O'Reilly & Associates' _Mastering Regular Expressions_
http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: 13 Mar 1997 13:27:36 GMT
From: jason@wisteria.cs.odu.edu (Jason C Austin)
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <JASON.97Mar13082736@wisteria.cs.odu.edu>
In article <5g22ft$h2s@postman.jet.uk> Frithiof.Jensen@jet.uk (Frithiof Jensen) writes:
=> In article <karma-0903971231120001@ip053.mu3.nwlink.com>, karma@nwlink.com (Karma) says:
=> >
=> >Definitely, Windows!!! Though, I would focus on support rather than
=> >software development. Since there are various flavours of Windows (3.1,
=> >9x, NT x.x) and umpteen number of incompatible hardware designs, this adds
=> >up to a myriad combinations of possible mismatches, you can spend all the
=> >24-hours in a day fixing one machine or the other.
The problem is there are LOTS of Windows programmers out
there, mostly due to the training and equipment being a whole lot
cheaper. There are lots of companies starving for good Unix people,
so by supply and demand, the salaries for Unix are better.
=> Ah yes, but JAVA is going to kill that cirkus dead.
=>
=> British Telecom estimates that more than 50% of the workstations in a typical
=> enterprise will be NC machines by year 1998! (The Guardian, 3 march 1997).
I've heard and read a lot about the coming of Java, but I'm
still not sure. The main problem is my experience with Sun's NeWS
product. A great idea, but the implementation was always too unstable
compared to other products; beyond the operating systems, I have been
consistently disappointed by Sun software.
I do see Java as an excellent tool for single application
terminals. Say, at an airline checkin counter or a call center.
--
Jason C. Austin
austin@visi.net
------------------------------
Date: Sat, 15 Mar 1997 15:41:18 +1000
From: Andrew Gruskin <agruskin@melbpc.org.au>
Subject: Re: Win32: How to use a MessageBox or Dialog
Message-Id: <332A367E.2AF2@melbpc.org.au>
Achim Bursian wrote:
>
> Hi there!
>
> Havn't found anything in 3 hours manual browsing, perhaps someone can
> help?
>
> I'd like to get some userinput through a windows dialog in Perl for
> Win32.
> Calling something like a Win32-API MessageBox is not enough (but how
> would I do this, anyway?).
>
> The user should be able to enter a string in this dialog and select an
> OK or Cancel button.
>
> Any way to do this?
> Thanks for help,
> Achim
Try using OLE automation from Perl. My solution would also require
Access or Excel although this would be relatively transparent to the
user.
Create an MS Access object and the use the input box and message box
objects. See the OLE documentation with Perl to see how.
Andrew
------------------------------
Date: 16 Mar 1997 06:12:50 GMT
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: year 2000 question
Message-Id: <5gg312$sc$1@diablo.compusol.com.au>
In article <5g7e68$qs4$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> dxe@cassidy.sbi.com (Dan Ellsweig (Enterprise Management)) writes:
>:I am in the process of insuring year 2000 compliance for all of
>:my PERL code.
>
[snip]
>
>Meanwhile, here's an entry from the new perl faq:
>
> =head2 Does Perl have a year 2000 problem?
>
> Not unless you use Perl to create one. The date and time functions
> supplied with perl (gmtime and localtime) supply adequate information
> to determine the year well beyond 2000 (2038 is when trouble strikes).
> The year returned by these functions when used in an array context is
> the year minus 1900. For years between 1910 and 1999 this I<happens>
> to be a 2-digit decimal number. To avoid the year 2000 problem simply
> do not treat the year as a 2-digit number. It isn't.
While it is certainly true that most of the major 2000 problems are
confined to programs/languages which store the year as a two-digit
field rather than as a number (COBOL particularly) there *are* things
to consider when using the tm_year field with Perl (C, and other)
programs.
Notably if you are manually printing a year with printf and you
actually *want* two digits, then $tm_year % 100 is probably a good
idea (strftime "... %y ..." is possibly even better).
My OS vendor (Unisys) has listed about a dozen system utilities which
output 100 or 19100 for 2000 dates -- which could cause problems with
scripts attempting to parse their output with something like
m{... (\d\d)/(\d\d)/(\d\d) ...}
At least one program (sccs) is listed as ``Command fails''--exactly
how I am not sure (and since I use RCS I haven't bothered to check).
So while the FAQ is 100% correct in saying that _properly used_
(local|gm)time will safely see programmers through the year 2037 (and
beyond if time_t is increased), be aware that there still can be
gotchas for the unwary.
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 126
*************************************