[13544] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 954 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 16:17:12 1999

Date: Thu, 30 Sep 1999 13:10:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938722216-v9-i954@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Sep 1999     Volume: 9 Number: 954

Today's topics:
        Recurring segmentation fault c_j_marshall@hotmail.com
    Re: Runtime exception driving me crazy <rhomberg@ife.ee.ethz.ch>
    Re: Runtime exception driving me crazy (Larry Rosler)
    Re: Runtime exception driving me crazy (Abigail)
    Re: Runtime exception driving me crazy (Abigail)
    Re: setuid script <rootbeer@redcat.com>
    Re: STDIN & @ARGV <rhomberg@ife.ee.ethz.ch>
        strange problem with variable interpolation makau@multimania.com
    Re: strange problem with variable interpolation (Randal L. Schwartz)
    Re: strange problem with variable interpolation (Larry Rosler)
    Re: using CPAN to upgrade perl version <rootbeer@redcat.com>
    Re: Using SS Numbers as DBM Index: Best Way to Encrypt  (Benjamin Franz)
    Re: Using SS Numbers as DBM Index: Best Way to Encrypt  (Mark A. Hershberger)
    Re: using tr? <uri@sysarch.com>
    Re: using tr? (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Sep 1999 17:09:00 GMT
From: c_j_marshall@hotmail.com
Subject: Recurring segmentation fault
Message-Id: <7t05eu$9ue$1@nnrp1.deja.com>

I've just written a Perl V5.004 script which is using Sybase::CTlib.pm
quite heavily.

The script is designed to check the existance of an index on every user
table in a database and compare to a supposedly identical database to
see whether any indices are missing between them.

I've just completed the first part - which builds up a rather large hash
of the form $hash{$table_name}{$index_name}=$index_desc;

And it all works fine.

Except that everytime I run it it completes OK.
When I then run it a second time I will get a segmentation fault unless
I run 'rehash' first (I'm using csh on a solaris box)

Any ideas ?

Should I be freeing up the memory tied up in the hash variable in some
way ?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 30 Sep 1999 19:14:36 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Runtime exception driving me crazy
Message-Id: <37F39A7C.2F69363C@ife.ee.ethz.ch>

David Stiff wrote:
> 
> Hi,
> 
> I am migrating a Perl process from one machine to another. The new machine
> is a very high end dual Pentium system with 512 MB of RAM (clone machine).
> The Perl code has not changed but I am receiving a Runtime exception when
> comparing two arrays.
> 
> The code looks like this:
O(n^2) function snipped

> The process runs for several minutes comparing the arrays before stopping.
> Any ideas?

No wonder it runs for several minutes, with an O(n^2) algorithm.
Read perlfaq4 on "How do I compute the difference of two arrays?  How do
I
     compute the intersection of two arrays?"
Try that code.

- Alex
 
PS of what order is a hash lookup?


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

Date: Thu, 30 Sep 1999 11:22:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Runtime exception driving me crazy
Message-Id: <MPG.125d4a45c7bb3bbb98a007@nntp.hpl.hp.com>

In article <37F39A7C.2F69363C@ife.ee.ethz.ch> on Thu, 30 Sep 1999 
19:14:36 +0200, Alex Rhomberg <rhomberg@ife.ee.ethz.ch> says...

 ...

> PS of what order is a hash lookup?

O(1) 

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


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

Date: 30 Sep 1999 14:18:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Runtime exception driving me crazy
Message-Id: <slrn7v7ebb.8i.abigail@alexandra.delanet.com>

David Stiff (dstiff@symantec.com) wrote on MMCCXXI September MCMXCIII in
<URL:news:7t020s$t8v$1@news2.symantec.com>:
$$ Hi,
$$ 
$$ I am migrating a Perl process from one machine to another. The new machine
$$ is a very high end dual Pentium system with 512 MB of RAM (clone machine).

Not used to much, are you? 2 Pentium CPUs and 512Mb RAM are far, far away
from what I would call "high end". Not that the hardware is relevant.

$$ The Perl code has not changed but I am receiving a Runtime exception when
$$ comparing two arrays.

A runtime exception? Is this a Java implementation of Perl?

$$ The code looks like this:
$$ 
$$ sub listSubtraction {
$$ 
$$     local($refListA, $refListB) = @_;
$$     local(@listDiff) = ();
$$     local($a);
$$     local($b);

local? local? Eeeeeew. Why?

$$     foreach $a (@$refListA)
$$         $exist = 0;
$$         foreach $b (@$refListB)
$$               if (uc($b) eq uc($a))
$$                    $exist = 1;
$$               }
$$         }
$$         if (!$exist)
$$            push( @listDiff,$a);
$$        }
$$     }
$$  return @listDiff;
$$ }
$$ 
$$ The process runs for several minutes comparing the arrays before stopping.

Several minutes should give you a hint that your algorithm isn't anywhere
close efficient. Read the FAQ for a much, much, much faster solution.

$$ Any ideas?

Well, what does "stopping" mean? Is that the same a "runtime exception"?
Does the program abort? Do you get an error message? Could you be less
vague in what's happening?



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 30 Sep 1999 14:22:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Runtime exception driving me crazy
Message-Id: <slrn7v7eka.8i.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMCCXXI September MCMXCIII in
<URL:news:MPG.125d4a45c7bb3bbb98a007@nntp.hpl.hp.com>:
{} In article <37F39A7C.2F69363C@ife.ee.ethz.ch> on Thu, 30 Sep 1999 
{} 19:14:36 +0200, Alex Rhomberg <rhomberg@ife.ee.ethz.ch> says...
{} 
{} ...
{} 
{} > PS of what order is a hash lookup?
{} 
{} O(1) 


O (1) expected. O (N) worst case.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 30 Sep 1999 12:58:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: setuid script
Message-Id: <Pine.GSO.4.10.9909301257280.17231-100000@user2.teleport.com>

On Thu, 30 Sep 1999, Pascal Byrne wrote:

> As it turned out the 'Insecure $ENV{PATH} while running setuid' error was
> caused by trying to run a command in backticks from a directory that was not
> in the PATH. So while:
>   $user=`/usr/ucb/whoami`;
> is illegal
>   $ENV{PATH}='/usr/ucb';
>   $user=`/usr/ucb/whoami`;
> is allowed.
> 
> This of course begs the question as to why this is the case?

It's not. Check the perlsec manpage again. Cheers!

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



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

Date: Thu, 30 Sep 1999 19:05:14 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: STDIN & @ARGV
Message-Id: <37F3984A.D1586D6@ife.ee.ethz.ch>

Eisen Chao wrote:
> 
> Howdy All:
> 
> My Question:
> 
>    How do I write a Perl script (to be compiled)
>    that can do all of the following:
> 
>    1) cat SOMEDATA | compiledpl
> 
>              or
> 
>    2) compiledpl -d -s anotherfile morefiles.*
> 
>              as well as
> 
>    3) cat SOMEDATA | compiledpl -d evenmorefiles.*

Tell the caller to append a '-' if she wants to have both stdin and
arguments.
This is a rather standard method.
You can then use <> normally, the '-' will tell it to continue with
stdin.

the third call will then look like
cat SOMEDATA | compiledpl -d evenmorefiles.* -

Example: (The contents of the program are easily seen)

beethoven:~/perl% echo hallo |blops blops
#!/usr/bin/perl -pw
beethoven:~/perl% echo hallo | blops blops -
#!/usr/bin/perl -pw
hallo
beethoven:~/perl% echo hallo |blops
hallo
beethoven:~/perl% echo hallo | blops -
hallo

- Alex


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

Date: Thu, 30 Sep 1999 17:21:49 GMT
From: makau@multimania.com
Subject: strange problem with variable interpolation
Message-Id: <7t066s$afu$1@nnrp1.deja.com>

I want to do this :

$list = '1.2,1.3';
@list = (
    ["a","b","c","d"],
    [$list,1.4,1.5],
);

but perl doesn't apply the interpolation :-(

Any ideas?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 30 Sep 1999 11:17:12 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: strange problem with variable interpolation
Message-Id: <m1r9jgxo0n.fsf@halfdome.holdit.com>

>>>>> "makau" == makau  <makau@multimania.com> writes:

makau> I want to do this :
makau> $list = '1.2,1.3';
makau> @list = (
makau>     ["a","b","c","d"],
makau>     [$list,1.4,1.5],
makau> );

makau> but perl doesn't apply the interpolation :-(

makau> Any ideas?

I would expect that to result in @{$list[1]} having the value
("1.2,1.3", 1.4, 1.5).  If that wasn't your expectation, perhaps you
should adjust your expectation.  You have a single string, being
inserted as a scalar into a list, so it takes up one element.

If you want two elements interpolated, start with a list:

    @data = (1.2, 1.3);

    @list = (["a","b","c","d"], [@data, 1.4, 1.5]);

There.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 30 Sep 1999 11:34:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: strange problem with variable interpolation
Message-Id: <MPG.125d4d0783bdf7f298a008@nntp.hpl.hp.com>

In article <7t066s$afu$1@nnrp1.deja.com> on Thu, 30 Sep 1999 17:21:49 
GMT, makau@multimania.com <makau@multimania.com> says...
> I want to do this :
> 
> $list = '1.2,1.3';
> @list = (
>     ["a","b","c","d"],
>     [$list,1.4,1.5],
> );
> 
> but perl doesn't apply the interpolation :-(
> 
> Any ideas?

It does exactly what you told it to -- it inserts the string '1.2,1.3'.

If you want to insert a list, either split the string:

      [split(/\s*,\s*/ => $list), 1.4, 1.5],

or insert a list explicitly:

  @new_list = (1.2, 1.3);
  ...
      [@new_list, 1.4, 1.5],

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


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

Date: Thu, 30 Sep 1999 12:48:15 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: using CPAN to upgrade perl version
Message-Id: <Pine.GSO.4.10.9909301246190.17231-100000@user2.teleport.com>

On 30 Sep 1999, Danny Aldham wrote:

> I am not sure I would want to, but is it possible to use the CPAN
> module to actually upgrade the version of perl running?

There are some things man was never meant to know.

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



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

Date: Thu, 30 Sep 1999 17:50:41 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Using SS Numbers as DBM Index: Best Way to Encrypt Them
Message-Id: <RpNI3.36$Pq4.5494@typhoon01.swbell.net>

In article <37F38C5C.B0D60F72@mail.tju.edu>,
George Kuetemeyer  <george.kuetemeyer@mail.tju.edu> wrote:
>I need to create several DBM files based on feeds from various campus
>systems. I want to use social security numbers as indices, but would
>like to encrypt them for the sake of privacy. Since I want to use the
>values as unique keys, the encryption method needs to return a unique
>string for each ssn. I tried the crypt function (my $encrypted =
>crypt($ssn, $salt) but it appears to disregard the 9th digit in the ssn,
>thereby returning the same value for ssn's where the first 8 digits are
>the same. I don't  care about decryption, since there's no need to
>retrieve an ssn from the encrypted value. That's why I looked at crypt
>as a solution.

Use Digest::SHA1 and append a goodly amount of really random 
stuff to the end of the SS before hashing it (It would be 
relatively easy to brute force SSs otherwise since they have 
far too few bits of entropy for good security: You could sweep
the whole key space in a couple of hours on a moderately
powered PC. A few minutes perhaps on a well coded cracker.).

-- 
Benjamin Franz


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

Date: 30 Sep 1999 13:07:02 -0500
From: mah@everybody.org (Mark A. Hershberger)
Subject: Re: Using SS Numbers as DBM Index: Best Way to Encrypt Them
Message-Id: <49905op92x.fsf@playpen.baileylink.net>

George Kuetemeyer <george.kuetemeyer@mail.tju.edu> writes:

> I want to use social security numbers as indices, but would
> like to encrypt them for the sake of privacy.

> I don't  care about decryption, since there's no need to
> retrieve an ssn from the encrypted value. That's why I looked at crypt
> as a solution.

Look at MD5 in the Digest::MD5 module.


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

Date: 30 Sep 1999 13:38:29 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: using tr?
Message-Id: <x7ogekuwoa.fsf@home.sysarch.com>

>>>>> "MAH" == Mathew A Hennessy <hennessy@cloud9.net> writes:

  MAH> In article <slrn7v6mho.et6.James@linux.home>, James Stevenson
  MAH> <mistral@stevenson.zetnet.co.uk> wrote:
  >> 
  >> could somebody please send me an example of useing tr in perl

  MAH> 	$ perldoc perlre

BZZZT!! wrong answer. you lose your wager. tr is NOT a regular
expression operator.

please select the next category and question.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 30 Sep 1999 14:23:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: using tr?
Message-Id: <slrn7v7emd.8i.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCCXXI September MCMXCIII in
<URL:news:x7ogekuwoa.fsf@home.sysarch.com>:
() 
() please select the next category and question.


$400 in world capitals please.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 954
*************************************


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