[8957] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2575 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 12 21:07:29 1998

Date: Tue, 12 May 98 18:00:29 -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           Tue, 12 May 1998     Volume: 8 Number: 2575

Today's topics:
    Re: @array(@range) possible?? (Martien Verbruggen)
    Re: bug in win95 read/sysread? <trevor@cyberspc.mb.ca>
    Re: difficulty calling anonymous sub with params <rootbeer@teleport.com>
    Re: Does Perl have a IDE?I don't like command line. (Ilya Zakharevich)
    Re: Does Perl have a IDE?I don't like command line. <rra@stanford.edu>
    Re: Does Perl have a IDE?I don't like command line. <igor.k@usa.net>
    Re: Does Perl have a IDE?I don't like command line. (Mike Heins)
    Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
        Finding Open Client libs tpa@my-dejanews.com
    Re: How old is Perl? <davidv@hsa.com.au>
        How to call perlscript from IIS? <phengl@ir-optima.com>
        How to get a return value from stored procedure with Wi ender@mythen.ch
    Re: IPC::Open3 mem leak mayank@ibm.net
    Re: milliseconds (Martien Verbruggen)
    Re: password (Martien Verbruggen)
    Re: Perl as a compiled executable? (Martien Verbruggen)
    Re: Perl for Non-programmers (was Re: Does Perl have a  <monty@primenet.com>
    Re: Program to give day of the week from given date <rpsavage@ozemail.com.au>
    Re: Randomly sorting an array (Abigail)
    Re: Scanning Perl scripts for Y2K problems <merlyn@stonehenge.com>
    Re: Significant digit? (John Stanley)
    Re: Significant digit? (John Stanley)
    Re: Significant digit? (brian d foy)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 12 May 1998 23:54:03 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: @array(@range) possible??
Message-Id: <6janer$5vg$2@comdyn.comdyn.com.au>

In article <6j8e8q$qb$1@news.interlog.com>,
	Paul Griffith <paulg@pc350.griffith.ca> writes:
> I am trying he following example from "Perl in 21 Days" 

If that is really in the book, you should consider getting another
one. There might be a mention of it on
http://language.perl.com/critiques/index.html
If not, you might pick up some good titles from there.

> @subarray = @array(@range);

Use the right brackets:

@subarray = @array[@range];

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


------------------------------

Date: Wed, 13 May 1998 00:51:50 GMT
From: Trevor Cordes <trevor@cyberspc.mb.ca>
Subject: Re: bug in win95 read/sysread?
Message-Id: <3558EEE9.76192F0@cyberspc.mb.ca>

Jeffrey R. Drumm wrote:
> 
> I suspect that the differentiation between "text" and "binary" files on M$
> systems may be your culprit. Check out binmode() in your Perl documentation.

Thanks for the tips, folks.  I'll try it out.  There should be
some documentation or a note in the M$-capable distributions in
a prominent place.  I've read the camel book and programmed
perl on unix for 4 years and I would probably never have figured
out the solution without this help from the newsgroup.

Thanks!


------------------------------

Date: Wed, 13 May 1998 00:01:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "matthew d. p. k. lanier" <lanier@shell6.ba.best.com>
Subject: Re: difficulty calling anonymous sub with params
Message-Id: <Pine.GSO.3.96.980512165806.21974d-100000@user2.teleport.com>

On Tue, 12 May 1998, matthew d. p. k. lanier wrote:

> i see from the camel book that 
> &$subref(list)
> is valid, but what about when $subref is a more complex expression?

Enclose it in curly braces:

    &{ $anything_returning{a_coderef} }('some', 'parameters');

 ...or use 5.004's arrow-and-parens syntax:

    $something->{returning}->{a_coderef}->('some', 'parameters');

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 12 May 1998 23:57:21 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6janl1$b66$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Christiansen 
<tchrist@mox.perl.com>],
who wrote in article <6jahr8$3d2$1@csnews.cs.colorado.edu>:
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, 
>     ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> :You are discussing the *fact* that Perl
> :documentation *cannot be made* easily available on *nishish systems.
> :Why discuss this fact?  No discussion will fix it.

> Ilya, you are absolutely, irrevocably full of it.  I do not accept your
> premise, and thus your conclusion is irrelevant.  Why must you continue
> to spread these horrid lies?  The documentation is easy to find and
> use and navigate, and those for whom it is not should not be here.

Aha, just because you say so!  Go over your other responses in this
thread:

> :Yes, I use it - _when I am using a UNIX system_. When I use a Macintosh,
> :I use MacPerl. And I would like this functionality in MacPerl.

> Why are you holding others responsible for your choice of a
> tool-challenged system?

You do not get it: it is *nix which is tool-challenged.  You remind me
my reaction to people telling me that my first drafts of my first
papers were unreadable:  "I know they are readable, I can read them!".

The fact that you can find most the things you need in the docs is
absolutely irrelevant.  Listen to what people say: time to time what
they say may be true.

We all know that you love *nix.  Do not let your love obstruct the
facts that while most *nixish things are lovely indeed, some others
are not.

Ilya


------------------------------

Date: 12 May 1998 16:53:39 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <m3n2cnt5a4.fsf@windlord.Stanford.EDU>

Birgitt Funk <birgitt@order.booktraders.com> writes:

> So, I repeat my question, can Perl be the first programming language to
> learn programming with or not ?

Given that one of the major strengths of Perl is that it's a glue language
that ties together all sorts of programming constructs from other
languages, I think it would make an extremely poor first language.  Much
of the convenience syntax and TIWTOWTDI involved in Perl is designed for
the *experienced* programmer who isn't going to get confused just because
things work differently in one place than in another because he or she
realizes that the language is doing what is usually wanted.

I'd really recommend that the beginner learn Pascal, C, and LISP, and
probably have at least some sed, awk, or sh background, and *then* tackle
Perl.

> There a nonprogramming programming students who want to learn
> programming and use Perl as their first programming language.

I think they're misguided.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: Tue, 12 May 1998 17:05:04 -0700
From: "Igor Krivokon" <igor.k@usa.net>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6janu0$2jc$1@news.ncal.verio.com>

Michael J Gebis wrote in message <6jadad$65k@mozo.cc.purdue.edu>...
>Programming languages are not an everyday thing, but help systems
>should be.  Perldoc is an oddity for non-unix programmers.  They can
>understand it, but it clashes, and will continue to be ignored
>forever.


Or this way:

"Non-unix programmer" is an oddity for unix programmers.
They can understand it, but it clashes, and will continue to be 
ignored forever.

Well, good IDE help systems usually work faster then unix-grep-man-method, 
require less keypresses, their pages are nicely formatted, etc. But who cares.
The topic seems to be irrelevant. Perldoc, command-line globbing, whatever.
There are two ways to do "any_your_job": unix way and improper way.

;-) 

Igor Krivokon
<igor.k@usa.net>

---
"Unix is like a toll road on which you have to stop every 50 feet to
pay another nickel.  But hey!  You only feel 5 cents poorer each time"
                                                         -- Larry Wall




------------------------------

Date: 12 May 1998 20:25:54 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <3558e892.0@news.one.net>

Igor Krivokon <igor.k@usa.net> wrote:

> Well, good IDE help systems usually work faster then unix-grep-man-method, 
> require less keypresses, their pages are nicely formatted, etc. But who cares.
> The topic seems to be irrelevant. Perldoc, command-line globbing, whatever.
> There are two ways to do "any_your_job": unix way and improper way.

Can you give me an example?  I hope you aren't saying RTF and Windows
Help qualify there. They always seem to give me bite-size chunks instead
of real meat.

I have learned as much from finding what I wasn't looking for as
what I was. That is why my first stop in any new endeavor is the FAQ.
If I don't read the whole thing, I at least scan the titles and read
the intro section.

It would be so limiting to only follow a set of scripted topics.

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
"The U.S. Senate -- white           131 Willow Lane, Floor 2  | ||  _ \
male millionaires working           Oxford, OH  45056         | || |_) |
for YOU!" -- Dave Barry             <mikeh@minivend.com>     |___|  _ <
                                    513.523.7621 FAX 7501        |_| \_\


------------------------------

Date: 13 May 1998 00:25:19 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jap9f$enu$1@csnews.cs.colorado.edu>

In comp.lang.perl.misc, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
:it is *nix which is tool-challenged.  

Orwell was here.

--tom
-- 
    "If it makes goo on the windshield, we'll call it a bug." --Larry Wall


------------------------------

Date: Wed, 13 May 1998 00:28:20 GMT
From: tpa@my-dejanews.com
Subject: Finding Open Client libs
Message-Id: <6japf3$l0i$1@nnrp1.dejanews.com>

I was hoping to get a clarification on how a Perl module actually finds the
library it is calling. Specifically, in a Perl 5 script on SunOS, I'm trying
to use the Sybase Open Client libs using the below Sybperl module, I state:

use Sybase::DBlib.pm;

I know where this module exists, but I'm unclear on how my program finds the
Sybase Open Client C libraries. My understanding is that these libs are
dynamically linked in Perl 5, compared to the old "sybperl" executable that
identified the Sybase libs at compilation time. How does my perl script know
how to find these Sybase libs? I don't see any path information leading to the
SYBASE dirs.

I'm not very familiar with Exporter or DynaLoader, but I think that may be
where the answer lies.

To put this in context, we are trying to determine which Sybase libs are being
used by our Perl 4 and 5 apps. The older Sybase Open Client libs have Y2K
compliance issues, and we are afraid that some of our perl executables may
have been compiled using these old libs.

Any help is appreciated.

tpa

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


------------------------------

Date: 13 May 1998 10:08:15 +1000
From: David A Vincent <davidv@hsa.com.au>
Subject: Re: How old is Perl?
Message-Id: <q267jbnic0.fsf@hsa.com.au>


Concerning 'cow orker'...

jobst@senna.eng.monash.edu.au (Jobst Schmalenbach) writes:

> John Beadles <beadles@nortel.com> writes:
> 
> >Rosemary I H Powell wrote:
> >> 
> >> In article <355381E6.1BAD95E4@nortel.com>, John Beadles
> >> <beadles@nortel.com> writes

[...]

> >> >OK, so know we know what a pumpkin is.  What I want to know is what is
> >> >a  cow orker?
> >> >
> >> >Come to think of it, maybe I don't want to know after all... ;-)
> >> Yes you do - it's someone who orkes cows. Obviously.
> >> :-)
> >> Rosemary,

That should really be 'someone who orks cows'.  

[stuff removed... Jobst again]

> From the Shorter Oxford:
> 
> ork: [In sense I f FR: orque (hell) IT: orco (demon) ...]
>      1: Any of the various fericious sea creatures
>      2: A devouring monster 
> 
> 
> so it must be a cow monster???

A cow ork might be a cow monster.  For cow orker, try cow monsterer.  


 ...dav
-- 
David A Vincent   <mailto:davidv@hsa.com.au>    JUNK E-MAIL NOT WELCOME
Working (not speaking) for      Hydrographic Sciences Australia Pty Ltd
HSA phone extension number 27    within HSA, web site <http://marilyn/>
GCS C++++$ US++$ P+$ E++$ W++ N+++ w--- M++ Y+ PGP+ t-- G e++ h--- b+++


------------------------------

Date: 13 May 1998 00:32:58 GMT
From: "Pheng Lay" <phengl@ir-optima.com>
Subject: How to call perlscript from IIS?
Message-Id: <01bd7e06$76a26660$1f90d9cf@pheng-lay>

I'm using the IIS that come with NT 4.0 and have installed Perl interpreter
build 316 (PISEi316.exe) from ActiveState.com.  I can run perlscript find
through the command line, but I could not get IIS to run the perlscript and
display its output to the browser.  The whole intent is to have Java Applet
call the Perlscript to open the SQLany50 database.  I would really
appreciated if anyone can help with resolve this issue.  Thank You.

		phengl@ir-optima.com



------------------------------

Date: Tue, 12 May 1998 23:55:00 GMT
From: ender@mythen.ch
Subject: How to get a return value from stored procedure with Win32::ODBC?
Message-Id: <3558ca91.11183310@news.unisource.ch>

Hi All

I try to get a return value from a stored procedure with Win32::ODBC
from a Sybase SQL Anywhere database server. I have no problems with
select statements but now I try to call the following statement to get
the return value from the stored procedure AddWWWUser:

CREATE VARIABLE returnval INT ;
returnval = Call
AddWwwUser('test','test','test','test','test','test','test','test','test','test')
;
SELECT returnval ;
DROP VARIABLE returnval ;

This works fine in ISQL but if I try to Call it with Win32::ODBC as a
single statement I get the error: Syntax error near ';'

If I call this four statements in this way:

use Win32::ODBC;
 $DB = new Win32::ODBC("DSN=$dsn;UID=$uid;PWD=$pwd");
$DB->Run($sqlstmt1);
$DB->Run($sqlstmt2);
$DB->Run($sqlstmt3);
$dbdata = $DB->Data;
$DB->Run($sqlstmt4);
$DB->Close();

I get the error: column returnval not found.

Is there an easier way to get the return value or does anyone know how
to get this statement working?

many thanks 

Josi


------------------------------

Date: Wed, 13 May 1998 00:12:40 GMT
From: mayank@ibm.net
Subject: Re: IPC::Open3 mem leak
Message-Id: <6jaoho$ji4$1@nnrp1.dejanews.com>

Correction in script:  I hadn't put in the waitpid() in my previous post --
but there still appears to be a memory leak.

-Mayank

> open3_test
> -----------------------------------------
> #!/usr/local/bin/perl5
>
> use IPC::Open3;
>
> while (1)
> {
>     $pid = open3(\*WTR, \*RDR, \*ERR, "prog");
>     print WTR "Hello\n";
>     print "WRITER fileno: ", fileno(WTR), "\n";
>     close WTR;
>
>     print "READER fileno: ", fileno(RDR), "\n";
>     print "ERROR fileno: ", fileno(ERR), "\n";
>     while (<RDR>) {
>         print "Reader: $_";
>     }
>     while (<ERR>) {
>         print "Error: $_";
>     }
>     close RDR;
>     close ERR;
>     waitpid ($pid, 0);
>     system ("ps -o command,rssize,nswap -A | grep open3_test | grep -v
grep");
>     # that works for DEC OSF v 3.2; different commands on different OS's to
>     # get size in memory
> }
>
> prog
> --------------------------------
> #!/usr/local/bin/perl5
>
> $_ = <STDIN>;
> print "STDOUT: $_\n";
> warn "STDERR: $_\n";
> exit 0;
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


------------------------------

Date: 12 May 1998 23:57:14 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: milliseconds
Message-Id: <6jankq$5vg$3@comdyn.comdyn.com.au>

In article <355803E1.EC892F5@eto.ericsson.se>,
	Atle Raestad <etoatr@eto.ericsson.se> writes:
> Is it possible to measure in milliseconds in perl. "time" returns
> seconds and "times" returns CPU times. I want a function like time, that
> return the value in millisecond instead of seconds.

# perldoc perlfaq8
/How can I measure time under a second?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd.       | network - Mitchell Kapor
NSW, Australia                      | 


------------------------------

Date: 12 May 1998 23:50:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: password
Message-Id: <6jan8b$5vg$1@comdyn.comdyn.com.au>

In article <6j8eib$7ot$1@netnews.upenn.edu>,
	miuwong@blue.seas.upenn.edu (Miu Alex Wong) writes:
> 
> hi,
> 
> I need to have users type in their telnet account login name and passwd 
> on the web and check them against the master password file see whether they
> have typed in the correct one, is there any way to do that.

Hmm. You do realise that unless you use the right dort of connection,
which uses some sort of encryption, that this is unsafe, right? But
that is a discussion for one of the comp.infosystems.www.* groups, and
maybe some of the security groups.

If you're asking if you can check a user code and password against the
system's idea of a user code and password in perl, you might want to
have a look at the getpwnam function. Note that on some systems you
won't get useful information back in the passwd field for all or even
any users.

You will also need to have a look at crypt() to encrypt the password
you get.

# perldoc -f getpwnam
# perldoc -f crypt

Something like the following might do:

#!/usr/local/bin/perl -w
use strict;

# These are what you get from your user

my $user = 'username';
my $pass = 'password';

my @pwent = getpwnam($user) or die "Couldn't get pwent for $user";
my $cr_pass = crypt($pass, $pwent[1]);
if ($cr_pass eq $pwent[1])
{
    print "pass matches for $user\n"
}
else
{
    print "pass doesn't match for $user\n"
}

Once again: I urge you strongly to have a look into how insecure this
all is.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


------------------------------

Date: 12 May 1998 23:58:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl as a compiled executable?
Message-Id: <6janne$5vg$4@comdyn.comdyn.com.au>

In article <3558529C.F3CFBFB4@mediaone.net>,
	Robert Young <robyoung@mediaone.net> writes:
> passme
> approve

What? What does that mean?

> I want to hide a portion of my distributed script.  I head that it is
> now possible to save your Perl scripts as a compiled executable.  Does
> anyone know where I can find out about this?

# perldoc perlfaq3
/How can I hide the source for my Perl program?
/How can I compile my Perl program into byte code or C?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Advertising:  The science of arresting
Commercial Dynamics Pty. Ltd.       | the human intelligence long enough to
NSW, Australia                      | get money from it.


------------------------------

Date: 12 May 1998 17:02:00 -0700
From: Jim Monty <monty@primenet.com>
Subject: Re: Perl for Non-programmers (was Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6janto$78r@nntp02.primenet.com>

Tom Christiansen <tchrist@mox.perl.com> wrote:
> [...] Certainly the crux of becoming a programmer is developing the
> algorithmic mentality. Worrying about memory management, strong typing,
> and other idiocies interferes with that process.

Amen!

I'm a non-programmer who uses awk to solve computer-based problems and,
thereby, get paid. I've tried several times to learn Perl, but because
I've never really used it to solve problems, I've never really learned
it, either. My life is made miserable by two profound regrets: (1) I
quit school (in 1981) and never earned a college degree; and (2) despite
innumerable attempts, I have never been able to "develop the algorithmic
mentality" (i.e., become a true computer programmer). Never mind Regret
Number One. About Regret Number Two...

I've been taught the C programming language, and I've been taught
programming (algorithms, data structures, computational complexity, etc.)
using C. I've failed to grasp either, in part because the teaching was
atrocious, but mostly because I never mastered the subtleties of the C
language well enough to understand the examples of algorithms and
data structures in the textbooks. The books always seemed to presume
that the reader already knew the material. My mathematical foundation
is weak, I admit. (I've gotten as far as college algebra--no calculus
or statistics.)

Alas, my question: Is it reasonable to expect to be able to learn
computer programming on my own using Perl5? Obviously, I'm talking
about learning more than just how to write the "hello, world" program
in Perl. Are there resources available (books, tutorials, non-University
classes, etc.) that I could use to learn computer programming with Perl5
as the language? Are there others like me who suffer this same
frustration?

(Sorry for this off-topic, angst-ridden plea. But your words, Tom,
really struck a chord!)

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


------------------------------

Date: Wed, 13 May 1998 10:21:12 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Program to give day of the week from given date
Message-Id: <3558D968.2D9@ozemail.com.au>

Hari Patel wrote:
> 
>     Does anybody know how to output day of teh week for a given date in
> perl

Mike Stok & Tkil have answered, I know.
As background, tho, the name of this function is Zeller's 
Congruence.
Check a good book on algorithms.

-- 
Cheers,
Ron Savage
Office: savage.ron.rs@bhp.com.au
Home (preferred): rpsavage@ozemail.com.au
Web: http://www.ozemail.com.au/~rpsavage


------------------------------

Date: 13 May 1998 00:01:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Randomly sorting an array
Message-Id: <6jansc$pei$8@client2.news.psi.net>

Tom Rokicki (rokicki@cello.hpl.hp.com) wrote on MDCCXV September MCMXCIII
in <URL: news:6jalh9$40m@cello.hpl.hp.com>:
++ Of course, us happy folks just use
++ 
++    @b = map{$_->[1]}sort{$a->[0]<=>$b->[0]}map{[rand,$_]} @a ;

Which is Omega (N log N).

++ And if you're still using random numbers with only 32 bits of state, well,
++ I guess there's not much we can do to help you.

128 bits of state lets you shuffle 34 elements. You would need 
226 bits of state to shuffle a deck of cards and have a chance
of all permutations coming up.




Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


------------------------------

Date: Wed, 13 May 1998 00:43:03 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Scanning Perl scripts for Y2K problems
Message-Id: <8cra1z6lxu.fsf@gadget.cscaper.com>

>>>>> "Bart" == Bart Lateur <bart.mediamind@tornado.be> writes:

Bart> localtime() Y2K compliant? Yeah, right. Calculating years since 1900 is
Bart> dubious, to say the least.

Uh?  Huh?  Maybe dubious to you.  Not at all dubious to me.

Or are you saying that anything that references Unix Epoch (seconds
since jan 1, 1970) is *also* dubious because it has a basepointer
that's not the year 0?

I'm just not following.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 111 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


------------------------------

Date: 13 May 1998 00:20:25 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Significant digit?
Message-Id: <6jap09$s4q$1@news.NERO.NET>

In article <6jalpa$pei$2@client2.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>1200 is 4 significant digits. Try:

1200 has 2 significant digits. 1200. has 4.





------------------------------

Date: 13 May 1998 00:21:27 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Significant digit?
Message-Id: <6jap27$s52$1@news.NERO.NET>
Keywords: from just another new york perl hacker

In article <comdog-ya02408000R1205981706180001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>why don't we take this over to clp.modules.  i'll post an initial
>module to deal with getting the number format right, and then we
>can talk about operations on those numbers.  (and give me some time
>to fetch my chemistry book - those log() operations can be tricky :)

Please make sure you handle trailing zeros properly.



------------------------------

Date: Tue, 12 May 1998 20:49:59 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Significant digit?
Message-Id: <comdog-ya02408000R1205982049590001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6jalpa$pei$2@client2.news.psi.net>, abigail@fnx.com posted:

>brian d foy (comdog@computerdog.com) wrote on MDCCXV September MCMXCIII
>in <URL: news:comdog-ya02408000R1205981405590001@news.panix.com>:
>++ In article <Pine.GSO.3.96.980511164241.21974b-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> posted:
>++ 
>++ >On Mon, 11 May 1998, Yong Huang wrote:
>++ >
>++ >> Did somebody write code to extract significant digits out of a number?
>++ >
>++ >The FAQ talks about this. Hope this helps!
>++ 
>++ actually, i think the problem is a different one than printing a number
>++ with the appropriate number of digits.  for instance, the number 1234 to
>++ two significant digits is 1200.  the conventional use of sprintf and 
>++ friends won't help this.  it looks like it's a problem in rounding, but
>++ it's a bit more involved.
>
>1200 is 4 significant digits. Try:

1200 is only two significant digits.  to make that four significant
digits, one must add the decimal point to make it "1200.", which
resolves the (perceived) ambiguity.  this is the normal convention for
the physical or chemical sciences, and that's the problem at hand.

1200 written in scientific notation is, as you show

>     $ perl -we 'printf "%.2g\n", 1234'
>     1.2e+03

however, "1200." written in scientific notation is

   1.200e+03

like i said before, printf and friends do not solve this problem.  the
number of digits that you see is not necessarily the same as the number
of significant digits, and neither perl nor the underlying C library has
anyway of knowing about this.  one of the gotchas is that printf will
strip off trailing zeroes, and, if there is no digit to the right of the
decimal point, it removes the decimal point.  both of these preclude the
use of this function when dealing with a number with significant digits
since the following ARE NOT equivalent, although they are formatted 
the same by printf() et alia:

   12.
   12.0
   12.00

each of those numbers denote a different precision of measurement.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
don't get a chemist started on sig figs.


------------------------------

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 2575
**************************************

home help back first fref pref prev next nref lref last post