[7526] in Perl-Users-Digest
Perl-Users Digest, Issue: 1153 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 9 18:07:20 1997
Date: Thu, 9 Oct 97 15:00:23 -0700
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, 9 Oct 1997 Volume: 8 Number: 1153
Today's topics:
-Help with eval <mwick@toy.mem.ti.com>
5.004_03 test failure on IRIX 5.3 (James W. Durkin)
Re: associative array <lth@dannet.dk>
can Perl do this? <cck@wwdg.com>
Can't open blah, blah, blah <whitek@thegrid.net>
Re: Emailing information from a Form which includes Lis (Faust Gertz)
glob in web script <jom@net1plus.com>
Help storing a hash of hashes using DB_File (Larry Lentner)
How do I skip \, in a split /,/ (Toutatis)
Re: How do I skip \, in a split /,/ <tycage@infi.net>
Re: IO::Socket on Win32 (Standard bindist04 port) <sriram@weblogic.com>
Re: Is there a better way? <ramon@ramonc.icix.net>
LLama book script (Andrew Martin Adrian Cater [Andy])
Need Help Parsing ASCII File <rtruban@erols.com>
Out of memory error? <Brian_shields.0192063@nt.com>
Perl for NT- trouble with proxies <a-charm@microsoft.com>
Re: Perl integers bigger than I thought? But why 49? (Jason Gloudon)
Re: Perl Questions (Peter Rose)
Perl5.003: Is it possible to alter the sort order for (Gail Hunn)
Perl5.004_01 on Solaris 2.6 (Martin Cross)
Re: Problem with script in LLama book (brian d foy)
Re: Q: how to specify how many decimals a calcultaion s <rootbeer@teleport.com>
Re: regexp: matching at least n chars out of a string o <nnyxcu@ny.ubs.com>
Result: Cannot compile perl 5.004.03 under NEXTSTEP 3.3 Gerben_Wierda@RnA.nl
sorting a hash (David Siebert)
Re: sorting a hash (brian d foy)
Re: sorting a hash (Toutatis)
Re: Text formatting question (Terry Michael Fletcher - PCD ~)
Writing a file referenced by Server Name via CGI <Kevin_Skelton@mgic.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Oct 1997 14:53:20 -0500
From: "M. Wick" <mwick@toy.mem.ti.com>
Subject: -Help with eval
Message-Id: <343D3630.9A9FE50C@toy.mem.ti.com>
I'm trying to catch the exit status (number) from one file within
another.
Here is an example of what I'm trying to do:
up1.pl
#!/usr/local/bin/perl -w
...
require "up2.pl";
...
eval { &get( $file, $status ); }
$error = ( $? >> 8 );# trying to get exit code from up2.pl ( exit( 2 ),
or exit( 5 ) ) that I used
die "Got exit status 5 from up2.pl\n" if ($error==5);
up2.pl
#!/usr/local/bin/perl -w
use strict;
1;
sub get {
...
( warn "No data!\n" and exit( 5 ) ) if !$data;
...
}
Is there a way to do this? Any help would be appreciated. Thanks in
advance.
M. Wick
------------------------------
Date: 09 Oct 1997 17:50:41 -0400
From: jwd@graphics.cornell.edu (James W. Durkin)
Subject: 5.004_03 test failure on IRIX 5.3
Message-Id: <reiuv6bo7i.fsf@eyrie.graphics.cornell.edu>
I just redid our Perl installation on various systems, switching from
5.004_01 to 5.004_03 in the process. The build/test used to go
cleanly on our IRIX 5.3 systems, but doesn't now. It fails in the
tests of lib/complex.
My deviation from the defaults during the configuration are as follows:
- answer 'n' for "Binary compatibility with Perl 5.004_03?"
- omit '/usr/local/lib' from the directories for library searches
- omit '-I/usr/local/include' from the additional cc flags
- use '-s' for the additional ld flags
- use the "malloc" that comes with Perl
I did the whole process again without the last two changes and I still
get the problem.
Here is the myconfig output:
Summary of my perl5 (5.0 patchlevel 4 subversion 3) configuration:
Platform:
osname=irix, osvers=5, archname=IP22-irix
uname='irix piper 5.3 02091401 ip22 mips '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=n useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -DLANGUAGE_C'
ccflags ='-D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000 -DLANGUAGE_C'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=1, d_casti32=define, d_castneg=undef
intsize=4, alignbytes=8, usemymalloc=y, randbits=15
Linker and Libraries:
ld='ld', ldflags ='-s'
libpth=/usr/lib /lib
libs=-lsun -lm -lc -lcrypt -lbsd -lPW
libc=/usr/lib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-shared'
Here are the relevant lines from a "perl lib/complex.t" in the "t"
directory:
not ok 794
# 'acos $z0' expected: '3.14159265358979-1.31695789692482i' got: '-3.14159265358979-1.31695789692482i' for z = (-2.0,0)
not ok 818
# 'asec $z0' expected: '3.14159265358979-1.31695789692482i' got: '-3.14159265358979+1.31695789692482i' for z = (-0.5,0)
not ok 828
# 'acsc $z0' expected: '-1.5707963267949+1.31695789692482i' got: '-1.5707963267949-1.31695789692482i' for z = (-0.5,0)
Any ideas???
--
James Durkin
jwd@graphics.cornell.edu
------------------------------
Date: Thu, 09 Oct 1997 21:32:22 +0200
From: Lars Thegler <lth@dannet.dk>
To: Robert <colte@hem.passagen.se>
Subject: Re: associative array
Message-Id: <343D3146.84B12184@dannet.dk>
(posted && mailed)
You could use encode_entities() from HTML::Entities, which is part of the=
libwww bundle.
Robert wrote:
> =
> I want to replace all occurances of the scandinavian
> characters =E5=E4=F6 with the appropriate html-code.
-- =
Lars Thegler mailto:lth@dannet.dk
Internet Development http://www.dannet.dk
Dan Net A/S phone: +45 45 82 16 00
Blokken 9 - DK-3460 Birkeroed - Denmark fax: +45 45 82 16 44
------------------------------
Date: Thu, 09 Oct 1997 16:24:30 -0700
From: Chris Kahrhoff <cck@wwdg.com>
Subject: can Perl do this?
Message-Id: <343D67AE.41F9@wwdg.com>
I'm am to learn perl in order to write a program that will collect data
from a syslog of a terminal server and make a report of that data,
including duration of connection, name of connection, etc. Will perl do
this? How would I go about writing this program? Does a similar
program already exist? Thanks for any help you can give me. I prefer
email responses.
Chris Kahrhoff
------------------------------
Date: 9 Oct 1997 21:07:41 GMT
From: "Justin White" <whitek@thegrid.net>
Subject: Can't open blah, blah, blah
Message-Id: <01bcd5c0$f7d80da0$21653cd1@200cyrix.thegrid.net>
Hi,
I'm a beginning CGI Scripter at an ISP and am having problems saving to a
file. I have a form that users fill out and submit. When submitted, I
told the perl script to send a few form variables ex.($FORM{'$name'}) to a
couple of email boxes and some variables to a file, delimited by tildes
(~). All the mail stuff works fine, but when I try to print to the file on
the BSDI server, I read in the error log - reason: Premature end of script
headers. Please tell me what this means.
Thanks,
Justin
------------------------------
Date: Thu, 09 Oct 1997 19:12:59 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Emailing information from a Form which includes List Boxes
Message-Id: <34402659.2325963@news.wwa.com>
On Thu, 09 Oct 1997 10:01:54 -0400, Gerrard Leach
<grleach@achilles.net> wrote:
>I am fairly new to CGI scripting, and am trying to create a script that
>emails information from a form to myself.
Are you also new to perl? If so, I suggest learning perl before
trying to use perl to do CGI scripting. If you haven't already, I
suggest you purchase _Learning Perl_ by Randal Schwartz and Tom
Christiansen. There is plenty of information in the *last* chapter of
the book on the CGI.pm module. If you are looking for a less
unix-centric book, you can try Eric Johnson's _Cross-Platform Perl_,
which also has a *later* chapter on the CGI.pm module. If you have
the money, perhaps you should get both. :-) I did. If you are not
new to perl and only new to CGI scripting, you can ignore this fine
advice.
>I have managed to complete
>this if each element in the form only returns one result, however in the
>case of scrollable boxes in which you can select multiple objects, I am
>unable to do get all the selections. I only receive the last of the
>elements selected. Here is a piece of my code so far.
[Scary code snipped]
This looks like code designed to decode a CGI form. Did you read the
perl FAQ? All of it?
----------------Now is the time we quote from the FAQ----------------
How do I decode a CGI form?
A lot of people are tempted to code this up themselves, so you've
probably all seen a lot of code involving
$ENV{CONTENT_LENGTH} and $ENV{QUERY_STRING}. It's true that this can
work, but there are also a lot of versions of this
floating around that are quite simply broken!
Please do not be tempted to reinvent the wheel. Instead, use the
CGI.pm or CGI_Lite.pm (available from CPAN), or if you're
trapped in the module-free land of perl1 .. perl4, you might look into
cgi-lib.pl (available from
http://www.bio.cam.ac.uk/web/form.html).
-----------------------End of FAQ quote-----------------------
Besides looking at the FAQs (http://language.perl.com/faq/index.html),
you might want to look at _CGI Programming Techniques in Perl_
(http://www.eff.org/%7Eerict/Scripts/Book/Mis/appendix_a.html), Nick
Kew's 'CGI Programming FAQ'
(http://www.webthing.com/page.cgi/cgifaq), and 'CGI.pm - a Perl5 CGI
Library'
(http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html).
other CPAN modules which have already done the work for you
(http://www.perl.com/CPAN-local/CPAN.html), and Randal Schwartz's _Web
Techniques_ (http://www.stonehenge.com/merlyn/WebTechniques/) and
_Unix Review_ (http://www.stonehenge.com/merlyn/UnixReview/) articles.
>The List box will fall into the else part of the if statement along with
>other elements if that helps at all. I think that the name of the list
>box element is going to come in as an array, however being new at this,
>I am not sure how to split the array into different elements. Any help
>will be appreciated.
You already have *a lot* to read. :-) But, if you would like to see
a pretty secure script which uses Lincoln Stein's CGI modules and does
something similar to what you desire, look at Robert Seymour's
simple, safe, and generic CGI back end mail script named
'rjsemail.cgi' at
ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/scripts/infoserv/WWW/rjsemail.cgi
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"You cannot solve the problem with the same kind of thinking that has
created the problem." - Albert Einstein
------------------------------
Date: Thu, 09 Oct 1997 17:02:42 -0400
From: Jeremy Mordkoff <jom@net1plus.com>
Subject: glob in web script
Message-Id: <343D4672.66EF@net1plus.com>
I have a web script (I guess it's a CGI script) that I just added a glob
command to. It still works when I run it from the command line, but the
glob fails (returns no filenames) when my web server runs it for me.
Everything else works fine. Could this be a permissions problem on my
web server? MS IIS with the ASP patch running on NT 4.0 w/ SP 3.
JLM
reply via email please.
--
Anne & Jeremy L. Mordkoff
http://www.net1plus.com/users/jom
------------------------------
Date: 9 Oct 1997 21:13:45 GMT
From: llentner@raven.bbnplanet.com (Larry Lentner)
Subject: Help storing a hash of hashes using DB_File
Message-Id: <61jhe9$77a$1@daily.bbnplanet.com>
Hello,
Does anybody have some pointers to examples/hints/etc for storing a
hash of hashes in a Berkeley db file, using DB_File? It appears that a
hash tied with "tie %hash, "DB_File", ... " will only work with a flat
(ie. not multidimensional) hash.
Much appreciated....
Larry
------------------------------
Date: 9 Oct 1997 19:46:09 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: How do I skip \, in a split /,/
Message-Id: <toutatis-ya023180000910972146070001@news.euro.net>
$line = 'xxxx,xx\,xx,xxxx'
How do I split this line into three fields, omitting the escaped comma?
--
Toutatis
mailto:toutatis@toutatis.net
------------------------------
Date: Thu, 09 Oct 1997 16:56:57 -0400
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: How do I skip \, in a split /,/
Message-Id: <343D4519.5EDF7D1@infi.net>
Toutatis wrote:
>
> $line = 'xxxx,xx\,xx,xxxx'
> How do I split this line into three fields, omitting the escaped comma?
>
> --
> Toutatis
> mailto:toutatis@toutatis.net
Try
$line = 'xxxx,xx\,xx,xxxx';
@fields = split(/[^\\],/,$line);
The /[^\\],/ means match anything that isn't a literal \ followed by a
comma.
Hope this helps,
Ty
+---+
Ty Cage Warren tycage@infi.net
Systems Engineer InfiNet
Homepage: http://tazer.engrs.infi.net/~tycage
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78 B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------
------------------------------
Date: Thu, 09 Oct 1997 14:43:08 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: Paul Moore <Paul.Moore@uk.origin-it.com>
Subject: Re: IO::Socket on Win32 (Standard bindist04 port)
Message-Id: <343D4FEC.C4BEFE41@weblogic.com>
Paul Moore wrote:
>
> I'm trying to get sockets to work on Win32. I'm using the following
> example code from Sriram Srinivasan's excellent book "Advanced Perl
> Programming":
Thanks for the plug !
>
> --- start code ---
> use IO::Socket;
> $port = $ARGV[1] || 8081;
> print "Opening socket to $ARGV[0]($port)\n";
>
> $sock = new IO::Socket::INET (PeerHost => $ARGV[0],
> PeerPort => $port,
> Proto => 'tcp');
>
This is in the errata. PeerHost should be "PeerAddr". (It used
to PeerHost in the earlier versions of IO:Socket when I was writing
that chapter)
See if that fixes it, and if not, I'll look at the rest of your
script!
- Sriram
________________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Thu, 09 Oct 1997 11:57:13 -0400
From: Ramon Castillo <ramon@ramonc.icix.net>
Subject: Re: Is there a better way?
Message-Id: <343CFED9.3D9@ramonc.icix.net>
Ramon Castillo wrote:
I'm sorry is Perl 5.004_01 huuups.
------------------------------
Date: Thu, 09 Oct 1997 21:09:46 GMT
From: amacater@galactic.demon.co.uk (Andrew Martin Adrian Cater [Andy])
Subject: LLama book script
Message-Id: <876431386.17553.0.nnrp-05.9e983fd9@news.demon.co.uk>
Still having trouble with this one from page 10 of LLama book (2nd. ed).
Here is the entire script
#!/usr/bin/perl -w
use diagnostics;
%words = qw(fred camel
barney llama
betty alpaca
wilma alpaca
); # the secret words
print "What is your name? ";
$name = <STDIN>;
chomp $name;
if ($name eq "Randal") {
print "Hello, Randal! How good of you to be here!\n";
} else {
print "Hello, $name!\n"; # ordinary greeting
$secretword = $words($name);
print "What is the secret word? ";
$guess = <STDIN>;
chomp ($guess);
while ($guess ne $secretword) {
print "Wrong, try again. What is the secret word? ";
$guess = <STDIN>;
chomp ($guess);
}
}
and it bombs out with an exception error at line 14 or 15.
I don't understand it - it's so simple.
Thanks for any help
Andy
------------------------------
Date: Thu, 9 Oct 1997 20:55:06 GMT
From: Rob Truban <rtruban@erols.com>
Subject: Need Help Parsing ASCII File
Message-Id: <343D44A9.4E6D907D@erols.com>
Hi all,
I'm a Perl Newbie in need of advice. I want to take an ASCII text file
(which is the result of an SQL query done on a Sybase DB), parse the
text file and populate an Access DB with the info. For the record, this
will not be a web based app...
I've been reading Perl books (PERL 5 How-To & a couple of others) and
searching the web all week and have not found any scripts similar to
what I want.
The text file will have a header and then the info from the SQL selects.
The only example I've found (parseHtm.pl from How-To) parses by looking
through a file one character at a time. Is there a way to do it more
efficiently? Essentially, what I need to do is take each word in the
file and make it a scalar. None of the elements in the header have
white space, if that helps. I want the header data to be the keys in
the associative array, then use the "actual" data to fill in the record
portion of the array. Each Array "key" would associate to a table field
in the Access DB, and the "record" portion of the array would be used to
fill in the records in Access table.
Does that make sense?? I'm not sure if I'm approaching this the right
way. Any input would be greatly appreciated.
Thanks In Advance,
Rob Truban
------------------------------
Date: Thu, 09 Oct 1997 14:55:13 -0400
From: brian shields <Brian_shields.0192063@nt.com>
Subject: Out of memory error?
Message-Id: <343D2891.3293@nt.com>
Greetings,
I am running Perl version 5.001 on an HP-UX 712 9.05. I am running a
program to create an associative array of our internal e-mail
addresses. The array is keyed by employee id and it constructs a list
for each id (dept number, first name, last name, and e-mail address). I
have set it up to have no more than 2 iterations of the e-mail address
per employee (an employee can have more than one e-mail address). The
program runs out of memory. I estimate there are about 60K records to
be produced. What I do not understand is why so much memory is used
when the source file is only 1.5 MB? My program is using a small
portion of each record in this file(perhaps about 80 bytes of
information). Using the HP command 'top' to monitor memory usage, I can
see the program went from initially using about 1 MB of memory to 80MB
before it finally failed. My system has 128MB RAM. I would expect an
internal file of less than 5 MB to be created. So why is so much memory
being consumed? I am not running anything else at the same time either
which would consume all available memory. I would sure appreciate any
suggestions on making full use of available memory without wasting it
all somehow. Any ideas?
Sincerely,
Brian
------------------------------
Date: Thu, 9 Oct 1997 12:35:30 -0700
From: "Chas Miller" <a-charm@microsoft.com>
Subject: Perl for NT- trouble with proxies
Message-Id: <61jbmq$voq@news.microsoft.com>
Hola,
After installing Perl 5.003 Build 311 for NT, libwww, and various other
fixes, I was able to pull in a local intranet site with this simple script.
use LWP::Simple;
$doc = get "http://local";
print $doc;
However, I am having trouble pulling information through my proxy. For
example: http://www.yahoo.com. Anyone have any helpful hints or useful code
they can point me to?
Thanks!
Chas Miller
--
The opinions expressed in this message are my own personal views
and do not reflect the official views of the Microsoft Corporation.
------------------------------
Date: 9 Oct 1997 18:55:03 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Perl integers bigger than I thought? But why 49?
Message-Id: <61j9a7$k1c$1@daily.bbnplanet.com>
Matija Grabnar (matija@arnes.si) wrote:
: I have an applications which has to operate with realy big numbers.
: (Usenet traffic - 'nuff said).
: Anyway: I expected that the integers would roll over at 2**31 or at
: 2**32. However, I was surprised when I saw this:
: perl -e 'foreach (32..50) { print "$_ ".2**$_."\n";}'
** is implemented using the C math lib function pow().
which is declared like this :
double pow(double x, double y);
Perl usually uses double's to represent real numbers.
: I am happy that the integers don't roll over (or convert to float) when
: they reach 32 bits, but why does it convert to float after 49 bits?
: Why not at 2**32+1 or at 2*64+1?
The precision isn't changing just the output from the double -> string
conversion.
Jason Gloudon
------------------------------
Date: Thu, 09 Oct 97 12:19:31 EDT
From: WISH@uriacc.uri.edu (Peter Rose)
Subject: Re: Perl Questions
Message-Id: <17C02AD5ES86.WISH@uriacc.uri.edu>
>: > I can't even get a perl file to execute when a user wants it to....maybe
>: > you can help me with that, everytime I hit the submit button, the browser
>: > tries to download the script. The registry is ok, I've checked that
>: > out....
I discovered that my web server executes a perl script only if
it's in the CGI-SHL or CGI-DOS directory. If I put a perl-script
in anywhere in the HTDOCS tree (in other words, in a place where you'd
expect to find an HTML file) it gets transferred with a
Content-type: Text/Plain. In addition, ANYTHING that appears in
the CGI-SHL directory gets fed as input to the perl-interpreter, even
if it's got a .GIF extension. So this question probably has
more to do with your Web-server configuration than Perl, and to get an answer,
you'll probably have to tell us what you're using for server software.
------------------------------
Date: Thu, 09 Oct 1997 19:20:24 GMT
From: hunngai@fast.net (Gail Hunn)
Subject: Perl5.003: Is it possible to alter the sort order for a single sort?
Message-Id: <343d26e5.257379844@news.fast.net>
Is it possible to alter the sort order for a single sort?
I have a flat text file of some 350 records, each with 9 fields
delimited by vertical bars. The data in the fields is all uppercase.
I want to sort on fields 0, 3, and 7. So far so good. However, the
presence of empty fields seems to inject a certain amount of
randomness into the output.
I tried to remedy this by inserting a punctuation character into the
empty fields (for example, a period or question mark). However, the
default sort order appears to place punctuation ahead of uppercase
letters. The question marks show up first, then all of the
data-filled fields come up, in correct order, at the end.
I could go through the whole file and replace all the question marks
with 'zzzzz', then do the sort, then replace all occurrences of
'zzzzz' with a question mark. But think of the overhead.
Is there any way to tell the sort function to use a different order
from the default? Can anybody tell me what the default order is?
(The perl docs mention the LC_COLLATE environment variable, but this
does not appear to be set on my box, or if it is, I just haven't found
it.)
I have pored through the perldocs that came with perl, as well as the
faq, and at least two hard copy perl references, and I have come up
empty on this one. I would appreciate any help at all. TIA.
Please send responses to:
hunngai@fast.net
------------------------------
Date: Thu, 9 Oct 1997 13:21:19 -0400
From: crossm@stars.sed.monmouth.army.mil (Martin Cross)
Subject: Perl5.004_01 on Solaris 2.6
Message-Id: <MPG.ea6dc968cc28775989680@alice.iew.sed.monmouth.army.mil>
Trying to build Perl on a Solaris 2.6 box.
Getting a core dump on the following line during the build:
miniperl configpm tmp
Any help would be greatly apprecieated.
Thanx in Advance,
M.E. Cross
mcross@monmouth.com
------------------------------
Date: Thu, 09 Oct 1997 15:16:31 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem with script in LLama book
Message-Id: <comdog-ya02408000R0910971516310001@news.panix.com>
[does Panix carry alt.fan.e-t-b?]
In article <eli$9710091231@qz.little-neck.ny.us>, Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:
>Tad McClellan <tadmc@flash.net> wrote:
>> brian d foy (comdog@computerdog.com) wrote:
>> : one person that walks around with a complete set of perl man pages -
>> : didn't think to ask if he had a copy of any Perl books with him
>
>I'd bet not. He didn't pull out one to look at the list of O'Reilly
>perl titles when the question of "How many texts?" came up.
i had thought that O'Reilly had put a couple of chapters online, but
i couldn't find them (not that i looked for a long time...). i
wonder if the Perl Resource Kit will join Clay's man pages...
>No, he didn't. (Say brian, about that collective noun question:
>does "a caravan of perl programmers" sound good?)
i like it! (much better than mine). btw, the list is up to:
bundle of modules, Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
pod of modules, Andrew Johnson
FAQ of newbies, John L. Allen <allen@gateway.grumman.com>
JAPH of gurus, John L. Allen
caravan of perl programmers, Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
horde of perl programmers, brian d foy (comdog@computerdog.com)
>brian: maybe you should get the microfiche attachment for your PAA
The PAA [1] already supports abstract data types. some just require
the 3M Scotch extension...
[1] PAA <URL:http://computerdog.com/brian/paa/>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 9 Oct 1997 13:42:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Calle ]sman" <md4calle@mdstud.chalmers.se>
Subject: Re: Q: how to specify how many decimals a calcultaion shall have?
Message-Id: <Pine.GSO.3.96.971009134056.1076C-100000@usertest.teleport.com>
On 9 Oct 1997, Calle ]sman wrote:
> I want to make sure that the calculation delievers three decimals (at
> most) e.g.
> 23.3245
>
> shall become
> 23.3245
That looks like four digits. :-) But have you seen what the FAQ says
about rounding, in perlfaq4?
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 09 Oct 1997 16:11:09 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
To: gtuckerkellogg@genetics.com
Subject: Re: regexp: matching at least n chars out of a string of length m
Message-Id: <343D3A5D.F1B@ny.ubs.com>
gtuckerkellogg@genetics.com wrote:
>
> I have a collection of strings which contain many occurances of the
> character ':'. I'd like to know, for each string, all the substrings of
> length $window than contain $want colons.
>
> I've been thinking along the lines of
>
> $window = 30;
> $want = 20;
>
> foreach $string (@stringlist) {
> my $i;
> my $result = "";
> for (i=0;i<length($string)-$window; $i++) {
> my $substring = substr($string,$i,$window);
> if ($substring =~ /some_magical_regexp/) {
/(.*:){$want,}/
> # stuff the results into $result;
> substr($result,$i,1) = "1";
> }
> }
> }
>
> but I can't seem to figure out the right regexp. Am I barking up the
> wrong tree?
>
> Thanks,
>
> Greg
>
> Disclaimer: the statements above are my own.
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 9 Oct 1997 19:21:33 GMT
From: Gerben_Wierda@RnA.nl
Subject: Result: Cannot compile perl 5.004.03 under NEXTSTEP 3.3
Message-Id: <EHstrx.1sB@RnA.NL>
The result is, under NEXTSTEP 3,3/NEXTSTEP Developer 3.3:
For Perl 5.004.03
The sparc compile fails when optimization is on
The hppa compile fails regardless of optimization
I would like a new cc (this is gcc 2.5.8), but as far as I know, when I
install a newer gcc, I lose the possibility to make fat binaries, and that is
not acceptable.
Maybe there is a way to use the newer parts of the gcc compiler, but keep the
old cc driver?
If I succeed in creating a good set, I'll distribute a package (that's what I
have to do anyway if I want to install easily on my other i386-no-developer
system).
--
Gerben_Wierda@RnA.nl (Gerben Wierda)
"If you don't know where you're going, any road will take you there"
Paraphrased in Alice in Wonderland, originally from the Talmud.
Renee: "Met veel koper maakt men hoempa." (After hearing Brahms'
Festouverture)
------------------------------
Date: 9 Oct 1997 19:00:31 GMT
From: dsiebert@gate.net (David Siebert)
Subject: sorting a hash
Message-Id: <61j9kf$me2$1@news.gate.net>
I am trying to sort an array of keys to out put to a file.
this does not work. What will?
foreach $key sort((keys %myerror)) {print FILE "$key\t$value"}
------------------------------
Date: Thu, 09 Oct 1997 15:34:00 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: sorting a hash
Message-Id: <comdog-ya02408000R0910971534000001@news.panix.com>
In article <61j9kf$me2$1@news.gate.net>, dsiebert@gate.net (David Siebert) wrote:
>I am trying to sort an array of keys to out put to a file.
>this does not work. What will?
>foreach $key sort((keys %myerror)) {print FILE "$key\t$value"}
perhaps you meant to have that sort on the inside? :)
#!/usr/bin/perl
%hash = ( 0..9 );
foreach $key ( sort keys %hash )
{
print "$key\n";
}
__END__
0
2
4
6
8
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 9 Oct 1997 19:57:06 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: sorting a hash
Message-Id: <toutatis-ya023180000910972157070001@news.euro.net>
In article <61j9kf$me2$1@news.gate.net>, dsiebert@gate.net (David Siebert)
wrote:
> I am trying to sort an array of keys to out put to a file.
> this does not work. What will?
> foreach $key sort((keys %myerror)) {print FILE "$key\t$value"}
foreach (sort(keys %myerror)){
print FILE "$_\t$myerror{$_}\n";
}
--
Toutatis,
mailto:toutatis@toutatis.net
------------------------------
Date: 9 Oct 1997 18:59:47 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Text formatting question
Message-Id: <61j9j3$8i7$1@news.fm.intel.com>
Jarkko Juntunen (jarkko@avalon.merikoski) so eloquently and verbosely pontificated:
> Is it possible to make format which put names and addresses in fife columns
> like this:
>
> Name1 Name2 Name3 Name4 Name5
> Address1 Address2 Address3 Address4 Address5
> zip1 City1 zip2 City2 zip3 City3 zip4 City4 zip5City5
this is best done with format statements, but if you dont want to learn
about perl's more robust functions, this can be done with some simple
printf statements. you will have to build the lists yourself, and store
them some way. i suggest a hash of hashes. this would work if they were
stored in a %HoH with the first key being the recipient identifyers
(whatever that may be), and secondary keys of "name", "addr", "zip", and
"city".
this script produces *exactly* what you requested, but of course, yours
will need to be implementation specific.
#!perl -w
# this creates your example data. you will have to create it on your own.
for (1..5) {
$HoH{"rec$_"} = {
'name' => "Name$_",
'addr' => "Addr$_",
'zip' => "Zip$_",
'city' => "City$_"
}
}
# the % tells how to format the corresponding element of the list
# following your quoted string. in this example, '20' is the width, '-'
# means left justified, and 's' means ascii string.
$repeat = scalar(keys %HoH); # number of columns
printf "%-20s" x$repeat ."\n", map { "$HoH{$_}{'name'}" } sort keys %HoH;
printf "%-20s" x$repeat ."\n", map { "$HoH{$_}{'addr'}" } sort keys %HoH;
printf "%-20s" x$repeat ."\n",
map { "$HoH{$_}{'zip'} $HoH{$_}{'city'}" } sort keys %HoH;
__END__
> I'm just a newbie with perl and I don't even have my own Camel-book:-)
the camel book is an essential and fun book. i highly recommend it, since
you most likely wont understand any solutions offered without it. just
hold on to these suggestions so that when you have enough understanding of
perl, then they will be extremely helpful in forming your own unique
solution.
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
map{$;.=chr$_}(112,114,105,110,116,32,117,110,112,97,99,107,32,34,117,
34);$_=$;.=q>,':2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`'>;y[\034]{}d;eval
------------------------------
Date: Thu, 09 Oct 1997 14:21:22 -0700
From: Kevin Skelton <Kevin_Skelton@mgic.com>
Subject: Writing a file referenced by Server Name via CGI
Message-Id: <343D4AD2.2CA4@mgic.com>
Hi, I am using Win32 Perl on an NT server. I cannot seem to get on the
Win32 list so I am forced to ask my question here.
I have a Perl script which writes files to an NT server. Up until now I
have always used the drive letter for the reference (e.g.
C:/directory/directory2/filename.txt). But now I have to start writing
files to a different NT server located on a different machine.
I changed my Perl script to reference the machine name instead of the
drive letter and tested it via a Perl script from the command line:
open( OUTPUT, ">//ntserver01/files/filename.txt") die print "Cannot open
OUTPUT file";
...where //ntserver01/files = C:\files on another NT server.
This works fine from the command line but fails when executed in a CGI
script.
What is the difference? I even cannot reference my own server via a CGI
script to write the file. I have to use "C:".
I of course could mount a physical drive via NFS between the two servers
if I have to.
Anyone have any better ideas???
Kevin Skelton
MGIC
------------------------------
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 1153
**************************************