[7831] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1456 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 11 16:27:44 1997

Date: Thu, 11 Dec 97 13:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 11 Dec 1997     Volume: 8 Number: 1456

Today's topics:
     Re: a certain bug...!!! (brian d foy)
     Re: a certain bug...!!! (brian d foy)
     Can't 'print' large (> 6M) files <brector@bnr.ca>
     Re: Can't 'print' large (> 6M) files <brian@posthuman.com>
     Re: Extraneous Digits From Division Operator <rootbeer@teleport.com>
     Re: Extraneous Digits From Division Operator (Robert G. Ferrell)
     Re: Extraneous Digits From Division Operator <glen.culbertson@ny.ubs.com>
     Re: Finding the FILE SIZE <rootbeer@teleport.com>
     Re: GIFgraph legend <mike@soft-tek.com>
     GIS/Coordinate Transformation module? (Kirk  Hilliard)
     Re: Help for newbie perl scripter <rootbeer@teleport.com>
     Re: Help for newbie perl scripter (Robert G. Ferrell)
     Re: help with win32::process <bowlin@sirius.com>
     just starting with perl <tuia@msn.com>
     Re: Learning Perl - How to start (I R A Aggie)
     Memory leak (perl 5.004_04) <brian@posthuman.com>
     Re: Perl support for the long long type <rootbeer@teleport.com>
     Re: Perl support for the long long type <vincent.joseph@usa.net>
     Re: PERL<-->databases ???(newbie) (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Please Help - Win32::InitiateSystemShutdown (Tye McQueen)
     PLEASE HELP! <e.phillips@mindspring.com>
     Re: Question (Faust Gertz)
     Re: Review of CGI/Perl book (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     SybPerl vs. OraPerl <ken.chesak@mail.txt.net>
     Re: what does qq() do? <reibert@mystech.com>
     Re: what does qq() do? (Robert G. Ferrell)
     Win95/DOS and function keys ledupa@samc.com
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 11 Dec 1997 15:56:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: a certain bug...!!!
Message-Id: <comdog-ya02408000R1112971556420001@news.panix.com>

In article <348EE0FB.2DF49077@inria.fr>, Christian Khoury <Christian.Khoury@inria.fr> wrote:

>i read in "Programming Perl" (2nd edition) that i just need to add a
>"+>" to a file's name to be able to open it in read write mode...i tried
>it and it failed....but with "+<", it worked fine...

how do you know it failed?  if +> worked, it either created the file (if
the file did not exist) or truncated it (if it did).  either way there
are no data to read initially.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 11 Dec 1997 15:58:08 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: a certain bug...!!!
Message-Id: <comdog-ya02408000R1112971558080001@news.panix.com>

In article <348FEBAA.4157246F@inria.fr>, Christian Khoury <Christian.Khoury@inria.fr> wrote:

ut then, i wouldn't call it (+>) Read-Write mode...it's
>Read-Write-Create mode...:-)  

unless it doesn't create the file...

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 11 Dec 1997 14:29:54 -0500
From: Ben Rector <brector@bnr.ca>
Subject: Can't 'print' large (> 6M) files
Message-Id: <34903F31.4B0E31A2@bnr.ca>

Hello,
    I have been have problems printing files larger than 2Mb with
"print" and  6Mb with "syswrite".
Each time I try to print I get an "Out of Memory!" error.  I have tried
using FileHandle::setvbuf,
but it does not seen to change anything and I haven't found any good
documentation to see if I am
making a mistake in its call.

 $content = "contents of one bigFile";
 $file = new FileHandle;

 if ($file->open("> $fileName.$$")) {

#   Take your pick, neither works for me.  This may be of no use anyway
#   $file->setvbuf($buffer_var,_IOLBF,1024);
#   $file->setvbuf($buffer_var,_IONBF,NULL);

     print $content;

     $file->close;
 }

Can anyone help?

My environement is:
HP-UX 10.20
HP 9000/780 w 512M RAM
perl5.004


Thanks,
Ben




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

Date: Thu, 11 Dec 1997 15:14:02 -0500
From: Brian Atkins <brian@posthuman.com>
To: Ben Rector <brector@bnr.ca>
Subject: Re: Can't 'print' large (> 6M) files
Message-Id: <3490498A.D4CFEAD1@posthuman.com>

Hmm, this might be the answer to the problem I having (see my
"Memory leak (Perl5.004_04) message. If you find anything out,
could you let me know? I will do likewise!

Ben Rector wrote:
> 
> Hello,
>     I have been have problems printing files larger than 2Mb with
> "print" and  6Mb with "syswrite".
> Each time I try to print I get an "Out of Memory!" error.  I have tried
> using FileHandle::setvbuf,
> but it does not seen to change anything and I haven't found any good
> documentation to see if I am
> making a mistake in its call.
> 
>  $content = "contents of one bigFile";
>  $file = new FileHandle;
> 
>  if ($file->open("> $fileName.$$")) {
> 
> #   Take your pick, neither works for me.  This may be of no use anyway
> #   $file->setvbuf($buffer_var,_IOLBF,1024);
> #   $file->setvbuf($buffer_var,_IONBF,NULL);
> 
>      print $content;
> 
>      $file->close;
>  }
> 
> Can anyone help?
> 
> My environement is:
> HP-UX 10.20
> HP 9000/780 w 512M RAM
> perl5.004
> 
> Thanks,
> Ben

-- 
The future has arrived; it's just not evenly distributed.
                                                       -William Gibson
______________________________________________________________________
Visit Hypermart at http://www.hypermart.net for free business hosting!


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

Date: Thu, 11 Dec 1997 11:03:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Kevin M Simonson <simonsen_nospam@skopen.dseg.ti.com>
Subject: Re: Extraneous Digits From Division Operator
Message-Id: <Pine.GSO.3.96.971211110205.18770G-100000@user2.teleport.com>

On 11 Dec 1997, Kevin M Simonson wrote:

>      For a "perl" script that I've just written, I want the results
> rounded to just one decimal point.  I thought that if I had a value
> <Value> expressed as a float, that I could get it rounded to one
> decimal point by the following code fragment: 
> 
>                $Rounded = int ($Value * 10.0 + 0.5) / 10;


Nice try. :-)

>      When I print <Rounded> what I'd like to get is "1.4" for 1.39 or
> 1.41, but what I'm getting instead for these two values is
> "1.3999999999999999." 

You should proably use sprintf instead.

> But I'm just wondering whether the behavior I'm getting from the
> division operator is a bug or not.  

Not. :-)

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 11 Dec 1997 19:42:03 GMT
From: rferrell@usgs.gov (Robert G. Ferrell)
Subject: Re: Extraneous Digits From Division Operator
Message-Id: <EL1Iq3.Gss@igsrsparc2.er.usgs.gov>
Keywords: divide digit

In article <66p4l5$4nl@sf18.dseg.ti.com>, 
simonsen_nospam@skopen.dseg.ti.com says...
>But I'm just
>wondering whether the behavior I'm getting from the division operator 
is a
>bug or not.  Opinions, anyone?

I wouldn't call it a 'bug.'  It's just that Perl uses floating points 
for division operations.  There are a lot of workarounds.  For 
example: I've dropped all the right hand digits into an array, and then 
popped 'em off one at a time until I get to where I want to be, checking 
to make sure the rightmost is incremented if the next-to-last discard is 
> 4.  There're probably some that are easier and more elegant; I never 
gave it a lot of thought.  It's just one of life's little sidetracks... 
;-)

RGF



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

Date: Thu, 11 Dec 1997 14:48:06 -0500
From: Glen Culbertson <glen.culbertson@ny.ubs.com>
Subject: Re: Extraneous Digits From Division Operator
Message-Id: <34904376.1CDD@ny.ubs.com>

Not a bug. 

In Perl you can split a floating point number on "." as if it were a
string,
work with the integer and fractional parts separately as if they were
integers,
and then join your parts together with "." and use the result in a
mathematical
expression (e.g., 

print 1.3 * (34 . "." . 23); 

results in 44.499 printing out). Given that, you should not expect
mucking 
around with values to affect printing format consistently. 

You have to get past the thinking engendered by working in more strongly
typed
languages that has you playing around with the internal representation
of 
(numberical) values, shifting bits and all that (although there are
cases where
bit operations are perfectly appropriate in Perl, formating numbers is
not
one of them). 

Read the FAQ on rounding, and use sprintf to get the format you want.

Kevin M Simonson wrote:
> 
>      For a "perl" script that I've just written, I want the results rounded
> to just one decimal point.  I thought that if I had a value <Value> ex-
> pressed as a float, that I could get it rounded to one decimal point by the
> following code fragment:
> 
>                $Rounded = int ($Value * 10.0 + 0.5) / 10;
> 
>      When I print <Rounded> what I'd like to get is "1.4" for 1.39 or 1.41,
> but what I'm getting instead for these two values is "1.3999999999999999."
--snip--
> I'm just
> wondering whether the behavior I'm getting from the division operator is a
> bug or not.  Opinions, anyone?
> 
>                                      ---Kevin Simonson


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

Date: Thu, 11 Dec 1997 11:01:43 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Holm <rets@meta3.com>
Subject: Re: Finding the FILE SIZE
Message-Id: <Pine.GSO.3.96.971211105942.18770F-100000@user2.teleport.com>

On Thu, 11 Dec 1997, Ken Holm wrote:

> my $FileSize = (-s $filename) || "$filename doesn't exist";
> print $FileSize, "\n";

To be sure, -s may return zero when the file actually does exist! :-)

	my $filesize = -s $filename;
	$filesize = "Can't stat file '$filename': $!"
	    unless defined $filesize;

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 11 Dec 1997 13:28:21 -0600
From: "Mike Christensen" <mike@soft-tek.com>
Subject: Re: GIFgraph legend
Message-Id: <66peo7$637$1@client3.news.psi.net>

You might want to take a look at GRAFSMAN/WWW from Soft-tek International,
Inc.

You will find a live demonstration on our website:

http://www.soft-tek.com

GRAFSMAN is a very flexible charting application, allowing you to display
your data in the most meaningful way to your audience.

If you have specific questions, or would care to forward a copy of the graph
you are wanting to create, I would be glad to have my support staff look at
it and give you some idea of how it would/could be handled with GRAFSMAN.

Please let me know how I can be of further assistance,

Mike Christensen
Soft-tek International, Inc.
1999 N. Amidon, Wichita, KS  67203
316 838 7200(v)  --  316 838 3789(f)
mailto:mike@soft-tek.com
http://www.soft-tek.com

Tim Edgren wrote in message <348EC42B.5171@ford.com>...
>I've looked at (and run) the sample scripts for Martien's GIFgraph, but
>don't seem to find a way to build a legend among the option
>documentation.  Is there a way to use the logo option (or some other
>way) to show a dynamically-built legend?
>
>I'm currently using gnuplot (which supports legends, albeit rather
>inflexibly) but I'd rather have a bit more control over my various
>graphs.




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

Date: 11 Dec 1997 18:54:05 GMT
From: kdh5j@weyl.math.Virginia.EDU (Kirk  Hilliard)
Subject: GIS/Coordinate Transformation module?
Message-Id: <66pcse$cg0$1@murdoch.acc.Virginia.EDU>


Is there a Perl module for performing geographic coordinate
transformations?

I did not find such a thing on CPAN, and an altavista search on "perl
gis" yielded the very promising link http://oracle.er.usgs.gov/gis/perl/
which turned out to be an empty page.

I am currently using some C routines from the USGS GCTPC (General
Cartographic Transformation Package in C) package, and I am thinking
of making a Perl module which would provide an interface to these
functions.  Has something like this been done already?  Is there any
interest in such a module?

Kirk Hilliard


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

Date: Thu, 11 Dec 1997 10:58:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chester-- <chester@ican.net>
Subject: Re: Help for newbie perl scripter
Message-Id: <Pine.GSO.3.96.971211105631.18770E-100000@user2.teleport.com>

On Thu, 11 Dec 1997, Chester-- wrote:

> Subject: Help for newbie perl scripter

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> I need to cumulate an amount from a hidden variable on a series of
> pages.  I think I have the url-encoded input done okay, using post, its
> split-up into an array, how do take the part I need to store and dump it
> into a db file, then when done, how do I read it out again. 

To use data with a database file, you want to use either dbmopen or tie
and a module. If that's not what you needed, you should probably show us
how far you've gotten and where you're stuck. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 11 Dec 1997 19:53:46 GMT
From: rferrell@usgs.gov (Robert G. Ferrell)
Subject: Re: Help for newbie perl scripter
Message-Id: <EL1J9M.KL1@igsrsparc2.er.usgs.gov>

In article <34900C17.6155FB2B@ican.net>, chester@ican.net says...
>
>Hi,
>I'm a totally new perl programmer and I have a task for someone who can
>help me out.  

I don't want to sound unhelpful, but this might be a bit more involved 
than is really appropriate via email or Usenet.  If you really want to 
learn Perl, why don't you get one of the many books available?  See Tom 
Christiansen's Perl book reviews at 
http://language.perl.com/critiques/index.html, and then get one or two 
of them.  Heck, I've got nearly all of them, and each makes a slightly 
different contribution to the overall knowledge base.  

It's really sad to see someone who only wants to learn enough Perl to 
crank out a few CGI scripts.  You're new; do it the right way and learn 
to program in Perl from the ground up.  You'll thank yourself later, I 
promise.

HTH,

RGF



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

Date: Thu, 11 Dec 1997 12:43:42 -0800
From: Jim Bowlin <bowlin@sirius.com>
To: "David J. Boyd" <djboyd@nospam.sam.on-net.net>
Subject: Re: help with win32::process
Message-Id: <3490507E.CB0DDCDF@sirius.com>

David J. Boyd wrote:
> 
> I am running perl5 build 110 on win NT 4.0 and Win 95.  I have been given the
> task to create a perl script that will build a sorted directory tree of a source
> server and compare it to a target server.  I have completed this part and it
> works fine.  The problem is that it takes over 24 hours to run the compare of
> all the server pairs.  [snip]

I suggest using checksums on the files and then comparing the checksums.

>From the 1st ed. Camel book p. 198:

$checksum = unpack("%32c*", <FILE>);

will produce a 32 bit checksum for a FILE.  
Make a program that computes the checksums for all files in question.
Run the program on each machine _locally_.  Store the results in a file.
Then have another program compare the contents of the files.

HTH - Jim Bowlin


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

Date: Thu, 11 Dec 1997 12:44:22 -0800
From: "jennifer" <tuia@msn.com>
Subject: just starting with perl
Message-Id: <01bd0675$8b7e6a60$d6812299@xbwerrsn>

Everyone was so helpful on my last question, I'm going to ask another
num-num question.
I have perl5 installed on win95. Located in my C: directory (hard drive)
that being that...
I type at the dos promt: 
      c:\perl5\perl -e "print 8 * 8;"
 I get the answer - 
      64.... so far so good. Now I've typed a program in notepad
     #!usr/bin/perl -w
     print ("Hi Jen!\n");
I saved this as jen.pl.
Back at the dos prompt..
    c:\perl5\perl jen.pl
"can't open perl script jen.pl no such filde or directory exists."
So I type...
    c:\perl5\perl
Now I'm on a blank line, no prompt of any kind so I type..
     jen.pl
Now I'm on another blank line no repsonse from perl
I type..
    c:jen.pl
Another blank line, still no response.
I have associated .pl with perl.exe in my file types box in 'my computer',
although it didn't matter before association and it doesn't matter after
association still no response.  I have O'Reilly Learning Perl, I would like
to get started with the exercises instead of tinkering with my system.  I
would appreciate any help that's out there. Also how do you quit perl from
a blank line.  When I "x out"  a warning box comes on to say I should
officially exit the program. I type quit, exit, or push escape - no dice. I
type cd:\
still can't exit.

Thanks in advance!




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

Date: Thu, 11 Dec 1997 14:25:18 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Learning Perl - How to start
Message-Id: <-1112971425190001@aggie.coaps.fsu.edu>

In article <34903891.90EF86E5@icct.net>, Allie <allie@icct.net> wrote:

+ > Pick yourself up a copy of "Learning Perl on Win32 Systems" and

+ Does anyone have any more info on this book?

>From what I've seen of it -- not much, admittedly -- is that it is
the llama in a Win32 environment. I imagine that it also has some
additonal chapters specifically aimed at the Win32 user.

+ I don't have programming experience, but I'm eager to start 
+ learning Perl.

OH DEER LARD! :) You'll have to be real careful. Perl isn't really suited
to learn programming. I'm not saying that you can't do it, but it can
be an adventure. I've been using perl for 3 years now, and fortran for
15 years before that, and I _still_ get bit by my own _carelessness_,
from time-to-time.

Perl will quite cheerfully allow you to hang yourself. Most teaching
languages refuse to do so. And they usually don't have access to
potentially dangerous calls.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Thu, 11 Dec 1997 14:13:29 -0500
From: Brian Atkins <brian@posthuman.com>
Subject: Memory leak (perl 5.004_04)
Message-Id: <34903B59.659C8D18@posthuman.com>

Hi, if anyone can help me find a memory leak in the code below
I will give them a free hosting account (well, actually we do
that anyway :-). We have about 2000 virtual hosts on our server
currently, and that necessitates that we log it all to one
logfile and then split it up every night into separate logs.
Below is a snippet of our splitter program- it always fails
in this section with an Out of memory! error. It looks really
straightforward to me, but maybe there is something wrong?

tie %h5,DB_File,"/data1/hypermart.net/cgi-bin/users.db",O_RDONLY,0700,$DB_HASH;
foreach $user (keys %h5) {
   if ($user ne "www") {  
   open(FILE,"/data2/logs/temp_log");
   open(FILE2,">/data2/logs/temp_log2");
   open(LOG,">>/data2/logs/users-access_log");
   open(LOG2,">>/data2/logs/userlogs/$user"); 
   if ($domains{$user} eq "") {
      while ($line = <FILE>) { 
         @pieces = split(/\s/,$line);
         @path = split(/\//,$pieces[7]);
         if ($path[1] eq $user || $pieces[0] eq "$user.hypermart.net") {
            print LOG join(" ",@pieces)."\n";
            print LOG2 join(" ",@pieces)."\n";
         } else { 
            print FILE2 join(" ",@pieces)."\n";
         }  
      }  
   } else {
      while ($line = <FILE>) {
         @pieces = split(/\s/,$line);
         @path = split(/\//,$pieces[7]);
         $virtual = shift(@pieces);
         if ($path[1] eq $user || $virtual eq $domains{$user} || $virtual eq
"$user.
hypermart.net") {
            print LOG join(" ",@pieces)."\n";
            print LOG2 join(" ",@pieces)."\n";
         } else { 
            print FILE2 join(" ",$virtual,@pieces)."\n";
         }  
      }  
   }  
   close FILE;
   close FILE2;
   close LOG;  
   close LOG2; 
   rename("/data2/logs/temp_log2","/data2/logs/temp_log");
   }
}

P.S. The OS is BSDI3.1 if that matters.
-- 
The future has arrived; it's just not evenly distributed.
                                                       -William Gibson
______________________________________________________________________
Visit Hypermart at http://www.hypermart.net for free business hosting!


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

Date: Thu, 11 Dec 1997 10:53:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Vincent Joseph <vincent.joseph@usa.net>
Subject: Re: Perl support for the long long type
Message-Id: <Pine.GSO.3.96.971211105217.18770D-100000@user2.teleport.com>

On Thu, 11 Dec 1997, Vincent Joseph wrote:

> Does perl provide support for the long long type (64 bit)?

No and yes. There's no way to ensure that a scalar will hold a 64 bit
integer in the way you probably think, but you can work with
arbitrarily-large data in Perl.

> I need to constrcut a 5 byte integer. I have the individual bytes, but
> need to put them together. 

You can use join or pack to make a bitstring. Is that what you need? Hope
this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 11 Dec 1997 19:54:59 GMT
From: Vincent Joseph <vincent.joseph@usa.net>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl support for the long long type
Message-Id: <34904542.49ECDF1E@usa.net>

Hi,

I shall provide a little more background, and the code I had planned on
using:

The 5 byte integer that I wish to convert is actually Unix time in 100th of a
seconds.
(By Unix time I mean the value returned by the time function.)
The value is being read from a file.
I need to convert this value to Unix time in seconds (which will fit in 4
bytes)
The "conversion" is really just a division by 100.
However, there does not seem to be a way to read in a 5 byte field into any
of the numeric types using unpack (eg N n)
So I read it into a variable [ C5], and pass it to the sub shown below to do
the
conversion (~division).[ (..., $raw , ...) = unpack ("... C5 ...", $record);]

Here is the subroutine I had planned on using:(I use the Math::BigInt module)

sub toSeconds
{
        my $rawepoch=();  #Raw time (epoch) passed in from outside, 5 byte
(100th second)
        my @epoch=();     #Breakout into 5 bytes of rawepoch time
        my ($sum,$sum2)=();
        my $unixtime=();  #Final unix time

        print "In procedure epoch2unix\n" if $main::DEBUG1;

        $rawepoch=shift; #read in argument
        (@epoch)=unpack("C C C C C",$rawepoch); #Strip argument by byte

        print " Raw Epoch : $rawepoch\n" if $main::DEBUG0;

        #Read each byte into a big integer
        my $i0=Math::BigInt->new($epoch[4]);
        my $i1=Math::BigInt->new($epoch[3]);
        my $i2=Math::BigInt->new($epoch[2]);
        my $i3=Math::BigInt->new($epoch[1]);
        my $i4=Math::BigInt->new($epoch[0]);

        print " Breakout : $i0(byte0) $i1 $i2 $i3 $i4(byte4)\n" if
$main::DEBUG0;

        #Multiply each byte by scaling factor
        my $i04=Math::BigInt->new($i4->bmul(4294967296));
        my $i03=Math::BigInt->new($i3->bmul(16777216));
        my $i02=Math::BigInt->new($i2->bmul(65536));
        my $i01=Math::BigInt->new($i1->bmul(256));
        my $i00=Math::BigInt->new($i0->bmul(1)); #hmm

        print " byte 0 =$i00\n" if $main::DEBUG0;
        print " byte 1 =$i01\n" if $main::DEBUG0;
        print " byte 2 =$i02\n" if $main::DEBUG0;
        print " byte 3 =$i03\n" if $main::DEBUG0;
        print " byte 4 =$i04\n" if $main::DEBUG0;

        #Add 'em up to get epoch time as a string
        $sum=Math::BigInt->new($i00+$i01+$i02+$i03+$i04);
        print "epoch Time = $sum\n" if $main::DEBUG0;

        #Convert to unix time in seconds
        $sum2=Math::BigInt->new($sum->bdiv(100));
        $unixtime=$sum2;

        print " Final Unix Time : $unixtime\n" if $main::DEBUG0;
        print "Leaving procedure epoch2unix\n" if $main::DEBUG1;

        return $unixtime;
}

Is there a more efficient (time wise, algorithmic)  way of doing
this in Perl?

Thanks again,

Vincent

Tom Phoenix wrote:

> On Thu, 11 Dec 1997, Vincent Joseph wrote:
>
> > Does perl provide support for the long long type (64 bit)?
>
> No and yes. There's no way to ensure that a scalar will hold a 64 bit
> integer in the way you probably think, but you can work with
> arbitrarily-large data in Perl.
>
> > I need to constrcut a 5 byte integer. I have the individual bytes, but
> > need to put them together.
>
> You can use join or pack to make a bitstring. Is that what you need? Hope
> this helps!
>
> --
> Tom Phoenix           http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
> Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
>               Ask me about Perl trainings!

 



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

Date: Thu, 11 Dec 97 14:22:37 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: PERL<-->databases ???(newbie)
Message-Id: <34903d8d$6$ofn$mr2ice@speaker>

In <66p36e$qp$1@earth.execpc.com>, on 12/11/97 at 10:08 AM,
   jesten@earth.execpc.com (Jim Esten) said:
+-----
| : If BugBase can handle millions of entries I'm sure MS would be interested
| : in it. 8?>
| In a recent teaching excursion, I ran across a menu option for the
| "Microsoft Anomaly Database".  I couldn't imagine there being enough disk
| space to hold it! :)
+--->8

Nah, they just spelled "Access" correctly for a change :-)

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)


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

Date: 11 Dec 1997 14:25:31 -0600
From: tyde@medtrodnet.cdom (Tye McQueen)
Subject: Re: Please Help - Win32::InitiateSystemShutdown
Message-Id: <66pi7r$3uj@fiinix.metronet.com>

"Frank Bellomo" <fbellomo@home.com> writes:
) 
) I can not make any of them work on a remote machine.
) use Win32::NetAdmin
) # For example
) Win32::InitiateSystemShutdown("\\\\computer", "test", 60, 1, 1);
[...]
) I get a couple of different errors - The system could not find the
) environment
) option that was entered.
)   203
) 
) and
) 
) The system could not find the environment
) option that was entered.
)   203

That error is overwriting your real error.  Grab the value from
Win32::GetLastError() as soon as the call fails and before you do
anything, even `&ERROR_FILE_NOT_FOUND'.  It is probably trying to
tell you "access denied".

Alternately you can grab my Win32API::Registry module and my
patch for Perl5.004_04 and use:

    use Win32API::Registry qw(InitiateSystemShutdown);
    InitiateSystemShutdown("computer","test",60,1,1)
      ||  die "Can't shutdown computer: $^E\n";

See http://www.metronet.com/~tye/alpha/ for both.

If the problem is "access denied", make sure you preceed
these commands with something like:

    net use \\computer\ipc$ /user:administrator *
    Password: 

which will give you remote admin privs on those machines until you
log out or delete the ipc$ connection.  This "net use" command
won't work if you have network shared drives mapped from that
machine using a different username.
--
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
       Remove d's from address to reply (sorry for the inconvenience).


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

Date: Wed, 10 Dec 1997 14:48:22 -0800
From: "Eric Phillips" <e.phillips@mindspring.com>
Subject: PLEASE HELP!
Message-Id: <66pg44$qf4@camel19.mindspring.com>


Hello, I am a new Perl programmer, sort of, and I have a question.
I am writing a script that does a lot of things, but right now I am having
problems, well I really don't know how to do it, with reading a ".dat" file,
which will search for a login and a password.
Here's the format of the ".dat" file:
|login|password
Please help me read the login and password and compare them in the ".dat"
file to see if they are correct.  Thanks!!
PS:  All I need to know is how to compare the login and password from the
form to the ones in the ".dat" file.  Thanks, and let me know!

--
Eric Phillips
e.phillips@mindspring.com




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

Date: Thu, 11 Dec 1997 20:11:36 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Question
Message-Id: <34903e60.968729@news.wwa.com>

On Tue, 9 Dec 1997 19:00:46 -0800, "Eric Phillips"
<e.phillips@mindspring.com> wrote:

>Hello, I am a new Perl programmer, sort of, and I have a question.
>
>I am writing a script that does a lot of things, but right now I am having
>problems, well I really don't know how to do it, with reading a ".dat" file,
>which will search for a login and a password.
>
>Here's the format of the ".dat" file:
>
>|login|password

Perhaps you could open the dat file (making sure to check the return
value).

01>open (LOGIN, "+<login.dat") || die "$0 can't open login.dat: $!";

lock it.  (There are better ways to lock files, I'm just using an easy
one.  See the manpages
(http://www.perl.com/CPAN-local/doc/manual/html/pod/) and FAQ
(http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html) for
different and/or beter ways)

02>flock (LOGIN, 2)  || die "$0 can't get an exclusive lock on
numfile: $!";

I don't know if you need to do this, but I like to possibly waste a
line of code with

03>seek(LOGIN, 0, 0) || die "$0 can't rewind login.dat: $!";

and then loop through the file handle.

04>while (<LOGIN>)  {

Lob off the newline character.

05>    chomp;

Split the line up into parts at the '|'.

06>    ($trash, $login, $password) = split /|/;

Then do your comparing.  If the user enters a valid password for a
valid login, set status to 1, else, leave it as zero.

07>    if ($userlogin eq $login) {
08>        if ($userpassword eq $password) { $status = 1 }
09>       last;
10>    }
11>}
12>close LOGIN || die "$0 couldn't close login.dat: $!";


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Thu, 11 Dec 97 13:45:16 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Review of CGI/Perl book
Message-Id: <34903546$5$ofn$mr2ice@speaker>

In <66p2qg$b5@tekka.wwa.com>, on 12/11/97 at 10:02 AM,
   scribble@tekka.wwa.com (Tushar Samant) said:
+-----
| >>of one's web dreams. It has arrived. Every hacker born in this
| >>decade will grow up with an instinctive feel for the CGI/Perl
| >>cookbook, or he will be no hacker.
| >it's a rather bold assertation that this book is requisite for
| >hacker-dom though.
| No flames here -- I just wanted to say let's meet again in 10 years (at
| Internet World) and see who's the hacker.
+--->8

Only acceptable if Larry, Tom C., and Randal are the judges.  ;-)

(I admit that I'm an ex-Perl4 type still coming up to speed on Perl 5, so
perhaps "just barely another Perl hacker" is appropriate in my case.  Ah,
well.)

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)


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

Date: Thu, 11 Dec 1997 12:48:23 -0600
From: Kenneth Chesak <ken.chesak@mail.txt.net>
Subject: SybPerl vs. OraPerl
Message-Id: <34903577.B9DB98ED@mail.txt.net>

I going to be converting an application from HP Unix, SybPerl and Sybase
11 to  NT 4.0 Server running Oracle 7.3.  Does OraPerl for NT exist?  If
so where can I get a copy?
Thanks




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

Date: Thu, 11 Dec 1997 11:50:05 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: what does qq() do?
Message-Id: <349035DC.51268F85@mystech.com>

Henry,

qq is one of the quote operators - in this instance equal to double-quoting
the argument. The various quote operators are described on page 41 or
Programming Perl.

Mark Reibert

Henry Hartley wrote:

> I cannot find any mention of this function except in code examples, as
> follows:
>
>       $sql = qq(select * from <table> where LastName like '$lastname\%'
> order by LastName);
>
> what does the qq do?
>
> I've been using sprintf("select...  Why should I use qq instead?
>
> Henry

 -----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Thu, 11 Dec 1997 19:09:01 GMT
From: rferrell@usgs.gov (Robert G. Ferrell)
Subject: Re: what does qq() do?
Message-Id: <EL1H71.DzA@igsrsparc2.er.usgs.gov>

In article <34902E89.9D391A21@DotRose.com>, henry@DotRose.com says...
>
>what does the qq do?

It's just a way of designating double quotes.  

qq/stuff/; 

is the same as

"stuff";

q = '
qq = "
qx = `
qw = each item i a list is quoted (so qw/a b c/; = 'a','b','c')

Why use qq rather than "" or sprintf?  Style.  Preferences.  Elegance.

Take your pick.  Mostly it's just to provide an option.  Whatever makes 
your code easier to read and debug makes you a better programmer.

RGF  



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

Date: Thu, 11 Dec 1997 12:51:42 -0600
From: ledupa@samc.com
To: pleduc@lightspeed.net
Subject: Win95/DOS and function keys
Message-Id: <881865936.1469710340@dejanews.com>

I am new to the PERL language, but have already written some basic
programs to process files.  I am being asked to write a script that will
run in a DOS box that will respond to function key input.  For example
<F2> Run <F3> Save ..., etc.  Is this possible in PERL?  If so, how would
I go about it?	Any assistance would be greatly appreciated.



-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

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

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