[12507] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6107 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 23 11:13:26 1999

Date: Wed, 23 Jun 99 08:00:20 -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           Wed, 23 Jun 1999     Volume: 8 Number: 6107

Today's topics:
    Re: 2 simple (not to me tho) questions (Larry Rosler)
    Re: About perl books (brian d foy)
    Re: aut et vel (Philip 'Yes, that's my address' Newton)
    Re: Can I do this?  Conditional Operator construct.... (Philip 'Yes, that's my address' Newton)
    Re: Credit Card Validator ? (brian d foy)
    Re: Cure for document deficiency <bradw@newbridge.com>
    Re: Does Perl have a future? (brian d foy)
    Re: Does Perl have a future? (brian d foy)
    Re: Exit values on NT, and run via AT <mwood@mhw.ULib.IUPUI.Edu>
    Re: Help - PERL - DBI install johnbishop@atl.mediaone.net
        How do you use XML Modules with ActiveStatePerl? <utbob@hotmail.com>
        Indian perl group dejapradeepk@my-deja.com
    Re: Newbie- foreach $var (keys %fields) - Outputs in wr (Tad McClellan)
    Re: Newbie- foreach $var (keys %fields) - Outputs in wr <khan@arcom.com.au>
    Re: NT - Server Up time <gellyfish@gellyfish.com>
        Running simple perl scripting <chris.cox@icl.com>
    Re: Statistics for comp.lang.perl.misc (J. Moreno)
    Re: Summing an array <jcreed@cyclone.jprc.com>
    Re: time question (Paul David Fardy)
    Re: time question (Larry Rosler)
        Using ROLLBACK() w/ DBI Module <jackie.stock@2jhuapl.edu>
        Variable Mulitdimensional Array (David Bultman)
    Re: Variable Mulitdimensional Array <cschmitz@stud.informatik.uni-trier.de>
        Viral matters [completely off-topic] <tchrist@mox.perl.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 23 Jun 1999 07:25:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <MPG.11da8e4edb7c938a989c2e@nntp.hpl.hp.com>

In article <iux4sjzqplf.fsf@in-csg58.uk.jpmorgan.com> on 23 Jun 1999 
09:38:04 +0100, Olivier Dehon [8026867] <odehon@in-
csg58.uk.jpmorgan.com> says...
> Tom Christiansen <tchrist@mox.perl.com> writes:
> 
> > They aren't harmless, you know.  Double quoted compose a
> > *brand*new*string*.  This isn't necessarily what you always want.
> 
> What about double-quoted strings where no interpolation is needed?
> Is that a bad practice and should one use single quotes instead?

I am in the 'foo' "bar\n" "" camp, as others have said.

> Or is the perl compiler/interpreter clever enough to not try and
> interpolate a constant string at run-time?

If one is concerned about the cleverness of the perl 
compiler/interpreter re q-quoted vs qq-quoted strings, one should be 
much more concerned about its cluelessness re qw-quoted strings.  qw( 
foo bar baz ) is processed as split('', ' foo bar baz ') AT RUN TIME!  
So don't use it inside a tight loop.

This is an acknowledged performance bug, which might get fixed some day.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 23 Jun 1999 09:48:17 -0400
From: brian@pm.org (brian d foy)
Subject: Re: About perl books
Message-Id: <brian-ya02408000R2306990948170001@news.panix.com>

In article <7kq09m$7tc$1@usenet01.srv.cis.pitt.edu>, fmgst+@pitt.edu (Filip M. Gieszczykiewicz) posted:

> Does purchase of the O'Reilly series of books on perl (ie. camel books)
> help in the development of perl?

certainly.  almost any O'Reilly technical book is helpful.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Wed, 23 Jun 1999 14:54:12 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: aut et vel
Message-Id: <3770b4c8.63709755@news.nikoma.de>

On 22 Jun 1999 17:30:06 -0700, Tom Christiansen <tchrist@mox.perl.com>
wrote:

>They have both an inclusive and an exclusive "or" in their language,
>after all. :-)

Forgive my sorely lacking classical upbringing, but:

Which of "aut" and "vel" is which of "inclusive or" and "exclusive
or"?

Cheers,
Philip

Still wondering whether any language differentiates between inclusive
and exclusive we. Would come in useful sometimes.
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Wed, 23 Jun 1999 14:54:13 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Can I do this?  Conditional Operator construct....
Message-Id: <3770b645.64091008@news.nikoma.de>

On Wed, 23 Jun 1999 01:40:18 GMT, portboy@home.com (Mitch) wrote:

>I'm trying to use the format for "Conditional Operator" of TEST_EXPR ?
>IF_TRUE_EXPR : IF_FALSE_EXPR
>
>This works fine, but my question is...Can I do this?
>
>TEST_EXPR ? $some_value = 1; $other_value =0 : IF_FALSE_EXPR
>                                                    ^
>I don't seem to be able to do this...Is there a way of accomplishing
>this in this type of format?

Remember that IF_TRUE_EXPR needs to be an *expression*; you have two
*statements* there instead. Use the comma operator to turn the two
sub-expressions into one expression or do { ... } to make an
expression out of the statements, as Larry proposed.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Wed, 23 Jun 1999 09:46:53 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Credit Card Validator ?
Message-Id: <brian-ya02408000R2306990946530001@news.panix.com>

In article <7kqde4$f04$1@times.colloquium.co.uk>, "Webmaster" <webmaster@NOSPAMweb-design.org.uk> posted:

> Hi there I'm looking for a Credit Card Validator, that will validate the
> card number AND the expiry date.
> 
> Matt Script Archive works for the card number but I can't get the fix to
> work for the expiry date.

you need a merchant account for that sort of thing.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: 23 Jun 1999 09:23:59 -0400
From: bj <bradw@newbridge.com>
Subject: Re: Cure for document deficiency
Message-Id: <op1lndbvymo.fsf@newbridge.com>

abigail@delanet.com (Abigail) writes:

> Uri Guttman (uri@sysarch.com) wrote on MMCXIX September MCMXCIII in
> <URL:news:x7r9n68x72.fsf@home.sysarch.com>:
> ## 
> ## tom c. reciting the perl docs on tape or cd.
> 
> In English, Spanish, French, German and Portuguese!
> 
> 
> [Batteries not included]
> [Void were prohibited]
> [Costs more in Canada]

Ouch

> [5c value in DE]

I can do Canadian... and once that is done the CRTC will probably get
the CBC radio to play it as a miniseries since they are so desperate
for Canadian content, plus we could probably get a grant... :-)

bj
k


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

Date: Wed, 23 Jun 1999 09:27:55 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Does Perl have a future?
Message-Id: <brian-ya02408000R2306990927550001@news.panix.com>

In article <37709ABB.5FC3501@ericsson.com>, Matt Sergeant <matt.sergeant@ericsson.com> posted:

> Along with the points others have made, I think the core issue is
> mod_perl for ISP's for people uploading their own scripts. I don't think
> it's really a viable proposition, because there are certain things you
> need to consider:
> 
> A badly written mod_perl script can bring a server to it's knees.

i've written lots of bad mod_perl and have yet to see Apache
crash because of it.  i'd be interested in any situations you've
found where Apache is vulnerable.  i know several ISPs which allow
mod_perl and this issue has never come up when i've talked to their
server gurus.

but to be fair, a badly written CGI script can bring a system (not
just the server, to its knees.  i just dealt with a client who 
had so many wierd things going on in a CGI script that in a short
time a gigabyte of error messages in the error log filled up the
disk.

bad programming is bad in any domain.

> mod_perl scripts run under the same permissions as the web server,
> unlike a properly wrapped CGI script on an ISP's server (e.g. mine run
> under my own user account's permissions, so I can't destroy other
> people's web space).

there's a tradeoff there because something running under your UID
can stomp on *your* data, whixh is even worse.  there are pitfalls
on both sides of that.

> Module updates (*.pm files) require a server restart

not if the server is configured well, such as using Apache::StatINC.

> One option it to persuade your ISP to allow you to run a separate httpd
> on another port that runs mod_perl, and have mod_rewrite redirect all
> mod_perl requests to your separate server.

this would be a good idea despite the dubious nature of your
comments.  there is a lot more power available via mod_perl when
one can tweak the server at will.  having a mod_perl configuration
that will please everyone is quite a challenge.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Wed, 23 Jun 1999 09:42:26 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Does Perl have a future?
Message-Id: <brian-ya02408000R2306990942260001@news.panix.com>

In article <Pine.GSO.4.02A.9906221735570.1698-100000@user2.teleport.com>, Tom Phoenix <rootbeer@redcat.com> posted:

> On Tue, 22 Jun 1999, Joe Chan wrote:
> 
> > Hi, I was asking in my ISP's cgi newsgroup about the possibility of
> > installing mod_perl. This is the reply I got from another user
> > 
> > There are a number of downsides to doing this:
> > 1) Memory usage. The Apache process can take up large amounts of
> > memory if a lot of different modules are requested and a lot of
> > different scripts are run.
> 
> Yes. If you don't use Apache and mod_perl, other ways of handling these
> requests can also take up large amounts of memory. 

memory is not that expensive. :)  it's not really a fair statement
because that memory is going to be used by the CGI scripts too,
even though not continously.  i forget where i saw this adage:

   free memory is wasted memory


> > 2) A lot of scripts use global variables. Since there is effectively
> > only one copy of Perl running, any global variables set by a script
> > are available to other scripts and scripts that don't bother
> > initialising their global variables will start off with the wrong
> > values.
> 
> I'm not certain that whoever said that really understood what they were
> talking about wrt Apache/mod_perl. Check the mod_perl Guide for more info.

no, i agree with the original comment, and there is even a mod_perl
man page devoted to this.  a lot of CGI scripts are poorly written in
a traditional sense because there is not a compelling need to be as
careful as one should with issues such as global variables.  

the trick is to not port your old stuff to mod_perl.  if it is 
working, leave it alone.  do new stuff in mod_perl.  if you have 
time, slowly port old stuff to mod_perl.  


> > 3) Configuration. It is actually quite difficult to set this up to
> > work efficiently.
> 
> Based upon the number of sites which have set this up properly, I'd say
> this one is refuted. But the Apache site has info on tuning for better
> performance.

the new mod_perl book for O'Reilly does a lot to help with this
as well.  however, any good sysadmin should be reading the instructions
and following directions.  it's not difficult to install mod_perl
if one follow's instructions.

as far as using the API, well, if you want ease of use, use sone
pointy-clicky thing that makes all sorts of assumptions for you.  if
you want power, you're going to have to learn how a web server works
so you can hook into the API.  that's where the cool stuff happens.

> > 4) Development. Because a script is cached by the process you cannot
> > simply upload a new version and expect Apache to serve it correctly.

> True.

huh? mod_perl will stat the file to see if it has been modified, then
recompile it if the cached version is stale.  this might take each
of the children a couple of requests to handle, but it happens very
quickly.  this shouldn't be an issue with production code though, since
the updates to the script happen very infrequently (compared to the
time one should have spent in development).  the judicious use
of Apache::StatINC and PerlFreshRestart takes care of this.  if you
need to do child init stuff, you can have special handlers for that
as well.

> > 5) Reliability. mod_perl is really designed for fairly static CGI
> > servers where the scripts are tested thoroughly before being available
> > via the enhanced server. It is possible for badly written scripts to
> > interfere with other scripts and even cause the Apache process to
> > crash.

where is this rumor coming from?  i never heard anything like that
and have never seen it happen.  i've written plenty of mod_perl stuff
and made lots of stupid mistakes along the way, but i've never seen
any of those mistakes bring the server down.  maybe i've just been
lucky, but i think that sort of statement needs some justification.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: 23 Jun 1999 13:32:40 GMT
From: "Mark H. Wood" <mwood@mhw.ULib.IUPUI.Edu>
Subject: Re: Exit values on NT, and run via AT
Message-Id: <7kqnlo$hlu$1@hercules.iupui.edu>

Bob Walton <walton@frontiernet.net> wrote:
> "Mark H. Wood" wrote:
>> I've installed ActiveState's Perl port on an NT box, and I'd like to
>> run a script daily out of the scheduler service (AT and friends).  My
>> ...
>> Are there any special tricks to making AS Perl run well out of the
>> scheduler?
> Yes.  NT's AT command is pretty braindead.

Indeed, but I haven't had time to write something better.

>                                             You should try running a
> batfile under AT that does nothing but put the "path" the script is
> receiving out to a file so you can see it.  Probably Perl isn't on the
> path AT supplies to the script

Right you are.  Thanks!  Moral of the story:  never trust the PATH
handed you by the scheduler.

>                                (where *does* it get those crazy values
> for "path", anyway?).

As usual the Microsoft KB gives no clue.  DevNet also has nothing.
Looking at what I got, my best guess is that the service manager
starts with the systemwide PATH, then deletes elements whose prefixes
are not on an internal list that has been blessed by MS' security
mavens.  ATSVC.EXE gets that when it starts, and just copies it to the
processes that *it* starts.

>                        So you might have to run your Perl script from a
> batfile after setting up a proper path (one that includes Perl) in the
> batfile.

Fortunately I already had to wrap it in a .BAT file, so I just added
the PATH statement that I needed and now it does indeed run perl.

>           Also, bear in mind that your drive mappings aren't passed to
> the script either, so you'll have to use UNC paths for anything over the
> network.  And to do that (depending on your security setup), you'll
> probably need to specify your userID and password for the script to be
> run under, since whatever default user ("system user"?) it runs under
> probably doesn't have permissions to muck with stuff on your network.
> And how to do that changed between sp3 and sp4.  And then, when you
> change your login password in the future, you have to change your
> password there, too -- try and remember that one six months from now!
> Microsoft made that one *real* user friendly :-(.

Thanks for the reminder.  *sigh* what I *really* need to do is to set
up a production box running e.g. Linux to do this stuff, and load it
up with file service clients and servers so I can push stuff to other
boxes over our various NOSes or let those others pull stuff as
desired.  But I had the NT box already in place and not doing enough
to keep it warm....

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Specializing in unusual perspectives for more than twenty years.


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

Date: Wed, 23 Jun 1999 12:55:06 GMT
From: johnbishop@atl.mediaone.net
Subject: Re: Help - PERL - DBI install
Message-Id: <7kqlf5$62s$1@nnrp1.deja.com>

In article <3770C58B.31BAE943@uswest.net>,
  Ron Reidy <rereidy@uswest.net> wrote:
> johnbishop@my-deja.com wrote:
>
> > We are struggling with the install of DBI 1.08 on AIX on an SP2.
> >
> > Can someone help me out on this - I'm more of a DBA than UNIX admin.
> >
> > Has my license expired?  Our admin says that the compiler should be
> > fine.
> >
> > Here's the output.
> >
> > # perl Makefile.PL
> > *** Note:
> >     The optional PlRPC-modules (RPC::PlServer etc) are not
installed.
> >     If you want to use the DBD::Proxy driver and DBI::ProxyServer
> >     modules, then you'll need to install the RPC::PlServer,
[snip]
> >
> > Any help is appreciated!
> >
> > JB
> >
> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.
>
> #1.  Install the other modules listed at the begining og your output.
>
> #2.  Your license has expired!  Talk to your SYSADMIN about it.
>
> --
> Ron Reidy
> Oracle DBA
> Reidy Consulting, L.L.C.
>
>

--

Will do.

Thanks.

JB
johnbishop@atl.mediaone.net


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 23 Jun 1999 09:19:24 -0500
From: robert sarno <utbob@hotmail.com>
Subject: How do you use XML Modules with ActiveStatePerl?
Message-Id: <3770ECEC.3B48704F@hotmail.com>

I am realitively new to Perl but have an ok handle on C.  I am
programming Perl with the newest Perl compiler I can find 5.00503.  How
do we use the XML mods with ActiveStatePerl.  I have the XML mods on my
desktop.

Rob



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

Date: Wed, 23 Jun 1999 14:43:46 GMT
From: dejapradeepk@my-deja.com
Subject: Indian perl group
Message-Id: <7kqrqv$8mj$1@nnrp1.deja.com>

Hi all,

I am a PERL programmer from IIT-bombay India and
looking for associating with PERL and Linux
programmers in nearby areas for carrying out
research and developement in these areas and
sharing knowledge.

If anybody out there interested please contact
at pradeepk@mail.com


Pradeep Kumar


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 23 Jun 1999 04:34:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie- foreach $var (keys %fields) - Outputs in wrong order ?????
Message-Id: <766qk7.tu1.ln@magna.metronet.com>

Kevin Hancock (khan@arcom.com.au) wrote:

: Tryin g to write my first Perl script and so far so good. everything is
: working OK except the output from "foreach $var (keys %fields)" is not
: in the order the data was added to the array.


: I am sure I am doing something simple wrong here.


   Yes, not checking the Perl FAQs before posting to the Perl
   newsgroup is simply wrong.


: Any ideas?


   Perl FAQ, part 4:

      "How can I make my hash remember the order I put elements into it?"


: Thanks for the input.


   Uh huh.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 23 Jun 1999 23:34:53 +0930
From: root <khan@arcom.com.au>
Subject: Re: Newbie- foreach $var (keys %fields) - Outputs in wrong order ?????
Message-Id: <3770E985.2A0EC165@arcom.com.au>

> 
> : I am sure I am doing something simple wrong here.
> 
>    Yes, not checking the Perl FAQs before posting to the Perl
>    newsgroup is simply wrong.
> 
> : Any ideas?
> 
>    Perl FAQ, part 4:
> 
>       "How can I make my hash remember the order I put elements into it?"
> 
And now I know that I am dealing with a hash the FAQ makes sense. The
text I am following calls them associative arrays and the FAQ (well the
FAQ I read)  does not mention them at all, hence the question. Now I
know they are also called hash's I can read all the appropriate
documentation.

Thanks, problem solved now.

Kevin


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

Date: 23 Jun 1999 15:35:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: NT - Server Up time
Message-Id: <3770f096@newsread3.dircon.co.uk>

mirak63@yahoo.com wrote:
> Hello,
> 
> Is there a way in Perl to be able to determine the time
> and date that an NT server came up?
> 

print "Uptime: 10 mins\n";

/J\
-- 
"I came on the train but I think I managed to pass it off as an asthma
attack" - Jenny Eclair


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

Date: Wed, 23 Jun 1999 15:47:37 +0100
From: "coxey" <chris.cox@icl.com>
Subject: Running simple perl scripting
Message-Id: <3770f12f.0@145.227.194.253>

we are trying to run a simple perl 5 script on an NT internet server running
IIS 4.
when we run these simple scripts ( e.g making a wb page say 'hello' ) we get
all the formatting ( print , \n , etc ) that goes with the HTML as well as
the text ( properly formatted ).

anyone know what we're doing wrong ?  we seem to have tried everything

cheers

coxey




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

Date: Wed, 23 Jun 1999 09:37:47 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <1dtuigb.ctdi5q1o9qiyjN@roxboro0-0020.dyn.interpath.net>

Abigail <abigail@delanet.com> wrote:

-snip-
> Could someone tell what they are using the OCR listing for? Does it show
> who are posting FAQs, or something like that?

In a way, in a group like this it shows who is posting a lot of
questions.

> I don't think FAQs are original content, but Gregs little program thinks
> they are.

That's not what is meant by OCR, but then again maybe he should call it
U/QR (Unquoted/Quoted Ratio).

> Why doesn't anyone get upset about that, yet they waste long threads about
> quoting prefixes?

Because the quoting prefix is more amiable to a solution -- convincing
you to use a standard quote prefix is more approachable than convincing
thousands of people that haven't yet heard of perl to read the docs
before posting.

-- 
John Moreno


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

Date: 23 Jun 1999 10:19:24 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Summing an array
Message-Id: <a1n1xr0zkj.fsf@cyclone.jprc.com>

James Stewart <james@britlinks.co.uk> writes:

> > :Just wondering how to find the sum of all the elements of an array. A
> > :look through the FAQs doesn't yield an answer. I guess I could do it with
> > :a loop, but I'm guessing there's a more elegant solution.
> > A loop is inelegant?
> not necessarily, but if there were a single command to do this I'd
> consider that more elegant.
How 'bout recursion? Everbody likes recursion.
Recursion has 'elegance' written all over it.
Try:

@L = (1..100);
print map{&$_($_,@L)}sub{$#_&&pop()+&{$_[0]}};

It prints 5050.

Or, if you don't mind making a named sub,

@L = (1..100);
sub sum{@_&&pop()+&sum}
print sum @L

---Jason


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

Date: 23 Jun 1999 13:47:24 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: time question
Message-Id: <7kqohc$un$1@coranto.ucs.mun.ca>

Paul David Fardy <pdf@morgan.ucs.mun.ca> says...
>> Actually, time() gives me the number of seconds since 1969-12-31.

lr@hpl.hp.com (Larry Rosler) writes:
>Wrong.  It is the number of seconds since 1970-01-01 00:00:00 UTC, 

How is that different?  Isn't 1970-01-01 00:00:00 UTC also 0 seconds
after 1969-12-31?

Paul Fardy


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

Date: Wed, 23 Jun 1999 07:48:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: time question
Message-Id: <MPG.11da93ae5ba085d4989c2f@nntp.hpl.hp.com>

In article <7kqohc$un$1@coranto.ucs.mun.ca> on 23 Jun 1999 13:47:24 GMT, 
Paul David Fardy <pdf@morgan.ucs.mun.ca> says...
> Paul David Fardy <pdf@morgan.ucs.mun.ca> says...
> >> Actually, time() gives me the number of seconds since 1969-12-31.
> 
> lr@hpl.hp.com (Larry Rosler) writes:
> >Wrong.  It is the number of seconds since 1970-01-01 00:00:00 UTC, 
> 
> How is that different?  Isn't 1970-01-01 00:00:00 UTC also 0 seconds
> after 1969-12-31?

As the most liberal possible representation in seconds of the incomplete 
specification 1969-12-31 is 1969-12-31 23:59:59, 1970-01-01 00:00:00 is 
at least one second after 1969-12-31.  But as your interpretation of 
1969-12-31 is some sort of abstract mathematical time continuum that 
becomes 1970-01-01, you are right too.  Heh!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 23 Jun 1999 10:37:50 -0400
From: Jackie Stock <jackie.stock@2jhuapl.edu>
Subject: Using ROLLBACK() w/ DBI Module
Message-Id: <3770F13E.1402259C@2jhuapl.edu>

I am trying to use the rollback and commit commands on an Oracle
Database.  I am using the DBI module and have successfully used the
SELECT, INSERT, UPDATE, DELETE commands.

Has anyone used the rollback/commit SQL commands?

Thanks.
Jackie Stock
(240) 228 - 3409
jacqueline.stock@jhuapl.edu



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

Date: Wed, 23 Jun 1999 13:21:18 GMT
From: bultman@unx.sas.com (David Bultman)
Subject: Variable Mulitdimensional Array
Message-Id: <3770dc48.4231788199@newshost.unx.sas.com>


I'm working on a little program that creates a multidimensional array
based on the input data. The input data determines the number of the
dimensions. After the input data is read I need to pass through every
record. If there were a fixed number of dimensions, in this case 3,  I
would use something like the following:

foreach $a ( keys %md ) {
  foreach $o ( keys %{$md{$a}} ) {
    foreach $t ( keys %{$md{$a}{$o}} ) {
        print "$a:$o:$t  $md{$a}{$o}{$t}\n";   }}}

Anyone know of any tricks to effectively do the same if the number of
dimensions vary? 

I create the MD array with the following:
btw:  @dims is a list of dimensions.

  $cmd = "\$md";
  for ($i=0;$i<=$#dims;$i++) {
    $cmd .= "{\$rec[$i]}";
  }
  $cmd .= "+= \$rec[\$#rec];";

  $cnt=0;
  foreach (@data) {
    @rec = split;
    eval $cmd;
    $cnt++;
  }



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

Date: 23 Jun 1999 14:43:24 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: Variable Mulitdimensional Array
Message-Id: <7kqrqc$5hd$1@fu-berlin.de>

David Bultman <bultman@unx.sas.com> wrote:

: I'm working on a little program that creates a multidimensional array
: based on the input data. The input data determines the number of the
: dimensions. After the input data is read I need to pass through every
: record. If there were a fixed number of dimensions, in this case 3,  I
: would use something like the following:

: foreach $a ( keys %md ) {
:   foreach $o ( keys %{$md{$a}} ) {
:     foreach $t ( keys %{$md{$a}{$o}} ) {
:         print "$a:$o:$t  $md{$a}{$o}{$t}\n";   }}}

: Anyone know of any tricks to effectively do the same if the number of
: dimensions vary? 

If you don't know how deep your data structure is going to be, 
recursion is your friend...

----- snip ------

my %hash = (
	    bla => 'value',
	    bla2 => {
		     foo => 'bar',
		     blurfl => {
				k1 => 'v1',
				k3 => 'v3',
				k4 => 'v4',
			       },
		    },
	    bla3 => 'valuebla3',
	   );

sub dumphash {
  my $hashref = shift;
  my @keys = @_;
  my $key;

  foreach $key ( keys %$hashref ) {
    if (! ref $hashref->{$key} ) {
      # this value is a scalar!
      foreach my $k ( @keys ) {
	print "{$k}";   # or do_something_interesting($hashref->{$key}) ...
      }
      print "{$key} => $hashref->{$key}\n"; # ... instead of printing
    } else {
      # this is yet another hashref -> recursion!
      push @keys ,$key;
      dumphash ($hashref->{$key}, @keys);
      pop @keys;
    }
  }
}

dumphash  (\%hash);

----- snip ------

Hope this helps,

Christoph

-- 
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
Often statistics are used as a drunken man uses lampposts -- for support
rather than illumination.  


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

Date: 23 Jun 1999 08:12:06 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Viral matters [completely off-topic]
Message-Id: <3770eb36@cs.colorado.edu>

After the recent flourish of writings on the issue of viruses in the
popular press and the frequently miswritten plural forms of virus seen
on the net, I decided to do some research into the matter.  The result is

    http://language.perl.com/misc/virus.html

Feel free to point others thither.  No, Unix has no viruses.  Neither
does Perl.

--tom
-- 
The prairies are vast plains covered by treeless forests.


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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