[25539] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7783 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 15 14:05:54 2005

Date: Tue, 15 Feb 2005 11:05:20 -0800 (PST)
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, 15 Feb 2005     Volume: 10 Number: 7783

Today's topics:
    Re: [perl-python] problem: reducing comparison <xah@xahlee.org>
        A wide open niche in Perl publishing... <jkrugman345@yahbitoo.com>
    Re: A wide open niche in Perl publishing... <tzz@lifelogs.com>
        ANNOUCE: Data::Page::Viewport V 1.01 <ron@savage.net.au>
        ANNOUNCE: Date::MSAccess V 1.02 <ron@savage.net.au>
        ANNOUNCE: DBIx::HTML::PopupRadio V 1.10 <ron@savage.net.au>
        Anybody know why pm.org is down? ny10scn@yahoo.com
        forms, cgi - beginner question <jfcampbell@aol.com>
    Re: forms, cgi - beginner question <1usa@llenroc.ude.invalid>
    Re: forms, cgi - beginner question <scobloke2@infotop.co.uk>
    Re: forms, cgi - beginner question <jfcampbell@aol.com>
    Re: forms, cgi - beginner question <jfcampbell@aol.com>
    Re: Mod_perl: can I share a database connection by putt <nobull@mail.com>
    Re: Modification of a read-only value attempted <1usa@llenroc.ude.invalid>
    Re: Modification of a read-only value attempted <nobull@mail.com>
    Re: passing hash and another arg to a sub <matternc@comcast.net>
    Re: Q re guts: where to put breakpoints? <socyl@987jk.com.invalid>
    Re: Record Hash Data Structure (Newbie) xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 15 Feb 2005 04:48:24 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: Re: [perl-python] problem: reducing comparison
Message-Id: <1108471704.220626.27530@g14g2000cwa.googlegroups.com>

here are the answers:

Perl code:

sub reduce ($$) {
my %hh=3D %{$_[0]}; # e.g. {'1,2'=3D>[1,2],'5,6'=3D>[5,6],...}
my ($j1,$j2)=3D($_[1]->[0],$_[1]->[1]);  # e.g. [3,4]
delete $hh{"$j1,$j2"};
foreach my $k (keys %hh) {
        $k=3D~m/^(\d+),(\d+)$/;
        my ($k1,$k2)=3D($1,$2);
        if ($k1=3D=3D$j1) {
            if ($j2 < $k2) {
                delete $hh{"$j2,$k2"};
            }
            else {
                delete $hh{"$k2,$j2"};
            };
        };
        if ($k2=3D=3D$j1) {
            if ($k1 < $j2) {
                delete $hh{"$k1,$j2"};
            }
            else {
                delete $hh{"$j2,$k1"};
            };
        };
    }
return \%hh;
}


=A9Python code.
=A9
=A9def reduce(pairings, pair):
=A9    ps=3Dpairings.copy(); j=3Dpair;
=A9    ps.pop("%d,%d"%(j[0],j[1]),0)
=A9    for k in pairings.itervalues():
=A9        if (k[0]=3D=3Dj[0]):
=A9            if (j[1] < k[1]):
=A9                ps.pop("%d,%d"%(j[1],k[1]),0)
=A9            else:
=A9                ps.pop("%d,%d"%(k[1],j[1]),0)
=A9        if (k[1]=3D=3Dj[0]):
=A9            if (k[0] < j[1]):
=A9                ps.pop("%d,%d"%(k[0],j[1]),0)
=A9            else:
=A9                ps.pop("%d,%d"%(j[1],k[0]),0)
=A9    return ps
=A9

In imperative languages such as Perl and Python and Java, in general it
is not safe to delete elements when looping thru a list-like entity.
(it screws up the iteration) One must make a copy first, and work with
the copy.

Note also that in Python there's already a function called reduce. (it
is equivalent to Mathematica's Fold.) In Python, looks like user can
over-ride default functions.

This post is archived at
http://xahlee.org/perl-python/pairing_reduce.html
Possible errata or addenda will appear there.

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html



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

Date: Tue, 15 Feb 2005 15:04:30 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: A wide open niche in Perl publishing...
Message-Id: <cut31t$4k$1@reader2.panix.com>




Unless I've been looking in all the wrong places, it seems to me
that there's a wide open niche in Perl-related publishing (and in
all of programming-related publishing, for that matter).  I don't
even know what to call the type of book I'm thinking of.  It's
something in the spirit of the (awesome) Perl Cookbook, but dedicated
to larger-scale design issues, instead of bite-sized solutions.

I know of only one such book, in any language.  Its title is
something like "C data base development", and it was written by Al
Stevens.  This book has been long out of print, but when I read it
I thought it was great (even though at the time it was quite above
my head).  During the course of the book, the author implemented
a simple DBMS in C, from scratch; all the code was provided and
the discussion of the major design decisions was the meat of the
book.

I don't know why this sort of book is not more common.  I realize
that the market for beginners' books is much greater, but that
can't be the only consideration for publishing a computer book,
otherwise we'd never see books like "Advanced Perl Programming" or
"Object Oriented Perl" or "Network Programming with Perl".

I realize that it would be impossible to cover the design of a
"real-world" DBMS (or text-editor, or web-browser, etc.) in a
typically-sized book.  By necessity, an application such as Stevens'
C DBMS will have to be a bit of a toy.  But these are toys with
enough complexity in them to force the consideration of important
software engineering issues (code organization, namespaces and
nomenclature, error handling, performance vs. clarity and reuse
potential), and in a concrete context with definite requirements,
trade-offs, and consequences for the project at hand, as opposed
to the stuff one often reads in hifallutin', airy-fairy theoretical
discussions of best programming practices.

jill

-- 
To  s&e^n]d  me  m~a}i]l  r%e*m?o\v[e  bit from my a|d)d:r{e:s]s.



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

Date: Tue, 15 Feb 2005 11:39:43 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: A wide open niche in Perl publishing...
Message-Id: <4npsz1ydyo.fsf@lifelogs.com>

On Tue, 15 Feb 2005, jkrugman345@yahbitoo.com wrote:

> Unless I've been looking in all the wrong places, it seems to me
> that there's a wide open niche in Perl-related publishing (and in
> all of programming-related publishing, for that matter).  I don't
> even know what to call the type of book I'm thinking of.  It's
> something in the spirit of the (awesome) Perl Cookbook, but dedicated
> to larger-scale design issues, instead of bite-sized solutions.
> 
> I know of only one such book, in any language.  Its title is
> something like "C data base development", and it was written by Al
> Stevens.  This book has been long out of print, but when I read it
> I thought it was great (even though at the time it was quite above
> my head).  During the course of the book, the author implemented
> a simple DBMS in C, from scratch; all the code was provided and
> the discussion of the major design decisions was the meat of the
> book.
> 
> I don't know why this sort of book is not more common.  I realize
> that the market for beginners' books is much greater, but that
> can't be the only consideration for publishing a computer book,
> otherwise we'd never see books like "Advanced Perl Programming" or
> "Object Oriented Perl" or "Network Programming with Perl".

You can look at this series of articles (unsorted, start from chapter
6) I wrote:

http://www-128.ibm.com/developerworks/search/searchResults.jsp?searchSite=dW&searchScope=dW&query=cfperl

I explain the way I developed a pretty complex Perl application
(cfperl) that uses Parse::RecDescent and many other useful modules and
techniques.  cfperl complements GNU cfengine, a system administration
tool.  I talk quite a bit about design issues, from the ground up.

As to why this sort of book is not more common - it's not directly
applicable to too many real-world situations, unlike reference or
tutorial books, so there's a smaller audience, IMO.

HTH
Ted


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

Date: Mon, 14 Feb 2005 09:43:36 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUCE: Data::Page::Viewport V 1.01
Message-Id: <IByFCr.o9A@zorch.sf-bay.org>

The pure Perl module Data::Page::Viewport V 1.01
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.

On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.

An extract from the docs:

1.01  Mon Feb 14 09:55:00 2005
	- Change scrolling algorithm in sub offset() to make it DWIM
	- Add sub current() to return the index of the 'current' item on the current page
	- Fix typo: 'bottom' should have been 'right' in some cases
--
Cheers
Ron Savage, ron@savage.net.au on 14/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company




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

Date: Mon, 14 Feb 2005 09:44:06 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: Date::MSAccess V 1.02
Message-Id: <IByFCI.o8L@zorch.sf-bay.org>

 The pure Perl module Date::MSAccess V 1.02
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.

On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.

An extract from the docs:

1.02  Mon Feb 14 09:47:00 2005
	- Fix bug in adding '0' to the start of days in 1 .. 9
--
Cheers
Ron Savage, ron@savage.net.au on 14/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company




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

Date: Mon, 14 Feb 2005 09:44:46 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: DBIx::HTML::PopupRadio V 1.10
Message-Id: <IByFC6.1Drp@zorch.sf-bay.org>

The pure Perl module DBIx::HTML::PopupRadio V 1.10
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.

On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.

An extract from the docs:

1.10  Mon Feb 14 20:08:00 2005
	- Extend the flexibility of the 'prompt' option, to allow it to point to an anonymous
		hash, so you can specify a set of strings, and their corresponding values, to be output
		at the top of the menu. The default behaviour is identical to the previous version.
		Original patch by Sean McKenna
	- Update docs
--
Cheers
Ron Savage, ron@savage.net.au on 14/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company




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

Date: 15 Feb 2005 09:52:41 -0800
From: ny10scn@yahoo.com
Subject: Anybody know why pm.org is down?
Message-Id: <1108489961.157505.252690@f14g2000cwb.googlegroups.com>

Anybody know why pm.org is down?  I googled this group and didn't
necessarily find any sort of notice that pm.org has gone permanently
offline.  And anyway, whois.sc had an updated image as of earlier this
month.

So what gives.  It was inaccessible to me as of 6am this morning, and
now again as of 12 noon.

TIA



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

Date: 15 Feb 2005 09:39:21 -0800
From: "John" <jfcampbell@aol.com>
Subject: forms, cgi - beginner question
Message-Id: <1108489161.543272.82260@c13g2000cwb.googlegroups.com>

I am trying to teach myself enough about cgi to  make a
proof-of-concept demo.

Proposition is that I can use a Web form to collect certain data for a
front end-system.

Not looking for a lesson in HTML.  I've written C programs that, in
turn, write HTML.

Not looking for lessons in Perl, I think. I've just written a batch
e-mail collector in Perl.

I am looking for a lesson in relating my html to my Perl code.  (If
this makes my question off-topic for this group, please send me in the
right direction).

I have searched the FAQs (didn't read them cover to cover) and have not
found the answer I am looking for. So please, if you flame, rip me for
misreading the FAQs, not for ignoring them.

I am working from a book, "CGI Manual of Style," a Ziff-Davis number by
Robert McDaniel.

Page 8 says:
"...when a Web server receives a request for a file contained in in the
subdirectory cgi-bin, it knows that the file is a cgi script and will
run it and return only output from the script.

So here's my page:


<HTML><TITLE>Test  page</TITLE>
<BODY>
<FORM METHOD=POST ACTION="/cgi-bin/example.pl">
Line:<INPUT TYPE=text NAME=namedtext VALUE="today" SIZE=30>
<BR>
<INPUT TYPE=SUBMIT VALUE=Send>
</FORM>
</BODY>


And here's example.pl:
#!/usr/bin/perl -w
print "This is example.pl speaking";


When I hit submit, the address in the browser window changes
to".../cgi-bin/example.pl"
But I do not get "only output from the script." I get the whole
shebang, as it were, with the word "print" etc. in my browser window.

So what am I doing wrong?

A vague question perhaps, but I could do with a pointer to some reading
material.  What would help even more would be five minutes worth of
eye contact with someone who's done this before. There are only
thousands of you. But I don't have that, so I throw myself on the mercy
of this group.

I am trying to work the example using the Web server supplied with  Mac
OS X,10.3.8.
But If I make the internal sale with the demo, the target system would
be an NT or Linux machine.



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

Date: Tue, 15 Feb 2005 17:55:08 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: forms, cgi - beginner question
Message-Id: <Xns95FE836C3A75Fasu1cornelledu@127.0.0.1>

"John" <jfcampbell@aol.com> wrote in
news:1108489161.543272.82260@c13g2000cwb.googlegroups.com: 

> I am trying to teach myself enough about cgi to  make a
> proof-of-concept demo.

 ...

> Page 8 says:
> "...when a Web server receives a request for a file contained in in
> the subdirectory cgi-bin, it knows that the file is a cgi script and
> will run it and return only output from the script.

 ...

> And here's example.pl:
> #!/usr/bin/perl -w

use warnings;

is preferable to the -w switch because it allows you to selectively turn 
warnings on and off.

Also, you are missing:

use strict;

> print "This is example.pl speaking";
> 
> 
> When I hit submit, the address in the browser window changes
> to".../cgi-bin/example.pl"
> But I do not get "only output from the script." I get the whole
> shebang, as it were, with the word "print" etc. in my browser window.

That means your web server is not properly configured.

In addition, the script above is not a valid CGI script. You need to 
send a content-type header.

#! /usr/bin/perl

$| = 1;

use CGI ();

my $cgi = CGI->new;
print $cgi->header('text/plain'), "This is example.pl speaking\n";
__END__

> So what am I doing wrong?
> 
> A vague question perhaps, but I could do with a pointer to some
> reading material.  

perldoc CGI

> What would help even more would be five minutes
> worth of eye contact with someone who's done this before. There are
> only thousands of you. But I don't have that, so I throw myself on the
> mercy of this group.

No need to be overly dramatic. The CGI spec is available online. There 
is a dedicated CGI newsgroup for CGI specific questions. Perl comes with 
an excellent CGI module to make your life easier. Perl has a great FAQ 
list:

perldoc -q CGI

> I am trying to work the example using the Web server supplied with 
> Mac OS X,10.3.8.
> But If I make the internal sale with the demo, the target system would
> be an NT or Linux machine.

That is completely irrelevant.

Sinan.


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

Date: Tue, 15 Feb 2005 18:02:13 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: forms, cgi - beginner question
Message-Id: <cutdf4$crp$1@titan.btinternet.com>

John wrote:
> I am trying to teach myself enough about cgi to  make a
> proof-of-concept demo.
> 
> Proposition is that I can use a Web form to collect certain data for a
> front end-system.
> 
> Not looking for a lesson in HTML.  I've written C programs that, in
> turn, write HTML.
> 
> Not looking for lessons in Perl, I think. I've just written a batch
> e-mail collector in Perl.
> 
> I am looking for a lesson in relating my html to my Perl code.  (If
> this makes my question off-topic for this group, please send me in the
> right direction).
> 
> I have searched the FAQs (didn't read them cover to cover) and have not
> found the answer I am looking for. So please, if you flame, rip me for
> misreading the FAQs, not for ignoring them.
> 
> I am working from a book, "CGI Manual of Style," a Ziff-Davis number by
> Robert McDaniel.
> 
> Page 8 says:
> "...when a Web server receives a request for a file contained in in the
> subdirectory cgi-bin, it knows that the file is a cgi script and will
> run it and return only output from the script.
> 
> So here's my page:
> 
> 
> <HTML><TITLE>Test  page</TITLE>
> <BODY>
> <FORM METHOD=POST ACTION="/cgi-bin/example.pl">
> Line:<INPUT TYPE=text NAME=namedtext VALUE="today" SIZE=30>
> <BR>
> <INPUT TYPE=SUBMIT VALUE=Send>
> </FORM>
> </BODY>
> 
> 
> And here's example.pl:
> #!/usr/bin/perl -w
> print "This is example.pl speaking";
> 
> 
> When I hit submit, the address in the browser window changes
> to".../cgi-bin/example.pl"
> But I do not get "only output from the script." I get the whole
> shebang, as it were, with the word "print" etc. in my browser window.
> 
> So what am I doing wrong?

The common gateway interface (CGI) is a little more complex than you 
assume. To use CGI it is easiest to "use CGI;"

The command "perldoc CGI" may help get you started.

> 
> A vague question perhaps, but I could do with a pointer to some reading
> material.  What would help even more would be five minutes worth of
> eye contact with someone who's done this before. There are only
> thousands of you. But I don't have that, so I throw myself on the mercy
> of this group.
> 
> I am trying to work the example using the Web server supplied with  Mac
> OS X,10.3.8.
> But If I make the internal sale with the demo, the target system would
> be an NT or Linux machine.
> 


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

Date: 15 Feb 2005 10:57:09 -0800
From: "John" <jfcampbell@aol.com>
Subject: Re: forms, cgi - beginner question
Message-Id: <1108493829.019025.81010@g14g2000cwa.googlegroups.com>

I am trying to reconcile these two comments.

Is the web server irrelevant or is the web server the problem?

 >But I do not get "only output from the script." I get the whole
 > shebang, as it were, with the word "print" etc. in my browser
window.

That means your web server is not properly configured.

 > I am trying to work the example using the Web server supplied with
 > Mac OS X,10.3.8.
 > But If I make the internal sale with the demo, the target system
would 
 > be an NT or Linux machine. 

That is completely irrelevant



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

Date: 15 Feb 2005 11:03:48 -0800
From: "John" <jfcampbell@aol.com>
Subject: Re: forms, cgi - beginner question
Message-Id: <1108494227.994002.6410@f14g2000cwb.googlegroups.com>

>The common gateway interface (CGI) is a little more complex than you
assume.

This might well be the answer to my question. Just not the answer I was
hoping for. I was looking for a proof of concept. The concept was that
this was doable with a certain amount of work.

So maybe it's not so doable. Knowing that serves my business purpose.

>The command "perldoc CGI" may help get you started.

Maybe for some. For me, it's starting in the middle.



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

Date: Tue, 15 Feb 2005 17:37:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Mod_perl: can I share a database connection by putting it in the   startup-script?
Message-Id: <cutbm3$2gg$1@sun3.bham.ac.uk>



Keith Keller wrote:
> On 2005-02-14, Brian McCauley <nobull@mail.com> wrote:
> 
>>In mod_perl2 with the next generation of Apache::DBI connection sharing 
>>(or rather pooling) will be apparently supported eventually by some DBDs 
>>- but it will be manged transparently by Apache::DBI.
> 
> 
> In mod_perl1, Apache::DBI can be configured so that each httpd process
> opens its own connection to databases that is shared across scripts
> hitting that httpd.

When you say 'can be configured' this implies that it is not the default 
behaviour of Apache::DBI, but AFIAK this is the default behaviour of 
Apache::DBI, indeed what else doe Apache::DBI do?

> 1) Install Apache::DBI for your version of mod_perl,

Oooh, is Apache::DBI for mod_perl2 available?  I must go get it.



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

Date: Tue, 15 Feb 2005 13:39:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Modification of a read-only value attempted
Message-Id: <Xns95FE581306CC0asu1cornelledu@127.0.0.1>

"Jerry Preston" <g-preston1@ti.com> wrote in
news:curt44$7j6$1@home.itg.ti.com: 

> I do not understand this at all:
> 
>     local( *FI );
>     open( FI, $file ) || die "cannot open input file $file: ";
>     while(<FI>) {   # I get "Modification of a read-only value
>     attempted at 
> $file this line"

Funny ... the error message I get is different:

D:\Home\asu1\UseNet\clpmisc> t
Bareword found where operator expected at D:\Home\asu1\UseNet\clpmisc\t.pl 
line 7, near "$file this"
        (Missing operator before this?)
syntax error at D:\Home\asu1\UseNet\clpmisc\t.pl line 7, near "$file this 
line" Can't find string terminator '"' anywhere before EOF at D:\Home\asu1
\UseNet\clpmisc\t.pl line 7.
 
> I have done this countless number of times.  What is going on?

I do not know. But please read the posting guidelines for this group 
before your next post.

Sinan.


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

Date: Tue, 15 Feb 2005 17:49:30 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Modification of a read-only value attempted
Message-Id: <cutcd3$2pd$1@sun3.bham.ac.uk>



Jerry Preston wrote:

> I do not understand this at all:
> 
>     local( *FI );
>     open( FI, $file ) || die "cannot open input file $file: ";
>     while(<FI>) {   # I get "Modification of a read-only value attempted at
> $file this line"
> 
> I have done this countless number of times.  What is going on?

The while(<HANDLE>) construct does not localize $_ it stomps all over 
whatever's happens to be in $_.  Since $_ is typically an alais to 
something else it also stomps all over that something else.  If you are 
lucky then the something else is a reaonly value and you get an error 
rather than random corruption of another variable.

Some people will tell you to localize $_ beforehand using local($_) but 
this is not safe.  Thay are wrong, do not do that.  If anyone ever tells 
you to do that then tell them that they are wrong.  local($_) does nasty 
things when $_ happens to be an alias to an element of a tied agregate.

If you want to use this technique (other than at the top-level of very 
small scripts, and particularly within subroutines) then you should 
local(*_) beforehand.  This, unfortunately will make @_ inaccessible so 
make sure you've got everything you need from it first.



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

Date: Tue, 15 Feb 2005 06:58:20 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: passing hash and another arg to a sub
Message-Id: <CredncOWnd1DfozfRVn-2g@comcast.com>

mike wrote:

> hi
> 
> i have something like this
> %names = (1=>['TEST','12345','testuser'],
>           2=>['TEST USER','12345','testuser1']);
> 
> do_something(%names,'ABC');
> 
> 
> sub do_something {
> my (%hash,$abc) = @_;

This assigns *all* of @_ to %hash.  $abc
gets no value.

> print "abc = $abc";
> 
> while ( my ($keys,$val) = each(%hash) )
> {
>  print "key = $keys, value = $val\n";
> }
> 
> }
> 
> i got the output
> abc =
> key = ABC, value =
> key = 1, value = ARRAY(0x1abeff4)
> key = 2, value = ARRAY(0x1abf0fc)
> 
> 
> why does 'ABC' become a key inside the hash?? 

Because that's how the assignment you wrote works.  If you're
passing a list through @_, it has to be the only list and it
has to be *last*, because it'll slurp all the remaining values
out of @_.  Try it like this:

do_something('ABC', %names);

and

my ($abc, %hash) = @_;


> I think there's someting 
> wrong with passing the @_.
> thanks for any help

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Tue, 15 Feb 2005 11:59:47 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: Re: Q re guts: where to put breakpoints?
Message-Id: <cuso7j$oni$1@reader2.panix.com>


Thanks, Ilya, those are great tricks.  Just what I was looking for.

kj
-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


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

Date: 15 Feb 2005 17:26:27 GMT
From: xhoster@gmail.com
Subject: Re: Record Hash Data Structure (Newbie)
Message-Id: <20050215122627.375$Pd@newsreader.com>

rajasekaran.natarajan@gmail.com wrote:
>
> I have also given the input data format. I need to link the generated
> hash data to the element hash which I am gonna do later in the second
> part. Basically every element has four grids and each grid has x,y,z
> corordinates. + 2 more field. which kind of format is better to store
> this and retrieve it for almost a 300,000 elements.

If you try to store this as 300,000 hashes, you may run into memory
problems due the large amount of overhead with hashes.  It depends on
how much memory you have, of course.  I might be tempted to switch to
parallel hashes for each field, each with 300,000 entries.  More annoying
to work with in some ways, but more memory efficient.

> ps: I tried to use `use strict` but it makes life harder for a newbie
> like me. any better detailed source abt the use strict stuff.

We were all newbies at one point, and trust us, "use strict" does not make
your life harder.  It may seem that way at first, but remember that you
came here for our wisdom, and this is the centerpiece of that wisdom.  Use
strict.

For detailed info, see perldoc strict, and the section on "my" in
perldoc perlfunc.  And perldoc perlsub.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 7783
***************************************


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