[13941] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1351 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 11 18:05:38 1999

Date: Thu, 11 Nov 1999 15:05:22 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942361521-v9-i1351@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 Nov 1999     Volume: 9 Number: 1351

Today's topics:
    Re: Activeperl install fails <wayne.izatt@myself.com>
        Apache 1.3.9 and mod_perl 1.21problems lmoloch@my-deja.com
    Re: Apache 1.3.9 and mod_perl 1.21problems (Mark Badolato)
    Re: CGI ERROR (Michel Dalle)
    Re: CSV Parsing Revisited (long - 98 lines) <jeff@vpservices.com>
    Re: CSV Parsing Revisited (long - 98 lines) (Ken Bandes)
    Re: DBI and max number of connections <makkulka@cisco.com>
    Re: Dumb Newbie date question timfi@my-deja.com
    Re: Dumb Newbie date question <jtolley@bellatlantic.net>
    Re: Dumb Newbie date question <vincent.murphy@cybertrust.gte.com>
    Re: Dumb Newbie date question <lr@hpl.hp.com>
    Re: Dumb Newbie date question <arnej@fc.hp.com>
        freeing memory timfi@my-deja.com
        freeing memory timfi@my-deja.com
    Re: freeing memory <lr@hpl.hp.com>
    Re: funny behaviour of Perl how to run perl script as a (Martien Verbruggen)
    Re: funny behaviour of Perl <lr@hpl.hp.com>
        Help Wanted: populating a directory of useful online re <dan@freelancers.net>
        help with hash?  <timc@ans.net>
    Re: help with hash? <emschwar@rmi.net>
        Help with Stoopid Nutscrape (Netscape) <expoinfo@globalexpos.co.nz>
    Re: Help with Stoopid Nutscrape (Netscape) <newsposter@cthulhu.demon.nl>
        HELP: putting an @array into an %array??? (Bruno Boettcher)
    Re: HELP: putting an @array into an %array??? <makarand_kulkarni@my-deja.com>
    Re: I need the current path <makkulka@cisco.com>
    Re: Image type conversion??? (Martien Verbruggen)
        mSQL <erick.jensen@unisys.com>
    Re: mSQL <J.E.J.opdenBrouw@st.hhs.nl>
        mySql, DBI, and pop-up menus <forddavi@pilot.msu.edu>
        Need Help with Named Pipes Please <andrew.fase@stud.umist.ac.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 11 Nov 1999 19:34:04 GMT
From: Wayne Izatt <wayne.izatt@myself.com>
Subject: Re: Activeperl install fails
Message-Id: <382B1965.EC8A0867@myself.com>

I believe the ActiveState folk use VC++ to build the NT version. Building on NT
is pretty simple, and fairly well documented here and there.

Richard Hensh wrote:

> I have just experienced THE InstallShield problem with Activeperl's latest
> version (build 522). Now I can not seem to install Perl on my NT machine.
> In particular, I get the error message "could not load the perl interpreter"
> that others have experienced so it seems that I am not alone. None of the
> suggested workarounds were successful.
>
> Is there another way to install this build without using InstallShield?
>
> Has anyone built from source on an NT machine? If so, which compiler was
> used?
>
> thanks
> ricky



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

Date: Thu, 11 Nov 1999 20:06:07 GMT
From: lmoloch@my-deja.com
Subject: Apache 1.3.9 and mod_perl 1.21problems
Message-Id: <80f7jc$ajj$1@nnrp1.deja.com>

Hello.

I have been trying to get apache 1.3.9 to work with mod_perl 1.21

I follow the instructions in the Mod_perl-1.21\INSTALL.win32 file which
instructs me to:
"
run 'perl Makefile.PL'
run 'nmake install'

This will install the Perl side of mod_perl and setup files for the
library build.
"

When I run 'perl Makefile.pl', I get:

-----------------
D:\MOD_PE~1.21>perl Makefile.PL
Checking if your kit is complete...
Looks good
Have D:\perl\lib\MSWin32-x86\Config.pm expected C:\perl\lib\MSWin32-x86
\Config.pm
Your perl and your Config.pm seem to have different ideas about the
architecture
they are running on.
Perl thinks: [MSWin32-x86]
Config says: [MSWin32-x86]
This may or may not cause problems. Please check your installation of
perl if you
have problems building this extension.
 ....
Writing Makefile for Apache::URI
Have D:\perl\lib\MSWin32-x86\Config.pm expected C:\perl\lib\MSWin32-x86
\Config.pm
Your perl and your Config.pm seem to have different ideas about the
architecture
they are running on.
Perl thinks: [MSWin32-x86]
Config says: [MSWin32-x86]
This may or may not cause problems. Please check your installation of
perl if you
have problems building this extension.
Writing Makefile for Apache::Util
Writing Makefile for mod_perl
---------------------

when i run 'nmake install', I get:
------------------------
D:\MOD_PE~1.21>D:\ssafe\VC\bin\nmake install

Microsoft (R) Program Maintenance Utility  Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.

mkdir blib
mkdir blib\lib
 ...
cp mod_perl.pod blib\lib\mod_perl.pod
cp lib/Apache/Constants/Exports.pm
blib\lib\Apache\Constants\Exports.p ...
cp lib/Apache/RedirectLogFix.pm blib\lib\Apache\RedirectLogFix.pm cp
lib/Apache/MyConfig.pm blib\lib\Apache\MyConfig.pm
cp lib/Apache/RegistryBB.pm blib\lib\Apache\RegistryBB.pm
The name specified is not recognized as an
internal or external command, operable program or batch file.
NMAKE : fatal error U1077: 'cd' : return code '0x1'
Stop.


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


Please advise. Thank you.




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


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

Date: 11 Nov 1999 21:04:52 GMT
From: mbadolato@quepasa.com (Mark Badolato)
Subject: Re: Apache 1.3.9 and mod_perl 1.21problems
Message-Id: <8E7B8CEA1mbadolatoquepasacom@4.22.39.123>

On 11 Nov 1999, lmoloch@my-deja.com wrote in
<80f7jc$ajj$1@nnrp1.deja.com>: 

>Hello.
>
>I have been trying to get apache 1.3.9 to work with mod_perl 1.21
>
>I follow the instructions in the Mod_perl-1.21\INSTALL.win32 file
>which instructs me to:
>"
>run 'perl Makefile.PL'
>run 'nmake install'
>


If you're trying to install in Windows, why not just use the
mod_perl binary for win32 already created? 

http://www.perl.com/CPAN-local/authors/Jeffrey_Baker/

--Mark


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

Date: Thu, 11 Nov 1999 22:21:17 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: CGI ERROR
Message-Id: <80ffij$5tk$1@xenon.inbe.net>

In article <U5EW3.53006$5W2.1317919@news6.giganews.com>, "Chad G. Lauhon" <ctl@cyrunner.net> wrote:
>CGI ERROR
>==========================================
>Error Message       : fatal error: flock() unimplemented on this platform
>
>Can someone help me?? Ive got Win98SE and Microsofts Personal Web Server.

Well, it means that flock() is ... unimplemented on Win98.

Let me guess :
1) you never heard the expression RTFM before
2) you don't know that ActivePerl comes with a bunch of documentation,
that you can find in your Programs/ActivePerl/Online Documentation.
3) you never read the ActivePerl FAQ, especially the part about 'Quirks'
in Windows 95/NT. You don't need to read it all, just scan the titles.

Besides, are you sure your database works on Win98 too ?

Good luck,

Michel.


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

Date: 11 Nov 1999 18:23:58 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: CSV Parsing Revisited (long - 98 lines)
Message-Id: <382B0978.51402F4E@vpservices.com>

Ken Bandes wrote:
> 
> 2.  Within quoted fields, a newline is not special.  A field can span
>     multiple lines in a CSV file.  You can't process a CSV file by
>     reading a record and then parsing it, because you don't know
>     where the record ends until it's parsed.
> 
> The CPAN CSV modules get the bit about two quotes, but don't handle
> multi-line fields.  They assume you can read a record (line) first and
> pass it to a parser.

I think you are wrong about that.  The modules do handle multi-line
fields.  Using either DBD::ODBC with the CSV (Text files) driver or
DBD::CSV, I can do the following (note the \n in the field):

$dbh->do("CREATE TABLE $table ( field1 TEXT )");
$dbh->do("INSERT INTO $table VALUES ('Hello\nnew\nworld!')");
my $sth = $dbh->prepare("SELECT * FROM $table WHERE field1 LIKE
'Hello%'");
$sth->execute();
while (my($string) = $sth->fetchrow_array) { print "$string"; }

This prints the words "Hello", "new", "world!" on three separate lines.

-- 
Jeff


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

Date: Thu, 11 Nov 1999 21:56:02 GMT
From: kbandes@home.com (Ken Bandes)
Subject: Re: CSV Parsing Revisited (long - 98 lines)
Message-Id: <8E7BAD9CAkbandeshomecom@192.168.123.1>

jeff@vpservices.com (Jeff Zucker) wrote in
<382B0978.51402F4E@vpservices.com>: 

>Ken Bandes wrote:
>> 
>> 2.  Within quoted fields, a newline is not special.  A field can
>> span 
>>     multiple lines in a CSV file.  You can't process a CSV file by
>>     reading a record and then parsing it, because you don't know
>>     where the record ends until it's parsed.
>> 
>> The CPAN CSV modules get the bit about two quotes, but don't
>> handle multi-line fields.  They assume you can read a record
>> (line) first and pass it to a parser.
>
>I think you are wrong about that.  The modules do handle multi-line
>fields.  Using either DBD::ODBC with the CSV (Text files) driver or
>DBD::CSV, I can do the following (note the \n in the field):
 ...

You're right, this works with DBD::CSV.  But using Text::CSV_XS
directly, it does not appear to work using the getline method,
which takes an io handle.  (This is strange because DBD::CSV uses
Text::CSV_XS.)  And Text::CSV doesn't even have a method that takes a
handle, only one that takes a line to parse.

Thanks for pointing out DBD:CSV.  Maybe that's what should be in the
FAQ.

Ken Bandes


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

Date: Thu, 11 Nov 1999 13:14:07 -0800
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: DBI and max number of connections
Message-Id: <382B319F.9ADA337C@cisco.com>

john kelly wrote:

> Does DBI use Oracle's OCI interface?

yes.
http://hazmat.fms.indiana.edu/DBD-DBI/DBD-Oracle.html
--




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

Date: Thu, 11 Nov 1999 19:17:16 GMT
From: timfi@my-deja.com
Subject: Re: Dumb Newbie date question
Message-Id: <80f4nh$87a$1@nnrp1.deja.com>

In article <80f373$741$1@nnrp1.deja.com>,
  crackbaby1@my-deja.com wrote:
> Just want to know how to create a variable with the current y2k date
in
> it.
>
> Ex. 19991111
>
> Currently using
>
> $today_is=>($year,$mon,$mday)=localtime(time);
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

localtime returns tm_year in years since 1900.  Your above code would
return 991111.  You need to add 1900 to your year to get it in a Y2K
compliant form.


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


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

Date: Thu, 11 Nov 1999 19:36:18 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: Dumb Newbie date question
Message-Id: <38208E44.DD740D55@bellatlantic.net>

crackbaby1@my-deja.com wrote:
> 
> Just want to know how to create a variable with the current y2k date in
> it.
> 
> Currently using
> 
> $today_is=>($year,$mon,$mday)=localtime(time);

If you have perl on your system, try this at the command prompt:

perldoc -f localtime

And for other useful bits:

perldoc perl
perldoc perldoc

hth,

James


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

Date: Thu, 11 Nov 1999 19:33:45 GMT
From: Vincent Murphy <vincent.murphy@cybertrust.gte.com>
Subject: Re: Dumb Newbie date question
Message-Id: <xjgd7tgsu07.fsf@gamora.ndhm.gtegsc.com>

>>>>> "crackbaby1" == crackbaby1  <crackbaby1@my-deja.com> writes:

    crackbaby1> Just want to know how to create a variable with the current y2k date in
    crackbaby1> it.

    crackbaby1> Ex. 19991111

    crackbaby1> Currently using

    crackbaby1> $today_is=>($year,$mon,$mday)=localtime(time);

This would be cool syntax if it worked!

You could probably do something like:

($y,$m,$d)=(localtime)[5,4,3];
$today_is=sprintf('%04d%02d%02d', $y+1900,$m+1,$d);



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

Date: Thu, 11 Nov 1999 12:00:30 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Dumb Newbie date question
Message-Id: <MPG.1294c03a515ba7a298a1de@nntp.hpl.hp.com>

In article <80f4nh$87a$1@nnrp1.deja.com> on Thu, 11 Nov 1999 19:17:16 
GMT, timfi@my-deja.com <timfi@my-deja.com> says...
> In article <80f373$741$1@nnrp1.deja.com>,
>   crackbaby1@my-deja.com wrote:
> > Just want to know how to create a variable with the current y2k date
> > in it.
> >
> > Ex. 19991111
> >
> > Currently using
> >
> > $today_is=>($year,$mon,$mday)=localtime(time);

What is that supposed to mean?  Evaluate $today_is in null context, 
throw away the value, then store the seconds, minutes, and hours returns 
from localtime() into variables named $year, $mon, $mday.  Sheesh!  
What's wrong with posting real code instead of this nonsense?

 ...

> localtime returns tm_year in years since 1900.  Your above code would
> return 991111.  You need to add 1900 to your year to get it in a Y2K
> compliant form.

No, it would return the list (99, 10, 11) if it were written correctly:

    my ($year, $mon, $mday) = (localtime)[5, 4, 3];

You need also to add 1 to your month to get it into normal human-
compliant form.

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


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

Date: Thu, 11 Nov 1999 13:05:48 -0700
From: Arne Jamtgaard <arnej@fc.hp.com>
Subject: Re: Dumb Newbie date question
Message-Id: <382B219C.3E97@fc.hp.com>

timfi@my-deja.com wrote:
> 
> In article <80f373$741$1@nnrp1.deja.com>,
>   crackbaby1@my-deja.com wrote:
> > Just want to know how to create a variable with the current y2k date
> in
> > it.
> >
> > Ex. 19991111
> >
> > Currently using
> >
> > $today_is=>($year,$mon,$mday)=localtime(time);

> localtime returns tm_year in years since 1900.  Your above code would
> return 991111.  You need to add 1900 to your year to get it in a Y2K
> compliant form.

And don't forget that month is 0-based, so you'd need to add 1 to it.

Arne
-- 
"If you take cranberries and stew them like applesauce, they 
taste much more like prunes than rhubarb does." -Groucho Marx


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

Date: Thu, 11 Nov 1999 19:07:39 GMT
From: timfi@my-deja.com
Subject: freeing memory
Message-Id: <80f45g$7nq$1@nnrp1.deja.com>

What is the best way to reuse memory of a
reference to a complex data structure, i.e. a
reference to a hash of hashes of hashes?


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


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

Date: Thu, 11 Nov 1999 19:10:24 GMT
From: timfi@my-deja.com
Subject: freeing memory
Message-Id: <80f4an$820$1@nnrp1.deja.com>

What is the best way to free memory for a complex data structure, i.e.
hash of hashes of hashes?


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


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

Date: Thu, 11 Nov 1999 12:05:10 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: freeing memory
Message-Id: <MPG.1294c15522e557a298a1df@nntp.hpl.hp.com>

In article <80f4an$820$1@nnrp1.deja.com> on Thu, 11 Nov 1999 19:10:24 
GMT, timfi@my-deja.com <timfi@my-deja.com> says...
> What is the best way to free memory for a complex data structure, i.e.
> hash of hashes of hashes?

Why posted twice, with slightly different texts?

    %hash = ();

Alternatively,

    undef %hash;

But that is slightly misleading, as the hash is still defined, though 
empty.

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


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

Date: Thu, 11 Nov 1999 22:13:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: funny behaviour of Perl how to run perl script as a command
Message-Id: <0cHW3.35$GC6.2005@nsw.nnrp.telstra.net>

[Your news reader seems to have a chronology problem. Your answer to
the quoted text actually came before the quote itself. Fixed it in
this post, please reset the clock of your machine]

On Thu, 11 Nov 1999 12:38:10 -0600,
	Navin Chander <navin@ti.com> wrote:
> Mark Bluemel wrote:
> > In article <382AF5D6.BC3FAA4B@ti.com>, Navin Chander <navin@ti.com>
> > wrote:
> > > If  I try to execute a perl fileby just specifying its name it
> > > does not
> > > work.
> > > $prompt> execute_file.pl

Have you tried something like

$ ./execute_file.pl

? There maybe is another execute_file.pl in your path somewhere before
that one? Try a 

$ which execute_file.pl

If that doesn't point to the local file, I suggest you may have found
your problem (and please, don't fix it by adding '.' to your search
path. That should be considered a bad thing)

> >
> > But you don't show us what _does_ happen - do you get an error message?
>
> My apologies for not not specifying my problem correctly.  I do not
> get an error message. As soon as I press the enter key, it just
> hangs.  I am working on a SUN workstation and I have the execute
> permissions on the file.

I find it very odd that it just hangs. It should at least do
something. What happens to the CPU? Are you maybe trying to read from
STDIN? or are you using something like

while(<>) { }

in your code? Or are you using the p or n flags?

If not:

Can you do something like:

$ which perl

and

$ head -1 execute_file.pl

For both those answers, if different, do 

$ /path/to/perl -v

If those two are not the same, then you need to fix that. Make sure
that first line doesn't just contain #!/usr/local/bin/perl, but that
it actually contains the path to the perl that you want to use.

If your program is short, maybe you should send it to here if you
can't resolve it, together with the output of the abovementioned
commands. And saying 'Sun Workstation' isn't really enough. You could
be running linux on Sparc as far as we know. If you think it may be an
OS issue, show us the output of

# uname -a

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | This matter is best disposed of from
Commercial Dynamics Pty. Ltd.   | a great height, over water.
NSW, Australia                  | 


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

Date: Thu, 11 Nov 1999 11:53:39 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: funny behaviour of Perl
Message-Id: <MPG.1294bea1674cdd2598a1dd@nntp.hpl.hp.com>

In article <80f2id$6kp$1@nnrp1.deja.com> on Thu, 11 Nov 1999 18:40:20 
GMT, emarkert@my-deja.com <emarkert@my-deja.com> says...
> Well since you didn't state the OS you are using it makes it a bit
> difficult to help...
> 
> However, if you are running this on UNIX it is most likely a permission
> problem.  Make sure that you have this file set for at least r-x--x--x.

It needs to be r-x for any attempt to execute it.  So the --x fields are 
useless.  rwxr-xr-x is typical.

> If it's Windoze then make sure that the .pl extension is associate with
> the perl binary perl.exe
> 
> In article <80f27i$68k$1@nnrp1.deja.com>,
>   Dick Latshaw <latsharj@my-deja.com> wrote:

<SNIP> complete post quoted after the response.  Please don't do that!

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


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

Date: Thu, 11 Nov 1999 19:15:23 +0000
From: Dan Winchester <dan@freelancers.net>
Subject: Help Wanted: populating a directory of useful online resources
Message-Id: <382B15CB.90BC0C8C@freelancers.net>

Hi,

I'm compiling a directory of useful online resources, including perl
resources, for web and multimedia freelancers and professionals for
Freelancers.net.

Please let me know about those sites you keep going back to for help
when you've got a site building problem, be they FAQs, quick-references,
tutorials, articles etc.

You can submit a site online at:

http://www.freelancers.net/resources

Or just mail the URL to me and I'll add it.

Thanks

Dan Winchester
Freelancers.net
(Jobs and Freelancers)
http://dan.freelancers.net


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

Date: Thu, 11 Nov 1999 19:23:26 +0000
From: Tim Condit <timc@ans.net>
Subject: help with hash? 
Message-Id: <Pine.GSO.3.95.991111192115.20546G-100000@arsenic.aa.ans.net>


Hello, 

I've got a problem with this script, and would appreciate some help. What
I want it to do is allow the user to input a query, and a variable number
of answers. I've been through both Learning Perl and Programming Perl, but
really don't understand how to do this. For a single instance of the hash,
ie: one key, I get the behavior I expect. Adding another hash element
doesn't work quite as well.

Here's a trimmed down version:

#!/usr/local/bin/perl -w

$version = 'hashOfArrays.01';
$datafile = "/timc/data/$version";

print "New entry? ";
chomp ($new = <STDIN>);

dbmopen(%ASCEND, "$datafile", 0644) or die \
    "Couldn't open $version: $!\n";

while ($new eq "y") {
    
    print "Please enter query: ";
    chomp ($query = <STDIN>);
    
    $continue = "y";
    while ($continue eq "y") {
        print "Please enter answer: ";
        chomp ($answer = <STDIN>);
        
        $ASCEND{$query} = push (@answer, $answer);
        print "Continue? ";
        chomp ($continue = <STDIN>);
    }
    
    print "Another new? ";
    chomp ($new = <STDIN>);
}

print "Query: \n\t", keys %ASCEND, "\n";
print "Answer(s): \n";
for ($i = 0; $i <= $#answer; $i++) {
    print "\t$answer[$i]\n";
}

dbmclose(%ASCEND);



And here's some output:

arsenic:~/play/db> ./hashOfArrays.01
New entry? y
Please enter query: drinking
Please enter answer: kool-aid
Continue? y
Please enter answer: orange juice
Continue? y
Please enter answer: mountain dew
Continue? n
Another new? y
Please enter query: driving
Please enter answer: honda
Continue? y
Please enter answer: ford
Continue? y
Please enter answer: chevy
Continue? n
Another new? n
Query: 
        drinkingdriving
Answer(s): 
        kool-aid
        orange juice
        mountain dew
        honda
        ford
        chevy

Drinking and driving don't mix! How can I sort this out, so I have two
discrete hashes? 

Thanks in advance!



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

Date: 11 Nov 1999 13:38:36 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: help with hash?
Message-Id: <xkfwvro7ohf.fsf@valdemar.col.hp.com>

Tim Condit <timc@ans.net> writes:
> I've got a problem with this script, and would appreciate some help. What
> I want it to do is allow the user to input a query, and a variable number
> of answers. I've been through both Learning Perl and Programming Perl, but
> really don't understand how to do this. For a single instance of the hash,
> ie: one key, I get the behavior I expect. Adding another hash element
> doesn't work quite as well.

"doesn't work quite as well" isn't very meaningful.  We don't know what
it does, what you expected it to do, and how those differ.  Obviously,
for instance, you want more than to allow the user to input the query and 
answers, because you're storing them in a DBM file-- but you didn't
mention that.

> Here's a trimmed down version:
> 
> #!/usr/local/bin/perl -w

-w is good! No "use strict;" is bad, however.

> $version = 'hashOfArrays.01';
> $datafile = "/timc/data/$version";
> 
> print "New entry? ";
> chomp ($new = <STDIN>);
> 
> dbmopen(%ASCEND, "$datafile", 0644) or die \
>     "Couldn't open $version: $!\n";
> 
> while ($new eq "y") {
>     
>     print "Please enter query: ";
>     chomp ($query = <STDIN>);
>     
>     $continue = "y";
>     while ($continue eq "y") {
>         print "Please enter answer: ";
>         chomp ($answer = <STDIN>);
>         
>         $ASCEND{$query} = push (@answer, $answer);

Using my PSI::ESP module, I divine that this line is likely the source of 
most of your problems, and would have been alleviated if you'd used
strict, as that would have forced you to explicitly scope your @answer
variable.

See, here you are adding all the answers ever given to all the querys to
@answers, but @answers is never cleared out between queries.  Therefore
the second one will have all the answers the first one has, plus whatever 
answers apply to it.

Furthermore, a hash stores a scalar, not an array, so you'll have to
store a reference to the array (probably an anonymous copy of it,
actually) instead of storing the array explicitly.

>         print "Continue? ";
>         chomp ($continue = <STDIN>);
>     }
>     
>     print "Another new? ";
>     chomp ($new = <STDIN>);
> }
> 
> print "Query: \n\t", keys %ASCEND, "\n";

You say "Query" here, but you're printing out all the queries at once.
That's liable to be very confusing to your users, let alone me.

> print "Answer(s): \n";
> for ($i = 0; $i <= $#answer; $i++) {
>     print "\t$answer[$i]\n";
> }

And there you print out all the answers at once, instead of reading them
from the hash-- therefore you get all the answers to all the queries (the 
way you designed it, anyway), instead of pairing them up, which seems
more like what you wanted.

> dbmclose(%ASCEND);

You probably want to check for success here-- although your data sets are 
currently very tiny, you may eventually exceed the amount of data allowed 
in a DBM file, depending on implementation.

> Drinking and driving don't mix! How can I sort this out, so I have two
> discrete hashes? 

Well, if that's what you want, then use two discrete hashes.  But what I
think you want instead is to have one hash, with multiple keys, each one
with its own array of values.

Go back through the camel, and read chapter 4.  Also read the perlref
manpage, and the bits of the FAQ that deal with references.

> Thanks in advance!

You're welcome.

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


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

Date: Fri, 12 Nov 1999 11:05:12 +1300
From: Andrew Broadley <expoinfo@globalexpos.co.nz>
Subject: Help with Stoopid Nutscrape (Netscape)
Message-Id: <382B3D98.C1C6B43A@globalexpos.co.nz>

Hi all,

When i print out on my perl script... IE is fine.. but Netscape only
prints the HTML code... why is that ?

ALL Help muchly appreciated!!

--
<x-rich>Thanks,


Andrew Broadley

Information Technology

GLOBAL EXPOS (NZ) LIMITED


http://www.globalexpos.co.nz

<italic>"Better business using the power of the Internet

and the face-to-face advantage of exhibitions"

</italic>

E-mail me on my cellphone:

0212956648@messagetracker.co.nz

           (max <bold>146</bold> characters)


</x-rich>




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

Date: 11 Nov 1999 22:32:52 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Help with Stoopid Nutscrape (Netscape)
Message-Id: <80fg6k$f9b$1@internal-news.uu.net>

Andrew Broadley <expoinfo@globalexpos.co.nz> wrote:

> When i print out on my perl script... IE is fine.. but Netscape only
> prints the HTML code... why is that ?

Make sure the HTML is correct.

Erik



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

Date: 11 Nov 1999 21:07:59 +0100
From: bboett@erm1.u-strasbg.fr (Bruno Boettcher)
Subject: HELP: putting an @array into an %array???
Message-Id: <80f7mv$o93$1@erm1.u-strasbg.fr>

Hello,

i am writing a perl script for my benchmarking, creating the system call that
will be issued, using the perl timing facility to mesure elapsed tim ad making
averages....

now there's where my problem occurs, each type of problem is computed with
different timings, producing a variable sized array, this array was then
supposed to be stored in another one.....

i tryed the following code:
my %finalResults;
for(my $i=$startSize; $i < $stopSize; $i+= $sizeStep)
{
  ...
  my @timelist;
  for(my $n=$startTime; $n < $stopTime; $n+= $timeStep)
  {
    ....
    for(my $z=0; $z<$averageSteps; $z++)
    {
        ...
    }#for(my $z=0; $z<$averageSteps; $z++)
    push(@timelist,$average);
  }#for(my $n=$startTime; $i < $maxTimeIters; $i+= $sizeTime))
  $finalresult{$i}=@timelist;
}#for($i=0; $i < $m; $i++)

open(FILE,">".$simulator.$name.$type."log") || die("couldnt open result file");
foreach $line (keys(%finalresult))
{
  print FILE $line." ";
  my @anAr = $finalresult{$line};
  foreach $entry (@anAr) { print FILE $entry." ";}
  print FILE "\n";
}# foreach $line (keys(%finalresult))
close FILE;


but this doesn't work..... what's stored is the number of elements of the
subarray, and not the array....
So somewhere i am mangling again the different ways of sight.... what would be
the correct way?

-- 
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....


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

Date: Thu, 11 Nov 1999 22:22:21 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: HELP: putting an @array into an %array???
Message-Id: <80ffio$h0t$1@nnrp1.deja.com>

In article <80f7mv$o93$1@erm1.u-strasbg.fr>,
  bboett@erm1.u-strasbg.fr wrote:

> i am writing a perl script for my benchmarking, creating the system
call that
> will be issued, using the perl timing facility to mesure elapsed tim
ad making
> averages....
>
use the module provided for this purpose.
use Benchmark;

read perldoc  Benchmark
--


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


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

Date: Thu, 11 Nov 1999 13:07:13 -0800
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: I need the current path
Message-Id: <382B3001.790D56A8@cisco.com>

krun@my-deja.com wrote:

> Hi all, i'm writing a perl script and this file will be in randomn
> directories. I need to know the whole path where this file is.

use Cwd;
--



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

Date: Thu, 11 Nov 1999 22:23:07 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Image type conversion???
Message-Id: <flHW3.44$GC6.2005@nsw.nnrp.telstra.net>

On Wed, 10 Nov 1999 13:18:47 -0800,
	Darrell <darrell.r.hougenNOdaSPAM@lmco.com.invalid> wrote:
> I am trying to find a perl module that performs image type conversion. 

I believe I answered this in clp.modules. For future reference, if you
want to post the same message to multiple groups, do that with a
crosspost. That way, you only send one message which becomes available
in each group, and responses will be available in both groups as well.
Saves you the trouble of having to keep track of two threads, and it
saves us the trouble of having to figure out whether we just read it
or not.

Mind you, don't just blindly crosspost everywhere. in
news.announce.newusers you will find a FAQ explaining all this.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.   | Gates?
NSW, Australia                  | 


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

Date: Thu, 11 Nov 1999 16:23:41 -0500
From: "Erick Jensen" <erick.jensen@unisys.com>
Subject: mSQL
Message-Id: <80fc51$drp$1@mail.pl.unisys.com>

Does anyone know of a good reference (web site, book, etc.) for accessing an
mSQL database with Perl?




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

Date: Thu, 11 Nov 1999 22:35:22 +0100
From: "J.E.J. op den Brouw" <J.E.J.opdenBrouw@st.hhs.nl>
Subject: Re: mSQL
Message-Id: <382B369A.58B1A7C5@st.hhs.nl>

There is an:

"Official Guide To Mini SQL"

by the author of mSQL.

ISBN: 0-471-24535-6

Allthough it is based on 2.0.3, it's worth reading.
It does not only cover Perl, but also Java, C and PHP.
Chapter 9 is of interest: Perl CGi programming with
DBI and DBD::mSQL


Erick Jensen wrote:
> 
> Does anyone know of a good reference (web site, book, etc.) for accessing an
> mSQL database with Perl?

--jesse


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

Date: Thu, 11 Nov 1999 16:33:47 -0500
From: "Davis Ford" <forddavi@pilot.msu.edu>
Subject: mySql, DBI, and pop-up menus
Message-Id: <80fcva$kje$1@msunews.cl.msu.edu>

Hello, I want to create a pop-up menu (drop-down list) html form object
where the options for the list will
come from a DBI query.

I have tried this code, which did not work:

$stm = $dbh->prepare("SELECT projName FROM project") or die "Unable to
prepare sql: $dbh->errstr\n";

then later...

while (my $ref = $stm->fetchrow_arrayref)
{
        @project = (\"%s\", $$ref[0];
}

then the drop down box (using CGI.pm)

print $q->popup_menu( -name=>'Projects', -values=>\@project, -default=>'
' );

This creates a pop-up menu with an array reference in it.  However, if I do
this;

foreach $item( @project ){
    print $item;
}

It only prints the very first item in what should be a list of 3-4 items.
So, I have a couple of problems here...

1. My code to store the DB results in an array @project only seems to store
the first item.
2. My code using CGI.pm which should list the values of the array is showing
in hexadecimal.

Can anyone help me with the syntax?  Thanks in advance!

Davis





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

Date: Thu, 11 Nov 1999 19:16:41 +0000
From: FASE Andrew <andrew.fase@stud.umist.ac.uk>
Subject: Need Help with Named Pipes Please
Message-Id: <382B1618.E61C3886@stud.umist.ac.uk>

Hello

I am trying to make two seperate process's communicate using named pipes

I have written 2 perl programs and have been able to get them to work
fine

The problem is that i want one process to be a CGI script!! and so far
had no luck trying to get the script to communicate with the other
process....as far as i can see i have written the code exactly the same
but when the script opens the pipe it just doesnt do anything. Its meant
to wait untill both sides of the pipe have been opened i.e one to read
one to write but it still doesnt do anything....i dont
understand...whats different ??? the only thing i could think of is the
script is running as user 'noone' but the pipe has permissions so anyone
can read or write from it, so should make no difference

Can anyone give me any advice or help please?? i would be very gratfull

Andy
andrew.fase@stud.umist.ac.uk



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

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


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