[9726] in Perl-Users-Digest
Perl-Users Digest, Issue: 3320 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 2 18:05:25 1998
Date: Sun, 2 Aug 98 15:00:22 -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 Sun, 2 Aug 1998 Volume: 8 Number: 3320
Today's topics:
Re: [Q]s on non-blocking system calls ("forks") (Ilya Zakharevich)
A redirect script - pull down - in frames info@gatman.NOSPAM.com
Re: A redirect script - pull down - in frames <rootbeer@teleport.com>
contract perl programmer wanted whawk@my-dejanews.com
DBD::DB2 - where? (Brian Blessed)
Re: File problems (Mark-Jason Dominus)
Re: hiding user input <sp@m.block>
Re: hiding user input (Michael J Gebis)
Re: hiding user input (Gary L. Burnore)
Re: hiding user input (Ronald J Kimball)
Re: hiding user input (Greg Andrews)
Re: hiding user input (Gary L. Burnore)
job need cgi/Perl script written <newart@shell11.ba.best.com>
Re: newbie split question <thomas@x-tekcorp.com>
Non-Standard Data File <webwide@writeme.com>
Re: Non-Standard Data File (Larry Rosler)
PerlScript in .ASP doesnt run in IIS4 <ian.taite.nospam@zen.co.uk>
printf behaviour (I think bug) <ank@tx97.orgland.ru>
Re: printf behaviour (I think bug) <rootbeer@teleport.com>
Re: printf behaviour (I think bug) (Larry Rosler)
Re: Programmer's Editor (OS 98) <worms2@centralnet.ch>
Q:Parsing file paths <dereks@fc.hp.com>
Re: Q:Parsing file paths <rootbeer@teleport.com>
Question: Select (Tom Rainey)
Re: Question: Select (Ronald J Kimball)
Re: What's the future of Perl? <jdporter@min.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Aug 1998 19:29:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: [Q]s on non-blocking system calls ("forks")
Message-Id: <6q2em4$pbs$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Andrew M. Langmead
<aml@world.std.com>],
who wrote in article <Ex2MIx.7oz@world.std.com>:
> k y n n <kj0@mailcity.com> writes:
>
> >Oh, wow! What a surprise. I didn't know that the exec'd process
> >retained the pid of the exec'ing script. (BTW, is this documented
> >anywhere?)
>
> Oh in about any book that explains the Unix programming environment,
> and the exec(2) man page.
Thus not true if not *nix. EMX environment (OS/2, DOS, Win*) does
some tricks so that fork()/exec() pair acts *as if* the exec()ed
process preserved the pid, but a plain exec() will do not tricks.
Ilya
------------------------------
Date: Sun, 02 Aug 1998 20:58:39 GMT
From: info@gatman.NOSPAM.com
Subject: A redirect script - pull down - in frames
Message-Id: <35c4d2d4.27202511@news-s01.ny.us.ibm.net>
Have been using a pull down menu with a redirect function for some
time (see below example). Now I need to use this so the redirected
directories (or specific pages) can be targeted to the main screen of
a framed layout.
Really be a help- Thanks
John Gattuso
info@gatman.NOSPAM.com
#!/usr/local/bin/perl -w
require("cgi-lib.pl");
&ReadParse(*input);
$basedir1 = "http://www.somedomain.com/";
######Directories below
@dirs =qw(dir1 dir2 dir3);
###############################
# Receive the customers choice and deliver the correct page
# The name=value pairs are
# wheretogo=goobers
# wheretogo=homers
# wheretogo=barneys
###############################
if ($input{'wheretogo'} eq "goobers") {
print "Location: $basedir1$dirs[0]\n\n"
} elsif ($input{'wheretogo'} eq "homers") {
print "Location: $basedir1$dirs[1]\n\n";
} else{ ($input{'wheretogo'} eq "barneys") {
print "Location: $basedir2$dirs[2]\n\n";
}
------------------------------
Date: Sun, 02 Aug 1998 21:31:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: A redirect script - pull down - in frames
Message-Id: <Pine.GSO.4.02.9808021430440.26301-100000@user2.teleport.com>
On Sun, 2 Aug 1998 info@gatman.NOSPAM.com wrote:
> Have been using a pull down menu with a redirect function for some
> time (see below example). Now I need to use this so the redirected
> directories (or specific pages) can be targeted to the main screen of
> a framed layout.
It sounds as if you want to output something which will tell a browser
which frame to use. The docs, FAQs, and newsgroups about the protocol
you're using should be able to help you. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 02 Aug 1998 18:06:05 GMT
From: whawk@my-dejanews.com
Subject: contract perl programmer wanted
Message-Id: <6q29qd$epd$1@nnrp1.dejanews.com>
Have immediate need for experienced perl programmer on contract basis for
short term projects; presently have approximately 50 hours work to do. If
interested please send brief experience along with rates.
Thanks
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sun, 02 Aug 1998 18:29:35 GMT
From: spider@ artifax.uk.eu.org (Brian Blessed)
Subject: DBD::DB2 - where?
Message-Id: <35c5afcc.12076050@nntp.netcom.net.uk>
Does anyone know what's happening with this module - it appears to
have been removed from all the major CPAN nodes.
Brian
------------------------------
Date: 2 Aug 1998 16:16:04 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: File problems
Message-Id: <6q2he4$oq$1@monet.op.net>
In article <35C3FF00.D5B827B7@saifun.com>,
Ophir Marko <ophir@saifun.com> wrote:
>aa b ccc d
>1 2 3 4
>
>aa......1
>b.......2
>ccc.....3
>d.......4
Maybe like this:
# Adjust these to suit yourself
$TOTAL_WIDTH = 9;
$FILL_CHAR = '.';
# Read the input
for (;;) {
# Read two lines
my ($keys, $values) = (scalar <>, scalar <>);
last unless defined $keys;
my @keys = split(/\s+/, $keys);
my @values = split(/\s+/, $values);
unless (@keys == @values) {
printf STDERR "Line %d has %d items, but line %d has %d items instead.\n",
$.-1, scalar(@keys), $., scalar(@values);
}
foreach $k (@keys) {
printf STDERR "Duplicate key: `$k' at line %d.\n", $.-1
if exists $h{$k};
}
@h{@keys} = @values;
last unless defined $values;
}
# Write the output
foreach $k (sort keys %h) {
my $v = $h{$k};
my $line = $FILL_CHAR x $TOTAL_WIDTH;
if (length($k) + length($v) >= $TOTAL_WIDTH) {
warn "Line with ($k, $v) does not fit.\n";
next; # Skip this pair. (Obviously, other actions are possible.)
}
substr($line, 0, length($k)) = $k; # Left-justify $k
substr($line, -length($v)) = $v; # Right-justify $v
print $line, "\n";
}
------------------------------
Date: Mon, 03 Aug 1998 03:16:01 +0900
From: Boiled Animal By-Products <sp@m.block>
Subject: Re: hiding user input
Message-Id: <35C4ACE3.48686576@m.block>
Gary L. Burnore wrote:
>
> On Sun, 02 Aug 1998 20:34:06 +0900, in article <35C44EAF.FCF6FD2C@m.block>,
> Spam Block <sp@m.block> wrote:
> >Suggestion: we need a FAQ which explains why it is abusive to respond to a
> >postingt in terms like "Are you thicker than shit or can't you just read?".
>
> That would be good. Unfortunately, new users won't know to use it to their
> defense.
Actually I intended this to be read by the "abusive experts" seeing as how
they can't seem to get to grips with the basics of human communication and
seem to base evrything on the reading or non of FAQs.
[going over to ABaigail's in the event she still wasn't getting the hint]
> Going to Abagails house wouldwould be a bad thing. USENet is NOT real life. Not
> even comp groups. Those who try to make it so live in a fantasy world all
> their own.
I was just kidding about going over to Abigail's house - I mean who would
really want to go - going by what she deems as acceptable social intercourse
she might shoot you dead on the welcome mat.
>
> I said what I said to Abagail in the manner I said it to try to draw attention
> to how rude it is to treat people that way. It got the attention it was
> intended to get. It's got to stop.
I agree with you here and with the tone and wording you used in your replies
to Abagail- infact I came on this thread through another set up by Abigail to
berate you (see luser is spelt loser)
> if you think how abigail and her ilk do it is fine, go to .moderated. If you absoulutly
> must have someone to flame, flame me. I can indeed take it and will be glad to dish it back if
> need be. Leave the new posters ALONE.
Or set up another news group, say comp.perl.do.not.post.if.you.have.not.read.the.faq.or.are.not.equipped.with.a.doctorate.in.the.subject.
Or even just not read any posting which is from somebody you don't know,
getting round the thorny prob of coming into contact with the plebs groping
their way through the trivialities of learning the basics, leaving
intellectual space free to consoder perl guru advanced pursuits like how to
casually mention Larry by his first name in your postings so it seems you drop
round his house for a coffee after a hard days slaving over your hand coded
unix OS or what's the flashiest way to make a simple function unreadable so
you can stick it on your postings as a signature
------------------------------
Date: 2 Aug 1998 18:37:51 GMT
From: gebis@noble.ecn.purdue.edu (Michael J Gebis)
Subject: Re: hiding user input
Message-Id: <6q2blv$dp7@mozo.cc.purdue.edu>
gburnore@databasix.com (Gary L. Burnore) writes:
}It's not proper USENEt etiquette to email someone over a
}USENet post without it being requested.
I still say you're making this one up.
http://www.cis.ohio-state.edu/hypertext/faq/usenet/usenet/posting-rules/part1/faq.html
http://www.templetons.com/brad/emily.html
I might add your other points regarding nettiquette are in agreement
with these documents and my own experience. But I've sent and received
thousands of e-mails regarding Usenet articles, and have rarely (if
ever) seen anybody get angry over the that mail was used. It seems
rather anti-social.
Perhaps the times are a changing and it's now less acceptable to use
mail. But it's news to me, and I think some forgiveness to those who
inadvertantly violate this would not be too much to ask.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Sun, 02 Aug 1998 18:54:23 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: hiding user input
Message-Id: <35c6b4eb.7678564@nntpd.databasix.com>
On 2 Aug 1998 18:37:51 GMT, in article <6q2blv$dp7@mozo.cc.purdue.edu>,
gebis@noble.ecn.purdue.edu (Michael J Gebis) wrote:
>gburnore@databasix.com (Gary L. Burnore) writes:
>}It's not proper USENEt etiquette to email someone over a
>}USENet post without it being requested.
>
>I still say you're making this one up.
I don't beleive I am. Besides, even IF it were incorrect, once asked to stop,
the emailer should stop. It's harassment otherwise and as far as I'm
concerned, it's harassment to post email to USENet.
>
>http://www.cis.ohio-state.edu/hypertext/faq/usenet/usenet/posting-rules/part1/faq.html
>http://www.templetons.com/brad/emily.html
>
>I might add your other points regarding nettiquette are in agreement
>with these documents and my own experience. But I've sent and received
>thousands of e-mails regarding Usenet articles, and have rarely (if
>ever) seen anybody get angry over the that mail was used. It seems
>rather anti-social.
>
>Perhaps the times are a changing and it's now less acceptable to use
>mail. But it's news to me, and I think some forgiveness to those who
>inadvertantly violate this would not be too much to ask.
If you email me and I send reply saying stay out of my email and you write
back and say "sorry for emailing you against your wishes" or "I meant to hit
followup but hit reply" or whatever, then yes, forgivness is warranted and
granted. But when you take said response and post it to USENet or as is the
case from a sequent.com poster/emailer, you continue to email saying things
like how you're so important to your company that I won't matter to them, then
NO. It's not warranted. It won't be granted.
--
for i in databasix primenet ; do ; gburnore@$i ; done
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH! | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3 3 4 1 4 2 ]3^3 6 9 0 6 9 ][3
spamgard(tm): zamboni | Official Proof of Purchase
===========================================================================
------------------------------
Date: Sun, 2 Aug 1998 15:00:48 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: hiding user input
Message-Id: <1dd52wq.16oklr53z4y80N@bay1-62.quincy.ziplink.net>
Gary L. Burnore <gburnore@databasix.com> wrote:
> It's not proper USENEt etiquette to email someone over a USENet post
> without it being requested.
I'm afraid you are mistaken on this point.
Date: Tue, 28 Jul 1998 08:00:18 GMT
Message-ID: <EwsowI.Kzq@tac.nyc.ny.us>
From: netannounce@deshaw.com (Mark Moraes)
Subject: Rules for posting to Usenet
Newsgroups: news.announce.newusers,news.answers
Archive-name: usenet/posting-rules/part1
Original-author: mark@stargate.com (Mark Horton)
Comment: enhanced & edited until 5/93 by spaf@cs.purdue.edu (Gene
Spafford)
Last-change: 16 Jan 1998 by netannounce@deshaw.com (Mark Moraes)
Changes-posted-to: news.misc,news.answers
[...]
Some newsgroups are intended for discussions and some for announcements
or queries. It is not usually a good idea to carry on discussions in
newsgroups that are designated otherwise. It is never a good idea to
carry on "meta-discussions" about whether a given discussion is
appropriate -- such traffic mushrooms until nobody can find articles
that belong. If you are unhappy with what some user said,
send him/her mail, don't post it.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[my emph]
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 2 Aug 1998 12:15:46 -0700
From: gerg@shell1.ncal.verio.com (Greg Andrews)
Subject: Re: hiding user input
Message-Id: <6q2dt2$iep$1@shell1.ncal.verio.com>
gburnore@databasix.com writes:
>
>True but not quite the point. Again, there's a difference between saying
>
>The answer is ... and it's in the faq.
>The answer can be found in the faq located at ...
>
>-or-
>
>Is something wrong with your eyes that you can't see the faq
>Is your brain dead because it's in the faq...
>
>That's the point. Those who've grown tired of answering questions and then
>abuse those asking should move on to something else. And yet again, I say, not
>all "Experts" in this group are jerks. The non-jerks answer questions and or
>point the poster to the faq without making comments that will chase them away.
>
Hi Gary,
All of the above points were made concerning your posts in several of the
netcom.* groups over the course of a couple of years. They didn't change
your behavior, which matched very closely, IMO, the behavior of Abigail's
which you've been criticizing.
I don't understand, Gary. It was acceptable when you did it, but not
when when Abigail does it? Or has time changed your mind about whether
curt responses to newbie questions are acceptable?
-Greg
------------------------------
Date: Sun, 02 Aug 1998 21:37:32 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: hiding user input
Message-Id: <35c5db8a.17567593@nntpd.databasix.com>
On 2 Aug 1998 12:15:46 -0700, in article <6q2dt2$iep$1@shell1.ncal.verio.com>,
gerg@shell1.ncal.verio.com (Greg Andrews) wrote:
>gburnore@databasix.com writes:
>>
>>True but not quite the point. Again, there's a difference between saying
>>
>>The answer is ... and it's in the faq.
>>The answer can be found in the faq located at ...
>>
>>-or-
>>
>>Is something wrong with your eyes that you can't see the faq
>>Is your brain dead because it's in the faq...
>>
>>That's the point. Those who've grown tired of answering questions and then
>>abuse those asking should move on to something else. And yet again, I say, not
>>all "Experts" in this group are jerks. The non-jerks answer questions and or
>>point the poster to the faq without making comments that will chase them away.
>>
>
>Hi Gary,
>
>All of the above points were made concerning your posts in several of the
>netcom.* groups over the course of a couple of years. They didn't change
>your behavior, which matched very closely, IMO, the behavior of Abigail's
>which you've been criticizing.
I do not consider netcom and comp groups to be the same thing. Nor alt groups
and comp groups. Comp groups are quite a different animal. Note that even the
two "you know who's" don't come treading into comp groups.
>I don't understand, Gary. It was acceptable when you did it, but not
>when when Abigail does it?
See above.
> Or has time changed your mind about whether curt responses to newbie questions are acceptable?
See above.
--
for i in databasix primenet ; do ; gburnore@$i ; done
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH! | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3 3 4 1 4 2 ]3^3 6 9 0 6 9 ][3
spamgard(tm): zamboni | Official Proof of Purchase
===========================================================================
------------------------------
Date: 2 Aug 1998 18:34:57 GMT
From: "newart@newart.com " <newart@shell11.ba.best.com>
Subject: job need cgi/Perl script written
Message-Id: <6q2bgh$g0o$3@nntp1.ba.best.com>
Need someone with Perl experience to write a text replacement script
for a directory of text files.
Please email adolf@newart.com if you are capable and would like to
earn some quick cash.
Thanks
------------------------------
Date: Thu, 30 Jul 1998 15:58:17 -0500
From: Thomas Rock <thomas@x-tekcorp.com>
Subject: Re: newbie split question
Message-Id: <35C0DE69.2D4B@x-tekcorp.com>
Charles Maier wrote:
> > open(MINN,"klaisjul2.txt") || die "no $!\n";
> >
> > while (<MINN>)
> > {
> > @list=split(/^/); # split up the fields
> > chomp(@list); # take the carriage return off
> > print $list[0],"\n"; # print out first field
> > }
> >
> > close(MINN);
>
>
> You must ESCAPE the caret in the split...
>
> @list=split(/\^/); # split up the fields
You might want to explain (since he's a newbie) that the split
pattern defined is a regular expression. The caret has a special
meaning in a regular expression, and that is to anchor the pattern
to the beginning of the line. So, you've specified that the line
should be split at the beginning - which it was!
You could also do:
@list=split('^');
which would get around the regular expression problem.
Have fun learning Perl!
--
Thomas Rock
X-Tek Corporation
www.x-tekcorp.com
------------------------------
Date: Sun, 02 Aug 1998 01:14:41 -0500
From: Glenn Dixon <webwide@writeme.com>
Subject: Non-Standard Data File
Message-Id: <6q2eol$pg4$1@news-2.news.gte.net>
Need help with non-standard data file. Either
A) transform into a standard data format, or
B) query it directly
This will eventually be queried via CGI and output to HTML on-the-fly.
The format is three pieces of data per line, several lines per
'record'.....the number of lines per record is NOT fixed (some have 5,
some have 9). Here's a sample of ONE record:
0 @I1@ INDI
1 REFN P1
1 NAME Glenn Edward /DIXON/
1 SEX M
1 BIRT
2 DATE 7 Jan 1961
2 PLAC Fort Worth, TX
1 FAMC @F3@
1 FAMS @F1@
1 FAMS @F2@
the first column is "0" at the beginning of each record....
so far I have managed to bring this into arrays pretty much duplicating
the existing structure, but I am rather new to Perl and am getting
stuck.......any ideas???
I *think* if it was in the following format it would work better:
P1,Glenn Edward Dixon,M,1/7/1961,Fort Worth,TX,CF3,SF1,SF2
again, I am in the middle of my Perl book, but I could use a good kick
start.....
--
Glenn E. Dixon
webwide@writeme.com.....http://home1.gte.net/webwide
glenn@thedixons.net.....http://thedixons.net
ICQ # 392271
------------------------------
Date: Sun, 2 Aug 1998 14:41:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Non-Standard Data File
Message-Id: <MPG.102e7cdc1a976dfe9897ab@nntp.hpl.hp.com>
In article <6q2eol$pg4$1@news-2.news.gte.net> on Sun, 02 Aug 1998
01:14:41 -0500, Glenn Dixon <webwide@writeme.com> says...
...
> 0 @I1@ INDI
> 1 REFN P1
> 1 NAME Glenn Edward /DIXON/
> 1 SEX M
> 1 BIRT
> 2 DATE 7 Jan 1961
> 2 PLAC Fort Worth, TX
> 1 FAMC @F3@
> 1 FAMS @F1@
> 1 FAMS @F2@
>
> the first column is "0" at the beginning of each record....
The easiest way is to read it one 'record' at a time, like this:
{ local $/ = "\n0 "; @records = <IN> }
This will strip the leading "0 " from each record but the first. You can
stick an empty line in at the beginning, so all records begin the same
way.
> I *think* if it was in the following format it would work better:
>
> P1,Glenn Edward Dixon,M,1/7/1961,Fort Worth,TX,CF3,SF1,SF2
You should be able to split the data fields out of the records in various
ways without having to reformat it like that. Use the 's' suffix on
regular expressions to match '.' across the new-lines in your 'records'
or the 'm' suffix to make '^' and '$' match at each of the new-lines.
See perlre for more on this. Or use split /\n/, ... for example
(perlfunc).
> again, I am in the middle of my Perl book, but I could use a good kick
> start.....
I hope it is a good book. The easy solution to your problem is to change
the 'input record separator' $/ as shown above, in order to define your
records as you wish. I don't know if introductory books deal with this
approach. You can read more about $/ in perlvar.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 02 Aug 1998 20:02:24 GMT
From: "Ian F Taite" <ian.taite.nospam@zen.co.uk>
Subject: PerlScript in .ASP doesnt run in IIS4
Message-Id: <kB3x1.153$c26.297221@news-reader.bt.net>
Cant seem to get the demo ASP files supplied with ActivePerl 5.005 working.
It's something to do with the "Default ASP Language" setting in IIS4. If I
change it from VBScript to PerlScript, none of the ASP files in the virtual
directory work. If left at VBScript, just those work. When for example, I
click the link to run Hello World (hello.asp) I just get the hour glass. Any
suggestions as how to fix this?
------------------------------
Date: 2 Aug 1998 18:51:05 GMT
From: "Andrey A. Kolotev" <ank@tx97.orgland.ru>
Subject: printf behaviour (I think bug)
Message-Id: <6q2cep$j1k@orgland.ru>
Hi!
Somebody know about perl printf behaviour (I think bug) with float numbers
format?
perl printf:
# command : perl -e '$a=137.035; $b=137.235; printf "%10.2f %10.2f\n",$a,$b'
# out:
137.03 137.24
# ^^^ - why?
gcc printf (libc)
-------------------------------
#include <stdlib.h>
int main (int argc, char ** argv)
{
float a = 137.035;
float b = 137.235;
printf ("%10.2f %10.2f\n", a, b);
exit (0);
}
-------------------------------
# command: a.out
# out:
137.04 137.24
----------------
some words about environment:
2.1-STABLE FreeBSD 2.1-STABLE
2.2.5-RELEASE FreeBSD
perl 5.004_04
perl 4.036
gcc version 2.7.2.1
gcc version 2.6.3
------------------------------
Date: Sun, 02 Aug 1998 21:05:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: printf behaviour (I think bug)
Message-Id: <Pine.GSO.4.02.9808021402120.26301-100000@user2.teleport.com>
On 2 Aug 1998, Andrey A. Kolotev wrote:
> # command : perl -e '$a=137.035; $b=137.235; printf "%10.2f %10.2f\n",$a,$b'
> # out:
> 137.03 137.24
> # ^^^ - why?
Here's something that my system does:
$ perl -e '$a=137.035; $b=137.235; printf "%10.2f %10.2f\n",$a,$b'
137.03 137.24
$ perl -e '$a=137.035; $b=137.235; printf "%.20f %.20f\n",$a,$b'
137.03499999999999658939 137.23500000000001364242
Does that answer your question? :-)
> float a = 137.035;
> float b = 137.235;
Of course, perl is using doubles internally, rather than floats. Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 2 Aug 1998 14:49:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: printf behaviour (I think bug)
Message-Id: <MPG.102e7edc95d7985e9897ac@nntp.hpl.hp.com>
In article <6q2cep$j1k@orgland.ru> on 2 Aug 1998 18:51:05 GMT, Andrey A.
Kolotev <ank@tx97.orgland.ru> says...
> Hi!
Sdrastvuitye!
> Somebody know about perl printf behaviour (I think bug) with float numbers
> format?
No bug. This is a frequently asked question, but I don't think it is in
the FAQ.
> perl printf:
>
> # command : perl -e '$a=137.035; $b=137.235; printf "%10.2f %10.2f\n",$a,$b'
> # out:
> 137.03 137.24
> # ^^^ - why?
Try replacing '%10.2f' by '%10.20f' and you should see the reason.
Internal binary representations of floating-point numbers are
approximations to their external decimal representations.
> gcc printf (libc)
> -------------------------------
> #include <stdlib.h>
>
> int main (int argc, char ** argv)
> {
> float a = 137.035;
> float b = 137.235;
>
> printf ("%10.2f %10.2f\n", a, b);
> exit (0);
> }
> -------------------------------
> # command: a.out
> # out:
> 137.04 137.24
Perl stores floats as doubles, so the internal representations are
different. If you replace 'float' by 'double' in your C test, you should
see the same results as Perl gets, for the same reason.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 02 Aug 1998 20:09:40 +0200
From: Thomas Volkmar Worm <worms2@centralnet.ch>
Subject: Re: Programmer's Editor (OS 98)
Message-Id: <35C4AB64.FAEF39B@centralnet.ch>
John Porter wrote:
>
> Gabor wrote:
> >
> > Michael J Gebis <gebis@fee.ecn.purdue.edu> wrote :
> > # P.S. I think a modern OS should have "98" somewhere in its name.
> >
> > So, what happens in 99? We need a new modern OS?
>
> Brings up a good point. As if there weren't already enough
> predisposition in our society toward the century error,
> the largest, most powerful software company in the galaxy
> has to go naming their products 95, 97, 98.
And it is the only OS where you find the first Year2000-Bug already in
the name.
Thomas
------------------------------
Date: Sun, 02 Aug 1998 21:33:58 +0000
From: Derek <dereks@fc.hp.com>
Subject: Q:Parsing file paths
Message-Id: <35C4DB46.D6F9FE7A@fc.hp.com>
Folks,
I have looked thru all the FAQs and man pages I can find.... Really!
I want to take a filename in a scalar and convert it to an absolute
pathname. It must know about the file system's naming conventions (i.e.
treat it differently depending on whether it begins with a /, etc.).
For now I've written a little routine that tests for a leading slash and
prepends the cwd if it is absent. I'm extending it to understand "."
and "..", etc. Unfortunately, my code is very unix-specific, and I was
wondering if a module already exists that does this in a way that is
always appropriate for the OS in use.
Note that I need it to process paths that do not (yet) exist, so it must
purely be a string manipulation function, not something that actually
looks at the filesystem.
Suggestions?
Derek.
------------------------------
Date: Sun, 02 Aug 1998 21:47:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q:Parsing file paths
Message-Id: <Pine.GSO.4.02.9808021446350.26301-100000@user2.teleport.com>
On Sun, 2 Aug 1998, Derek wrote:
> I want to take a filename in a scalar and convert it to an absolute
> pathname. It must know about the file system's naming conventions (i.e.
> treat it differently depending on whether it begins with a /, etc.).
> I was wondering if a module already exists that does this in a way
> that is always appropriate for the OS in use.
Does the File::Basename module do anything for you? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 02 Aug 1998 19:03:37 GMT
From: trainey@cs.utexas.edu (Tom Rainey)
Subject: Question: Select
Message-Id: <6q2cqn$tl$1@excalibur.flash.net>
Hello, I've been trying to get alittle deeper into perl lately and have been
dabbling with sockets (which i have a grasp on from before) ... I've been
reading and looking at example code and I can't get the hang of the select
command...
For example:
select((select(S), $| = 1)[0]);
Where S is a Socket (already bound and connected) ...
>From my previous experience (C) ... select provides asynchronous I/O by
allowing a process to wait for the first file descriptor in a certain set to
be ready... but I don't quite understand it in perl... From what i've read..
the code above selects the socket for input/output -> select(S) .. which we
then make unbuffered i/o with $| = 1 .... but i don't get the recursion of
it.. and the [0] ...
I wrote (mostly... with a couple examples from other perl code) a little
finger client cgi program (just to mess around and learn) which works.. but
that piece of code above I grabbed from an example and don't quite
understand it...
I'd appreciate any help
thanks
-Tom
trainey@cs.utexas.edu
------------------------------
Date: Sun, 2 Aug 1998 15:37:42 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Question: Select
Message-Id: <1dd54iq.1patlma1k1nyo1N@bay1-62.quincy.ziplink.net>
Tom Rainey <trainey@cs.utexas.edu> wrote:
> Hello, I've been trying to get alittle deeper into perl lately and have been
> dabbling with sockets (which i have a grasp on from before) ... I've been
> reading and looking at example code and I can't get the hang of the select
> command...
>
> For example:
> select((select(S), $| = 1)[0]);
>
> Where S is a Socket (already bound and connected) ...
>
> From my previous experience (C) ... select provides asynchronous I/O by
> allowing a process to wait for the first file descriptor in a certain set to
> be ready... but I don't quite understand it in perl... From what i've read..
> the code above selects the socket for input/output -> select(S) .. which we
> then make unbuffered i/o with $| = 1 .... but i don't get the recursion of
> it.. and the [0] ...
Check the perlfunc documentation please. Perl has two different select
functions. The one-argument select shown above selects a filehandle as
the default filehandle for print, and returns the previously selected
filehandle.
The other select function is the one you are familiar with from C; it
takes four arguments and checks for ready file descriptors.
And, to explain the code snippet:
select((select(S), $| = 1)[0])
This selects S, sets unbuffered output for S, and then selects the
originally selected filehandle.
(select(S), $| = 1)[0] is a two element list subscripted with [0]; the
first element is the previously selected filehandle (the return value of
select(S)), and the second element is 1.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 31 Jul 1998 14:33:16 GMT
From: John Porter <jdporter@min.net>
Subject: Re: What's the future of Perl?
Message-Id: <35C1D648.9A7@min.net>
Zenin wrote:
>
> Well, it also allows you to build your own interpreters that can
> be run as "#!/usr/home/joe/bin/my_interpreter".
You can do this in "normal" perl by putting the script on
the #! line:
#!/usr/bin/perl -w MyLangTerp.pl
;statements in MyLang...
--
John Porter
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3320
**************************************