[6543] in Perl-Users-Digest
Perl-Users Digest, Issue: 168 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 24 14:29:05 1997
Date: Mon, 24 Mar 97 11:00:36 -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 Mon, 24 Mar 1997 Volume: 8 Number: 168
Today's topics:
Re: A Call for Clarity (Schwartzian Transform Considere <dehon_olivier@jpmorgan.com>
Re: A Call for Clarity (Schwartzian Transform Considere <gsievers@gsievers.xnet.com>
Re: A Call for Clarity (Schwartzian Transform Considere arw@dante.mh.lucent.com
Re: About @INC <mchase@ix.netcom.com>
Accessing a database <joakim.anuell@camelont.se>
Re: Accessing a database <nziada@idsc.gov.eg>
chat script <mdebrauw@fwi.uva.nl>
Creating arrays... <hayes@coventry.ac.uk>
Re: Creating arrays... <scs@huron.net>
Re: Creating arrays... <sveerara@cisco.com>
embeded perl from C : why I have to link the perl "use" <francois@ysatis.fra.sequent.com>
Executing a script??? <scs@huron.net>
Re: Help with Pattern Matching <blongwor@student.umass.edu>
Re: help!!!! (Tad McClellan)
help <sales@jewellery.com>
help: 2d perl array doesn't work! (Apple-O)
I18N modules for Unicode/ISO-10646 <softstar@pol88a.polito.it>
Re: Makefile.PL in Win95...where/what should I use for (Nathan V. Patwardhan)
mbeded perl from C : why I have to link the perl "use" <francois@sequent.com>
perl -p changes my program in unexpected ways. Why? (J. Blustein)
Re: perl 5.003 make test hanging on DB_File (dynamic) (Paul Marquess)
Perl Considered Scary? (was Re: A Call for Clarity ...) (Bennett Todd)
Re: Perl Data Structures Cookbook. Wher did it go? (Bill Kannawin)
Perl for Power PC on Mac Eric.Guichard@ens.fr
Re: Perl for Power PC on Mac <neeri@iis.ee.ethz.ch>
Perl Ftp Server <prem@lzusp.lucent.com>
Perl sendmail problem (LAM Chi-fung)
Perl/CGI/ freelance pt. help needed in Seattle. (Tom Hicks)
Re: Problem Building POSIX module of Perl 5.003 for Sol (T)
Re: Problems Installing Perl 5 <scotth@sgi.com>
Reg. Expressions with Associative Arrays <mstearns@darkwing.uoregon.edu>
Regular Expression question <cgweav@eskimo.com>
Re: subdirectories (Nathan V. Patwardhan)
Re: Unix and ease of use (WAS: Who makes more ...) (Randy Wright)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Mar 1997 15:02:45 +0000
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: A Call for Clarity (Schwartzian Transform Considered Scary)
Message-Id: <njzwwqx8h9m.fsf@jpmorgan.com>
Well, I have to say something about this too:
Isn't
open(FILEHANDLE, "myfile") or die "Can't open myfile: $!";
as scary as a ST for the beginner, since you have to know that the
second argument to or won't be eval'ed if the first one is true ?
Perl is full of tricks like this one. ST is "yet another Perl trick",
and nothing more. I don't think that a ST is harder to understand than
an open or die statement, it's just a question of documenting code and
style. If a programmer can't understand a ST, will he understand the
many subtleties Perl has (I'm not speaking about regular
expressions!)?
Regards,
Olivier Dehon
------------------------------
Date: 24 Mar 1997 08:57:16 -0600
From: Jerry Sievers <gsievers@gsievers.xnet.com>
Subject: Re: A Call for Clarity (Schwartzian Transform Considered Scary)
Message-Id: <x7lo7dtk1f.fsf@gsievers.xnet.com>
Olivier Dehon <dehon_olivier@jpmorgan.com> writes:
>
> Well, I have to say something about this too:
>
> Isn't
>
> open(FILEHANDLE, "myfile") or die "Can't open myfile: $!";
>
> as scary as a ST for the beginner, since you have to know that the
> second argument to or won't be eval'ed if the first one is true ?
> Perl is full of tricks like this one. ST is "yet another Perl trick",
> and nothing more.
i dont agree. the above example reads almost like plain english. this is
certainly not going to be as hard to grasp as ST.
anyway... IMHO, ST or other "extreme styles" dont pay off unless they are
in some way, much better than a more straight forward approach. the
definition of "much better" has to be taken into context but i dont know of
too many coding jobs where clarity is not important. it tends to be a
primary goal of mine. others may not agree.
i remember a few years back, "trying" to write the most extreme, heavily
bummed code as often as possible because i felt that is was experts did.
not! it is newbies (like myself then) who do this routinely.
its OK to experiment to see what interesting things a language will do
(perl really begs for this). but in production code, i would avoid radical
coding style wherever possible.
--
@------------------------------------------------------------------@
| Jerry Sievers Unix Admin/Web Site Architect |
| 312 527-0618 (home) mailto:gsievers@xnet.com |
| 847 317-7469 (work) http://www.xnet.com/~gsievers |
@------------------------------------------------------------------@
------------------------------
Date: Mon, 24 Mar 1997 09:21:40 -0600
From: arw@dante.mh.lucent.com
Subject: Re: A Call for Clarity (Schwartzian Transform Considered Scary)
Message-Id: <859215999.13453@dejanews.com>
In article <5h5jbq$6n7$1@jupiter.sdd.cegelecproj.co.uk>,
Steve_Kilbane@cegelecproj.co.uk wrote:
> The ST is a little dodgy, because it's quite large - if you're reading
> someone else's code, you'd have to check that it *does* do ST, rather
> than saying "map...sort..map..uh, ST" - the maps could be there for
> other purposes. For that reason, I'd say "comment it". Say it's an ST,
> and what it's sorting on, and give some pointer or explanation for the
> ST itself. But that's not a reason for dumbing it down.
No. Don't dumb it down. Heaven forbid! Implement it ONCE
as a higher order function and be done with it.
SortedListByMetric = SchwartzianTransform(List, Metric)
I just demonstrated in this thread how to do this using Python,
surely there must be some analogue in Perl (?). There shouldn't
be any reason to keep repeating a mysterious idiom over and
over and over and over... no matter how well you comment it.
-- Aaron Watters
===
I know, it's only rock and roll, but I like it. --Stones
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 24 Mar 1997 14:50:10 GMT
From: "Michael A. Chase" <mchase@ix.netcom.com>
Subject: Re: About @INC
Message-Id: <01bc36e0$5a9241c0$ccb51990@mchase>
This belongs in comp.lang.perl.misc, so I'm cross-posting my answer there
and suggest any follow ups go there, too.
I posted the following to Perl-Win32-Users@ActiveWare.com, but it may have
gotten lost in the mail server problems of the last couple months. Some of
this should be in
http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html the next
time it's updated. The same logic appears to apply to Build 303.
: # @INC is filled under Build 302 as follows where %Perl5 refers
: # to values in HKEY_LOCAL_MACHINE\SOFTWARE\ActiveWare\Perl5:
: my $dir;
:
: # Get @INC components from various sources
: my $perllib = $ENV{'PERL5LIB'} || $ENV{'PERLLIB'};
: my $privlib = exists $Perl5{'PRIVLIB'} ? $Perl5{'PRIVLIB'} : '..\lib';
:
: # $privlib may be an empty string.
: my $archlib = $Perl5{'ARCHLIB') || $privlib . '\i386-win32';
:
: # The possibly of multiple or no directories in $privlib is ignored
: # i.e., if $privlib eq "a;b" then $archlib eq "a;b\i386-win32" and
: # if $privlib eq "" then $archlib eq "\i386-win32".
: my $sitelib = $Perl5{'SITELIB'} || '';
:
: # put them all together, skip empty elements
: @INC = ();
: foreach $dir ( split( /;/, "$perllib;$archlib;$privlib;$sitelib;." ) )
{
: push @INC, $dir if $dir;
: }
:
: I think the way $archlib is set from $privlib without regard for what's
in
: $privlib is a bug that exists in at least Build 302.
Francisco Dominguez Mateos <pacot@arrakis.es> wrote in article
<332AEB31.25BE@arrakis.es>...
> Hello
>
> I guess @INC is used to tell to Perl where are the .pm files, and
> I would like to know how change it, because I try to use the module
> Win32::ODBC to make a CGI to use SQL Server 6.5
------------------------------
Date: Mon, 24 Mar 1997 16:04:47 +0100
From: Joakim Anuhll <joakim.anuell@camelont.se>
Subject: Accessing a database
Message-Id: <3336980F.5BAC@camelont.se>
Dear everyone.
I am about to write a CGI script in perl that will need to use a rather
large database.
Does anyone know how I should do this. Should i create an SQL Database
on the server?
What software should I get / Which books or texts should I read?
Any anwsers and/or tips are welcome.
Thanks, Tham wickenberg.
joakim.anuell@camelont.se
------------------------------
Date: Mon, 24 Mar 1997 20:09:10 +0200
From: Nader Ziada <nziada@idsc.gov.eg>
To: Joakim Anuhll <joakim.anuell@camelont.se>
Subject: Re: Accessing a database
Message-Id: <3336C346.3483@idsc.gov.eg>
Joakim Anuhll wrote:
>
> Dear everyone.
>
> I am about to write a CGI script in perl that will need to use a rather
> large database.
> Does anyone know how I should do this. Should i create an SQL hello
i have the same problem
did u reach anything ???
Thanks
Nader Ziada
Database
> on the server?
> What software should I get / Which books or texts should I read?
>
> Any anwsers and/or tips are welcome.
>
> Thanks, Tham wickenberg.
>
> joakim.anuell@camelont.se
------------------------------
Date: Mon, 24 Mar 1997 14:46:44 -0800
From: M <mdebrauw@fwi.uva.nl>
Subject: chat script
Message-Id: <33370454.B66@fwi.uva.nl>
can anyone provide me with a chat cgi script?
Thanks.
------------------------------
Date: Mon, 24 Mar 1997 15:38:24 +0000
From: Mr Matty <hayes@coventry.ac.uk>
Subject: Creating arrays...
Message-Id: <Pine.OSF.3.91.970324153239.9980A-100000@leofric>
Can anyone help.. I am after a bit of a pointer,
I want to take in a string and convert each word within that is delimited
by a space into an array. For instance..
Hello My Name Is
would create
@sentance{1} = "hello"
@sentance{2} = "My"
etc...
and then print them out individually..
Ta
Matty.
------------------------------
Date: 24 Mar 1997 17:57:00 GMT
From: "Stephen Hill" <scs@huron.net>
Subject: Re: Creating arrays...
Message-Id: <01bc387c$38f03de0$1191e9cd@scs>
@sentence = split(/ /, $string);
The above will split the string at whatever you specify in between the "/
/", leave a space if that is what you want or commas.
I am not sure, but you may need brackets around the $string, ...try it :-)
To print it you would use
print @sentence[0]
print @sentence[1]
.......
..
.
Mr Matty <hayes@coventry.ac.uk> wrote in article
<Pine.OSF.3.91.970324153239.9980A-100000@leofric>...
>
> Can anyone help.. I am after a bit of a pointer,
>
> I want to take in a string and convert each word within that is delimited
> by a space into an array. For instance..
>
> Hello My Name Is
>
> would create
>
> @sentance{1} = "hello"
> @sentance{2} = "My"
> etc...
>
> and then print them out individually..
>
> Ta
>
> Matty.
>
>
>
>
>
>
------------------------------
Date: 24 Mar 1997 09:21:58 -0800
From: Sriranga R. Veeraraghavan <sveerara@cisco.com>
Subject: Re: Creating arrays...
Message-Id: <ls34te1yzm1.fsf@sveerara-ultra.cisco.com>
In article <Pine.OSF.3.91.970324153239.9980A-100000@leofric> Mr Matty
<hayes@coventry.ac.uk> writes:
> I want to take in a string and convert each word within that is delimited
> by a space into an array. For instance..
>
> Hello My Name Is
>
> would create
>
> @sentance{1} = "hello"
> @sentance{2} = "My"
Try something like this:
$string = "Hello My Name Is";
@sentance = split(/\s+/,$string);
----ranga <sveerara@cisco.com>
------------------------------
Date: Mon, 24 Mar 1997 16:27:05 +0100
From: francois <francois@ysatis.fra.sequent.com>
Subject: embeded perl from C : why I have to link the perl "use" module .so
Message-Id: <33369D49.3169@ysatis.fra.sequent.com>
Hi guys,
Calling perl routines from C works fine but at least 1 rule must be
observed :
if the perl function calls some other modules (use <module>) then
1- called newsXS("<module>:bootstrap",boot_<module>,file);
2- on the link line you must provided the <module>.so
why the step 2 ???
We are tacking about dynamic loading and .so are still needed on link
phase ?
Thanks in advance for all you answers
Reargds, Francois
------------------------------
Date: 24 Mar 1997 15:02:39 GMT
From: "Stephen Hill" <scs@huron.net>
Subject: Executing a script???
Message-Id: <01bc3863$dc304540$1191e9cd@scs>
How can you have a script execute automatically when your page is
loaded....SSI works if the script is on the same server as the page, but
does not seem to work if the html page and the script are on different
servers.
Is there some way you can use the image tag to do this?
------------------------------
Date: Mon, 24 Mar 1997 13:14:51 -0500
From: Brett Longworth <blongwor@student.umass.edu>
Subject: Re: Help with Pattern Matching
Message-Id: <3336C483.48AA@student.umass.edu>
M. Wick wrote:
>
> I've tried grep, index, and the matching sequence and nothing seems to
> be working. I'm opening a file, reading in a line, and trying to
> match a pattern from within the line. I have found that I can match
> the line if the parameter starts at the beginning on the line. I want
> to find the pattern in the middle of the line, and nothing seems to be
> working correctly.
>
> while( <FILE> ){
> if ( (index($_, $pattern)) >= 0 ) {
>
> if (grep($pattern, $_) != 0) { (even though grep works on an array,
> I still tried it)
>
> if (/$pattern/) { (matching on the $_ from the file)
> do this stuff if match;
> }
> }
>
> I've tried all 3 possibilities.
>
> Here are the lines that I'm looking at:
>
> NAME <-- Works fine here
> <LI><A HREF="http://..../">NAME</A> <-- Doesn't match this line
>
> I'm trying to find NAME. Any suggestions?
> Thanks in advance.
I'm not sure what I'm missing here but this seems easy. You just want
to do something with lines that have a searchable pattern in them? The
simplest way would be to run this from the command line:
perl -ne 'print if /NAME/' test
Where NAME is what you're looking for and test is the name of the file
you're interested in.
I definitely feel your pain when it comes to pattern matching though- I
just spent about a week learning the basics of perl, and most of that
time was spent trying to match one simple lowly line. It seems like god
is in the details sometimes- matching whitespace, number of characters,
etc...
good luck,
-Brett
------------------------------
Date: Mon, 24 Mar 1997 08:22:25 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: help!!!!
Message-Id: <1n26h5.j81.ln@localhost>
John Giblin (giblin@mail.idt.net) wrote:
: Hey everyone!
Hey John!
[ your non-subject in Not A Good Thing. Please see the article posted
here regularly about choosing good Subject lines. If you want us
to take the time to answer your question, we can expect you to take
the time to put an actual subject in your Subject:
]
: I have a little trouble with my perl script I got from a book, which I
: copied and pasted to notebook. I keep getting Internal Error. So I
: started eliminating sections to narrrow the problem down. I ended with
: #!/usr/local/bin/perl(the right location) and it still didn't work. Is
: it the fact I am using notepad? Is there something I have to do to the
: script besides chmod it? This is driving me crazy!!!
You may have line ending problems. M$ and Unix use different
line endings. If you ftp in ASCII mode, it should do the conversion
for you.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Mon, 24 Mar 1997 20:09:52 +1000
From: Paul Swan <sales@jewellery.com>
Subject: help
Message-Id: <333652F0.72E3@jewellery.com>
Does any one have a small self serch program
------------------------------
Date: Mon, 24 Mar 1997 17:46:26 GMT
From: appleo@cybercomm.net (Apple-O)
Subject: help: 2d perl array doesn't work!
Message-Id: <5h6eev$cim$1@news.nac.net>
can anyone can explain why this script doesn't work?
(other than the fact that i'm a bonehead programmer)
:/)
#!/usr/bin/perl5
# fill up a 2d array and print it back out:
# a i e
# d f b
# g c h
# (eg w/coords (x,y) the char at pos (1,3) = g)
# sort by column 1 gives:
# a i e
# d f b
# g c h
# sort by column 2 gives:
# should look like:
# g c h
# d f b
# a i e
# sort by column 3 gives:
# d f b
# a i e
# g c h
print "twodim2.pl, trying to run it right!\n\n";
$two_d_hash{'1'}{'1'} = "a";
$two_d_hash{'1'}{'2'} = "b";
$two_d_hash{'1'}{'3'} = "c";
$two_d_hash{'2'}{'1'} = "d";
$two_d_hash{'2'}{'2'} = "e";
$two_d_hash{'2'}{'3'} = "f";
$two_d_hash{'3'}{'1'} = "g";
$two_d_hash{'3'}{'2'} = "h";
$two_d_hash{'3'}{'3'} = "i";
# print out array as is
# should be a b c d e f g h i
for ($x=0; $x++; $x<9)
{
for ($y=0; $y++; $y<9)
{
print "$two_d_hash{$x}{$y} ";
}
}
print "\n";
# sort based on 1st key - i don't understand this part
#@list1 = sort keys %{$two_d_hash{'1'}};
#for ($x=0; $x++; $x<6)
# {
# for ($y=0; $y++; $y<6)
# {
# print "$list1{$x}{$y}\n";
# }
# }
# sort based on 2nd key - i have no clue
#@list2 = sort {$two_d_hash{'1'}{$a} <=> $two_d_hash{'1'}{$b}}
# keys %{$two_d_hash{'2'}};
#for (x=0; x++; x<6)
# {
# for (y=0; y++; y<6)
# {
# print "$list2{$x}{$y}\n";
# }
# }
# sort based on key 3, i have even less of a clue
exit;
------------------------------
Date: Mon, 24 Mar 1997 17:20:59 +0100
From: Enrico Badella <softstar@pol88a.polito.it>
Subject: I18N modules for Unicode/ISO-10646
Message-Id: <3336A9EB.6818@pol88a.polito.it>
Hello Perl users!
Is anybody outthere working or thinking about a module capable of
handling I18N using Unicode/ISo-10646.
I have this type of nead and would like to get in touch for exchange of
ideas.
eb
------------------------------
Date: 24 Mar 1997 15:18:35 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Makefile.PL in Win95...where/what should I use for make(.exe)?
Message-Id: <5h660b$138@fridge-nf0.shore.net>
Brian Jepson (bjepson@bjepson.ids.net) wrote:
: This is a very keen observation; CPAN has lots of nice stuff, a one-stop
: place for Perl programmers. The Makefile.PL is used by MakeMaker,
: which does not run on the ActiveWare port of Perl. This is probably not
: so much the fault of the ActiveWare porters so much as the fact that
[snip]
There's a pretty nice gcc port for NT floating around, and early tests
suggest that it can build some Unix software nicely.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 24 Mar 1997 17:21:22 +0100
From: francois <francois@sequent.com>
Subject: mbeded perl from C : why I have to link the perl "use" module .so
Message-Id: <3336AA02.129D@sequent.com>
Hi guys,
Calling perl routines from C works fine but at least 1 rule must be
observed :
if the perl function calls some other modules (use <module>) then
1- called newsXS("<module>:bootstrap",boot_<module>,file);
2- on the link line you must provided the <module>.so
why the step 2 ???
We are tacking about dynamic loading and .so are still needed on link
phase ?
Thanks in advance for all you answers
Reargds, Francois
------------------------------
Date: 24 Mar 1997 14:31:57 GMT
From: jamie@chaplin.csd.uwo.ca (J. Blustein)
Subject: perl -p changes my program in unexpected ways. Why?
Message-Id: <5h638t$t3o@falcon.ccs.uwo.ca>
Keywords: HTML, SGML, parse, multiline regexp
I'm trying to use regexps to pull out lines between two patterns that
may themselves be on different lines. When I use the example from the FAQ:
perl -0777 -pe \
'print "PARA " . $pcount++ . "\"$1\"\n" while m{<P>(.*?)</P>}gs'
I get what I want (and an extra copy of the file). But when I write a
longer program:
---8<--- (program begins after this line) ---8<---
#!/usr/local/bin/perl -w -T -0777
require 5.002;
use diagnostics;
use Carp;
use strict;
use vars '$DEBUG';
use integer;
my $pcount = 1;
LINE:
while (<>) {
print "PARA " . $pcount++ . "\"$1\"\n" while m{<P>(.*?)</P>}gs;
} continue {
}
---8<--- (program ends before this line) ---8<---
I get no output. What gives? (Obviously I don't understand Perl 5 as well
as I should. But what specifically is that?)
I'm trying to identify text between <P> and </P> in a file marked-up
with HTML-like coding. I'm considering using the libwww-perl-5.07 HTML
modules but I think that is overkill and could restrict my input format
more than I want. I guess I could use the SGMLSpm-1.03ii modules, but I
also think that would be overkill. If you have any other suggestions for
how I could match the text between <P> and </P> (possibly on separate
lines) I'll appreciate reading it.
I'm using 5.003 with EMBED under Linux.
If you post a reply to this message please also send me a copy by
e-mail. The newsfeed at my site is dropping many articles. The problem
probably won't be fixed for months. If you reply by mail but without
posting then please tell me that too. I'll need to know so that I can post
a summary of e-mail I receive.
--
Jamie Blustein <jamie@CSD.uwo.ca> `Did you say "knives"?'
[Note new address] `*Rotating* knives, yes.'
------------------------------
Date: 24 Mar 1997 13:49:05 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: perl 5.003 make test hanging on DB_File (dynamic)
Message-Id: <5h60oh$6fu@pheidippides.axion.bt.co.uk>
[ Posted & Mailed ]
Gregory Tucker-Kellogg (gtk@walsh2.med.harvard.edu) wrote:
: This is on an SGI running IRIX 5.3 and the SGI compiler.
: I downloaded the latest 5.003 perl from CPAN, along with the Berkeley
: DB. I made and installed libdb.a and libdb.so, and went on to make
: perl. Everything fine so far. Then I ran
: make test
: and after saying
: ...
: making DB_File (dynamic)
: ...
: it got to:
: op/write.......ok
: lib/anydbm.....ok
: lib/bigint.....ok
: lib/bigintpm...ok
: lib/db-btree...
: and then hung. Is there a known problem using a shared DB library?
There are known problems with using the standard release of Berkeley DB
on IRIX. Look in http://mongoose.bostic.com/db/irix.mbox for a patch.
Paul
------------------------------
Date: Mon, 24 Mar 1997 13:53:58 GMT
From: bet@nospam.interactive.net (Bennett Todd)
Subject: Perl Considered Scary? (was Re: A Call for Clarity ...)
Message-Id: <slrn5jd1rl.33t.bet@onyx.interactive.net>
Interesting. In the whole quoted article, I saw only one section of actual
specific gripes about the code:
> Where did $a and $b come from? What is $_, and does it mean
> two different things in two different places inside the same
> expression? I forget how that $1 and $2 thing works, [...]
Sounds like he totally abhors Perl's variables with imlicitly tied meanings
and actions --- e.g. $a, $b, $_, $1, $2. I don't see any remarks at all that
are specific to the Schwartzian Transform. And this in turn is telling: what
we have is not "Schwartzian Transform Considered Scary", but rather "Perl
Considered Scary". Go trolling for Fear And Loathing in comp.lang.python and
you sometimes dredge up things like this. Toss it back in.
Yup, it's definitely the case that a Schwartz Transform sort isn't obvious to
someone who has never read one, the first time. So if you want to use one in
production code, write e.g.
# Sort filenames into chronological order; see
# <URL:http://perl.{com,org}/CPAN/doc/FMTEYEWTK/sort.html>
@srcs = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, -M ] } <*.c>;
It suffices for a casual reader to understand what a construct does; if they
want to understand how it works, and they don't already know this one, they
can go read the tutorial, then they'll know a lot more about Perl than they
did before.
-Bennett
------------------------------
Date: 24 Mar 1997 09:55:32 -0700
From: kannawin@q.osmre.gov (Bill Kannawin)
To: Jerome O'Neil <joneil@is.ssd.k12.wa.us>
Subject: Re: Perl Data Structures Cookbook. Wher did it go?
Message-Id: <5h6bm4$fl9@q.osmre.gov>
In article <3332AE28.4723@is.ssd.k12.wa.us>, Jerome O'Neil <joneil@is.ssd.k12.wa.us> writes:
|> Tom Christiansen wrote:
|>
|> > In comp.lang.perl.misc,
|>
|> > type
|> >
|> > man perldsc
|> >
|>
|> Thanks, but I'm looking to distribute a URL to some people who may not
|> have access to the man pages, so the on-line version is realy what I
|> need.
|>
|> > http://www.perl.com/perl/nmanual/html/pod/perldsc.html
|>
|> http://www.perl.com/perl/nmanual/html/pod/perldsc.html returns
|>
|> File Not Found
|> The requested URL /perl/nmanual/html/pod/perldsc.html was not found on
|> this server.
|>
|> Jerome
give http://www.amherst.edu/~ljnelson/perl.html a try, I've had good
luck with it.
--
Bill Kannawin (303)844-1479 kannawin@osmre.gov|
Technical Information Processing System |
US Office of Surface Mining; 1999 Broadway, |
Suite 3320, Denver, Colorado 80202 |
------------------------------
Date: 24 Mar 1997 15:45:16 GMT
From: Eric.Guichard@ens.fr
Subject: Perl for Power PC on Mac
Message-Id: <5h67ic$s88$1@nef.ens.fr>
Hi
I have developped perl programs on Unix machines and transformed then in
RunTimes for the Macintosh (I got the Mac Perl 4.1.3).
I made nice programs, but they now work slowly on PowerPC.
Is there a (new) MacPerl specifically developped for these new processors?
Thanks in advance
PS: My perl tools work for textual analysis. There are freely accessible at
the URL:
ftp://www.sciences-sociales.ens.fr/pub/outils_lettres/Koutosuiss-1.2.sea.hqx
and the documentation (in french) is at:
http://www.sciences-sociales.ens.fr/KTinfos.html
---
Eric Guichard courriel : Eric.Guichard@ens.fr
Informatique Litteraire tel: (33) 01 44 32 30 02 ou 30 04
Ecole normale superieure Fax: (33) 01 44 32 36 95
45 rue d'Ulm
75005 Paris
France
serveur Web: http://www.sciences-sociales.ens.fr
Next and MIME mail accepted, ASCII mail always preferred!
------------------------------
Date: 24 Mar 1997 18:48:37 +0100
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: Perl for Power PC on Mac
Message-Id: <8667yhxjt6.fsf@iis.ee.ethz.ch>
Eric.Guichard@ens.fr writes:
> I have developped perl programs on Unix machines and transformed then in
> RunTimes for the Macintosh (I got the Mac Perl 4.1.3).
4.1.3 was released in early 1994. Where did you get that? The ftp server of the
Boston Computing Museum ? :-)
> I made nice programs, but they now work slowly on PowerPC.
> Is there a (new) MacPerl specifically developped for these new processors?
Yes, and especially there is (of course) a version of MacPerl 5 by now.
See the attached document for details.
Matthias
-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
I see the few formal linguists who survive, slightly crazed as a result of
isolation and inbreeding, taking to the hills in places like Montana and
northern Idaho [...]. Occasionally one will read of a heavily armed FBI
team shooting it out in a siege of a fortified formalist farmhouse, and
mainstream linguists, pausing amid their work of unifying [Theta]-roles
with cognitive stereotypes, will say "Are these crazies still out there?"
-- Geoffrey K. Pullum, _Formal linguistics meets the boojum_
Questions and Answers about MacPerl
Table of contents
General questions
1) How can I get this document?
2) Where can I get real information about MacPerl?
3) What is MacPerl and where can I get it?
4) How do I subscribe/unsubscribe from the MacPerl mailing lists
5) How do I send an article to the MacPerl mailing lists
6) Is there a searchable archive of the MacPerl mailing list?
7) How many people are using MacPerl?
Working with MacPerl
8) Why don't my droplets work?
9) Is there a collection of MacPerl scripts anywhere?
10) Is it possible to develop CGI scripts for MacHTTP using MacPerl?
Further Development
11) When will there be a stable version of MacPerl5?
12) When will there be a multithreaded/OSA Perl?
13) Why doesn't MacPerl make more rapid progress?
Questions
1) How can I get this document?
Well, you have it, don't you? You could always ask me for a copy by
email. The cool new way to get an updated version is by WWW in
"http://www.iis.ee.ethz.ch/~neeri/macintosh/perl-qa.html". Should
further information (e.g., the manual), become available online in the
future, you'll find it on
"http://www.iis.ethz.ch/~neeri/macintosh/perl.html".
2) Where can I get real information about MacPerl?
Luckily, a few brave MacPerl users have started filling the huge gaps
in the MacPerl documentation.
Sandra Silcot publishes a MacPerl primer at
http://www.unimelb.edu.au/~ssilcot/macperl-primer/home.html,
and also by ftp at
ftp://www.unimelb.edu.au/pub/cwis/tools/macintosh/MacPerl-PRIMER-1.1.sea.hqx
Bob Dalgleish and Bob Wilkinson have taken over the MacPerl FAQ from
Hal Wine. It can be retrieved at
http://www.perl.com/CPAN/doc/FAQs/mac/MacPerlFAQ.html.
3) What is MacPerl and where can I get it?
MacPerl is a port of Larry Wall's Perl (Practical Extraction and
Report Language) to the Apple Macintosh.
The most recent versions of MacPerl are always available in
sunsite.cnlab-switch.ch software/platform/macos/perl
This site is mirrored at
mors.gsfc.nasa.gov /pub/MacPerl/Applications
and in a huge number of CPAN (Common Perl Archive Network) mirror sites:
Florida
ftp://ftp.cis.ufl.edu/pub/perl/CPAN/ports/mac/
Illinois
ftp://uiarchive.cso.uiuc.edu/pub/lang/perl/CPAN/ports/mac/
Massachusetts
ftp://ftp.iguide.com/pub/mirrors/packages/perl/CPAN/ports/mac/
Oklahoma
ftp://ftp.uoknor.edu/mirrors/CPAN/ports/mac/
Texas
ftp://ftp.sedl.org/pub/mirrors/CPAN/ports/mac/
ftp://ftp.sterling.com/programming/languages/perl/ports/mac/
Finland
ftp://ftp.funet.fi/pub/languages/perl/CPAN/ports/mac/
France
ftp://ftp.ibp.fr/pub/perl/CPAN/ports/mac/
ftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/ports/mac/
Germany
ftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/ports/mac/
ftp://ftp.rz.ruhr-uni-bochum.de/pub/programming/languages/perl/CPAN/ports/mac/
Great Britain
ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/ports/mac/
The Netherlands
ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/ports/mac/
Portugal
ftp://ftp.ci.uminho.pt/pub/lang/perl/ports/mac/
Sweden
ftp://ftp.sunet.se/pub/lang/perl/CPAN/ports/mac/
Switzerland
ftp://sunsite.cnlab-switch.ch/mirror/CPAN/ports/mac/
Australia
ftp://coombs.anu.edu.au/pub/perl/ports/mac/
ftp://ftp.mame.mu.oz.au/pub/perl/CPAN/ports/mac/
New Zealand
ftp://ftp.tekotago.ac.nz/pub/perl/CPAN/ports/mac/
Japan
ftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/ports/mac/
Taiwan
ftp://dongpo.math.ncu.edu.tw/perl/CPAN/ports/mac/
South Africa
ftp://ftp.is.co.za/programming/perl/CPAN/ports/mac/
The current version of MacPerl is 5.1.3r2 and is available in the
above directories as:
- Mac_Perl_513r2_appl.bin for the Macintyosh application.
- Mac_Perl_513r2_tool.bin for the MPW Tool (If you don't know what that
is,
you don't want it).
- Mac_Perl_513r2_src.sit.bin for the source code.
4) How do I subscribe/unsubscribe from MacPerl mailing lists?
Please be warned that all information about mailing lists is subject to
change within the next few weeks, as the lists will move to a new server.
There are now two mailing lists dedicated to MacPerl. The mac-perl
mailing list is an open discussion list with maybe a dozen articles a
day. The mac-perl-announce list is a very low volume moderated mailin
list with only 1-2 messages a month.
To subscribe to the mac-perl list, send mail to
mac-perl-request@iis.ee.ethz.ch whose BODY (the Subject is
ignored) is the word "subscribe" or "unsubscribe". To subscribe to the
mac-perl-announce list, send this mail to
mac-perl-announce-request@iis.ee.ethz.ch instead. All traffic to
the announce mailing list automatically appears on the regular mailing
list, too, so there is no need to subscribe to both of them.
5) How do I send an article to the MacPerl mailing lists?
Articles sent to mac-perl@iis.ee.ethz.ch are automatically sent to the
list. If you have an article that you have severe doubts whether it should
be distributed, send it to mac-perl-approval@iis.ee.ethz.ch. I will
read your article, and will send it to the list unless I think I can
answer it exhaustively and neither the question nor the answer are of
general interest. Note that I'm severely backlogged in my mail and sending
articles to -approval adds to my work load.
Please help to keep the mailing list an useful resource for as many people
as possible. Don't post an article unless it is
specific for the Macintosh. General Perl questions belong
in comp.infosystems.www.authoring.cgi, if they are CGI programming
related, and in comp.lang.perl.misc otherwise.
If you feel that your message belongs on the -announce mailing list,
send it to mac-perl-announce-approval@iis.ee.ethz.ch. I will send it
to the list if I agree that it's appropriate.
6) Is there a searchable archive of the MacPerl mailing list?
Yes! Sandra Silcot has dedicated the time and resources to build one at
http://www.its.unimelb.edu.au:801/hma/pub/macperl/.
7) How many people are using MacPerl ?
As with most free software, this is hard to say. There are now around
800 subscribers to the mailing list, and version 4.1.8 has been
downloaded thousands of times from ftp.switch.ch alone (in August
1995, I counted close to 800 downloads).
8) Why won't my droplets work?
Due to a bug in MacPerl 4.1.8, droplets only work if you have
AppleScript installed. This bug was fixed in MacPerl 5.
9) Is there a collection of MacPerl scripts anywhere?
I'm building one in ftp://ftp.switch.ch/software/mac/perl/scripts/, but I
don't have much
time to invest. If you have any interesting scripts to offer, send me
(neeri@iis.ee.ethz.ch) a
mail. If you have a whole collection of scripts on your own ftp site,
tell me and I'll set up a mirror.
10) Is it possible to develop CGI scripts for MacHTTP using MacPerl?
Yes. You'll need the MacHTTP CGI Script extension, which is available
in ftp://err.ethz.ch/pub/neeri/MacPerl/
as "PCGI". The latest version, "PCGI_06Feb96.sit.hqx", is largely
compatible with the Unix CGI specification.
11) When will there be a stable version of MacPerl5?
5.1.3 overall looks pretty good, I think. I'm trying to fix the trouble
spots, but see below.
12) When will there be a multithreaded/OSA Perl?
There is a Perl OSA component, but it doesn't seem to be very stable
yet. I don't know when/if there will be a multithreaded Perl.
13) Why doesn't MacPerl make more rapid progress?
Right now, until Spring of 1997, I'm writing my PhD dissertation (on
Distributed Scheduling in Workstation Clusters). Even after that work
is concluded, I expect that there will always be a day job that has
precedence over all MacPerl work.
Last changed: 06Feb97
------------------------------
Date: Mon, 24 Mar 1997 12:25:01 -0500
From: Prem Sumetpong <prem@lzusp.lucent.com>
Subject: Perl Ftp Server
Message-Id: <3336B8ED.7AF0@lzusp.lucent.com>
I am looking for a perl implementation of a ftp server ?? any one konws
of one ?
thanx
prem
prems@lucent.com
------------------------------
Date: 24 Mar 1997 23:45:11 +0800
From: cflam@hk.super.net (LAM Chi-fung)
Subject: Perl sendmail problem
Message-Id: <COrDpCEGv0NQ078yn@hk.super.net>
Hello all, I am now writing a perl program to send e-mail from a mailing
list, the send e-mail code is:
for ($i=1;$i<=$maillistcount;$i++)
{
open (SM,"|/usr/lib/sendmail -f$FromAddress $maillistacount[$i-1]");
print SM "Subject: $MailSubject\n\n";
print SM "$MailBody\n.\n";
close (SM);
}
However, I find that not all the e-mail are sendout e.g. if the list
contains 10 people, sometime, only 5 of them receive e-mail and some 8
of them!!!! And never got 10!!! What happen ? I know C/C++ but is new to
perl and UNIX, thanks a lot.
Regds
LAM Chi-fung
------------------------------
Date: Mon, 24 Mar 1997 16:56:07 GMT
From: tomhicks@accessone.com (Tom Hicks)
Subject: Perl/CGI/ freelance pt. help needed in Seattle.
Message-Id: <3336b112.13645976@news.accessone.com>
The CyberQueer Lounge at:
http://www.cyberzine.org
needs freelance help with perl-cgi scripting here.
There are two main scripts here that need attention, a chat script and
a directory.cgi. The directory.cgi runs a members area with search,
personal profiles, chat connectivity and more.
Looking for an individual that does freelance type perl and cgi work.
If you are interested you can Email me at:
tomhicks@cyberzine.org
------------------------------
Date: 24 Mar 1997 15:00:10 GMT
From: teallwar@collins.rockwell.com (T)
Subject: Re: Problem Building POSIX module of Perl 5.003 for Solaris 2.5
Message-Id: <5h64tq$1le4@castor.cca.rockwell.com>
In article <5gvrb4$jd8$1@mycroft.westnet.com>, djchin@westnet.com (Danton Chin) writes:
|> I am having a problem building the POSIX module for Perl 5.003 for
|> Solaris 2.5 using GNU cc version 2.7-96q3. Configure cannot find the
|> lposix and the lcposix libraries and the portion of make for the POSIX
[ snip ]
|>
|> 4. And in the make test all modules are ok except for the POSIX module
|> which fails:
|> ...
|> lib/posix......FAILED on test 12
|> lib/safe.......ok
|> lib/sdbm.......ok
|> lib/socket.....ok
|> lib/soundex....ok
|> Failed 1 test, 98.94% okay.
|> u=0.91 s=1.4 cu=25.71 cs=27.47 files=94 tests=1968
|>
I don't think this is a problem with not finding the libs. The test that is
failing is looking for the defined value of _POSIX_OPEN_MAX, which on my svr4
system (not solaris) is defined in limits.h. The problem is that limits.h
will only define this value if POSIX_SOURCE is defined. Sorry but I don't
have a solution - If I defined POSIX_SOURCE, other things broke, so I just
didn't build that extention.
If you find a solution, I'd like to hear about it.
T.
------------------------------
Date: 24 Mar 1997 09:55:03 -0800
From: Scott Henry <scotth@sgi.com>
Subject: Re: Problems Installing Perl 5
Message-Id: <yd8ybbdqio8.fsf@hoshi.corp.sgi.com>
>>>>> "M" == Mason Withers <mwithers@bvox.salk.edu> writes:
M> I'm trying to install Perl 5, and I can get past the "sh Configure" and
M> "makedepend" stages. But when it is time to make the application during
M> the cc phase, I get:
M> ld:
M> atan
M> cos
M> pow
M> sin
M> (and a few other math functions)
M> ***Error code 1 (bu 21)
M> Does this mean that my math functions are hidden in somehow hidden in a
M> library where the "make" app doesn't know where to look? I have no idea,
M> everything else seems to be moving along fine.
You don't say what IRIX release you are running, as that can affect
the specific recommendations.
Configure should have listed "-lm" as part of the library list
options (you aren't linking with the math library).
Also, on IRIX 6.x, it is important to tell configure to NOT use nm
to pull symbols out of libc.
If you are just interested in getting a working Perl5, see my Web
page:
http://reality.sgi.com/scotth/info/perl5.html
--
Scott Henry <scotth@sgi.com> / Help! My disclaimer is missing!
Networking Services, / GIGO *really* means: Garbage in, Gospel Out
Silicon Graphics, Inc / http://reality.sgi.com/scotth/
------------------------------
Date: Mon, 24 Mar 1997 06:53:25 -0800
From: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Reg. Expressions with Associative Arrays
Message-Id: <33369565.43C70135@darkwing.uoregon.edu>
This script is really a small part of a bigger script that converts a
Framemaker .mif file to html. This script picks up where I have already
parsed out all Frame's table description info and I am left with a bunch
of html-formatted tables that all have unique imbedded ids. My problem
is that the mif document stores all the table content in one place and
has a corresponding unique id tag (Called AFrame) for the tables in
another part of the document. With my limited knowledge of PERL, I am
trying to use associative arrays to store the ids and then make the
proper table replacements for the AFrame placeholder. Can anyone see
what I am doing wrong here, or if there is an altogether easier method,
I'd be interested in hearing that, too. I have included a very watered
down example of what I have in the mif file at the bottom.
Thanks,
Michael Stearns
#!/usr/local/bin/perl
foreach (@ARGV) {
open (INFILE,"$_") || die ("Can't Open $_\n");
@table=<INFILE>;
$table=join("",@table);
$tableTemp = $table;
#I realize this step is a little convoluted, but I putting characters in
so that I can use the split function in the following steps. I imagine
it could be simpler.
if ( $tableTemp=~s!(<table>)\nid(\d+)(.*?</table>)!%$2#$1$3!gs) {
$tableTemp =~s!(.*</table>).*!$1!gs;
@tableArray = split(/%/, $tableTemp);
foreach $pair (@tableArray) {
($name, $value) = split(/#/, $pair);
$tableAssocArray{$name} = $value;
}
}
print "$tableTemp\n";
### I assume this is where I am going wrong, but I can't figure out how
to make it work. I've tried a bunch of options.
$table =~ s!AFrame(\d+)\b!$tableAssocArray{$1}!gs;
open (OUTFILE,">$_") || die ("Can't Open $_\n");
print OUTFILE ($table);
}
### Below is a sample source file.
<table>
id20
This is table 1
</table>
<table>
id21
This is table 2
</table>
This is the start of the main section
AFrame20
AFrame21
This is the end of the main section
------------------------------
Date: Mon, 24 Mar 1997 16:14:28 GMT
From: Clayton Weaver <cgweav@eskimo.com>
Subject: Regular Expression question
Message-Id: <Pine.SUN.3.96.970324080138.5232B-100000@eskimo.com>
With the (?=n) zero-width positive lookahead extension,
(?=n) !~ $&
It is not part of the last pattern matched, but does it count as
a bracket match? Does
(?=n) = $+
if the (?=n) is on the end of a pattern?
/example(?=:)/
$& is "example". Is "$+" equal to ":"? Is "$+" equal to "example"?
Ie does the whole pattern match count as a bracket match if the (?=)
bracket is excluded?
Regards, Clayton Weaver cgweav@eskimo.com (Seattle)
------------------------------
Date: 24 Mar 1997 15:21:08 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: subdirectories
Message-Id: <5h6654$138@fridge-nf0.shore.net>
Berhin Jean-Francois (berhin@fpms.ac.be) wrote:
: How can i read all files in a directory + sub-directories ?
: (RECURSIVE)
File::Find and File::Recurse.
Hope this helps!
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 24 Mar 1997 16:08:22 GMT
From: rw26@acf2.nyu.edu (Randy Wright)
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <5h68tm$or1$1@news.nyu.edu>
Stephane Plattner (NOSPAMplas@fmi.ch) wrote:
: mwolfe@shrike.depaul.edu wrote:
: >
: > In the end Linux will bury MS. Linux is open. This means open
: > competition. This means better products. LINUX RULES.
: >
:
: IMHO this answer contradicts to the basics of economics. Openess means
: to a great extent equality and equality prohibits competition.
: (communism). Competition rises only when differences exists and it's
: the market (or the environment), who dictates which product is better.
:
IMHO, if the sucess of Linux contradicts basic economics,
then there really is something wrong with basic economics.
I've seen companies try to compete with Linux go belly up.
That is not the intent of the Linux community. It just happens
B.Gates and Co. acknowledge having "missed" the popularity and
significance of the internet. After all, they didn't see
it competeing in their channels. Nobody was advertising it
magazines or pushing it in egghead stores. The same thing is true
of Linux. Now, Microsoft cannot see Linux. They will
not realize the level of compitition they get from Linux.
The figures are soft, but there are those claiming that Linux
is now the number 3 OS with an installed base of about 6 million.
But traditional economics and marketing and management thinking
will not, as far as I know, be able to digest such an idea.
It is not at all some socialist or communist thing, as some
people around usenet have proposed.. It is NOT characterized
by central planning, or authoritarian production.. That is
much more like the model of Microsoft. Linux is not controlled.
It cannot be made unprofitable. It is built BY its market and
it becomes whatever that market wants it to be as the market
decides what it wants.
--
Randy Wright rw26@acf2.nyu.edu
Distributed Computing and Information Services Group
New York University
Rm. 301 - 251 Mercer St.
New York, New York 10012
------------------------------
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 168
*************************************