[7381] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1006 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 10 13:17:23 1997

Date: Wed, 10 Sep 97 10:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 10 Sep 1997     Volume: 8 Number: 1006

Today's topics:
     Re: Advice on "including" files (Andrew M. Langmead)
     Re: array of references won't work <r.goeggel@atos-group.de>
     Re: backreferences and /i in regex (Andreas Karrer)
     Re: Building dynamically named arrays <r.goeggel@atos-group.de>
     Re: C++Builder means Future. (Kevin Simonson)
     Re: Call remote perl script in another script (Greg Aiken)
     Re: Calling a sub function on submit <fishrman@shell.wco.com>
     Re: Converting strings to numbers (William Wue(2xP)elma(2xN))
     Re: Cookies <jason@syrres.com>
     Exporting and the first parameter (Leonhard Brenner)
     Re: hash of objects vs array of objects <doug@tc.net>
     Hotel Deadline Sept 22 - USENIX Conf on Domain-Specific (Jackson Dodd)
     How can I prompt the user? (Pascal Lamoureux)
     M$ WORD convertor <Jan.Vajda@somi.sk>
     make: *** File Makefile' has modification time in the f (John M. Klassa)
     Re: make: *** File Makefile' has modification time in t (John M. Klassa)
     Re: Making a Swiss-Army Knife HTML tool in Perl lvirden@cas.org
     Re: Matrices in Perl (Tom Grydeland)
     Re: Matrices in Perl (SJK)
     Re: Minimizing Memory Needed for Numbers Read from Bina <Brett.W.Denner@lmtas.lmco.com>
     Need to load a Perl CGI script on a Web server (Greg Aiken)
     Newbie Needs help! <circuitrdr@geocities.com>
     Perl and Database (Jun Zhuang)
     perl script works differently on solaris and linux <lo1be.kkrehe01@eds.com>
     Re: perldoc (Kevin)
     Solved: easy instalation of IlyaZ's Perl in DOS (Petr Prikryl)
     Re: STDIN buffer empty ? (Tad McClellan)
     Web/Systems Architect Position <cgaston@lds.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 10 Sep 1997 16:27:11 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Advice on "including" files
Message-Id: <EGAwDB.830@world.std.com>

"Robert J. Alexander" <bob@inorbit.com.NOSPAM> writes:


>I have a common set of variables to be shared by different source files
>in perl 5.004.

>If I do the following all is OK :

>perl.inc
>--------
>$myvar1 = "abcdef";
>$myvar2 = 12345;

>perlprog.pl
>-----------
>do 'perl.inc';
>print "My include variable \$myvar1 holds $myvar1\n";


>but if I want to use the 'use strict;' clause in my perlprog.pl I
>correctly get an error $myvar1 not being declared with a my() ....

>How should I correctly employ "C-like includes" in my programs keeping
>the "use strict" construct ???

If what you really want is "C-like includes", your best bet is the
"-P" switch. (If your C compiler supports passing non-C code through
cpp) Perl's "use", "require" and "do" are runtime statements, closer
to saying

    eval `cat filename`;

than a pre-compilation text substitution.


Here are some other hints, that might shake your from your C mindset.

1. Perl's my() variables are like block scoped, and the outermost
scope is a the file or level. (Variables outside of any block act more
like C's file scoped static variables than globals. Inaccessible
outside the current file.)

2. The purpose of "use strict qw(vars)" is not "keep all variables
declared with my()". but the more general "prevent problems due to
dynamic scoping."  Declaring variables with my() is one way, the
"strict" man page mentions some others. (look for Fully qualified
variable names.)

3. Check the "vars" pragma. "use vars qw($myvars1 $myvars2);"

4. Consider creating a module to "use" instead of a file to "do". then
the Exporter module can cleanly export variables into the caller.
-- 
Andrew Langmead


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

Date: 10 Sep 1997 14:23:40 GMT
From: Ronald Gvggel <r.goeggel@atos-group.de>
Subject: Re: array of references won't work
Message-Id: <5v6ahc$nu8$1@news.pop-stuttgart.de>


matlar@rsv.se (Mats Larsson) wrote: > 
 
<snip> 

> $one = "Stockholm";
> $two = "Rome";
> 
> # array of references won't work
> # @tab = (\$one, \$two);
> $tab[0] = \$one;
> $tab[1] = \$two;
> # both of the two methods above tested, neither works as intended
> print $$tab[0],"\n";     # ? prints just an empty line
> print $tab[0],@\n";      # prints address to scalar 

<snip>

I had the same problem and I solved it in 2 steps:
$temp = $tab[0];   # get the reference
print $$temp,"\n"; # use the reference

this works also with refences to arrays or hashes e.p.

@list = (1, 2, 3);
$tab[2] = \@list;
$temp = $tab[2];   # get the reference
print reverse @$temp; # use the reference -> this prints 321.

I hope this will help you

Ronald


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

Date: 10 Sep 1997 15:43:24 GMT
From: karrer@ife.ee.ethz.ch (Andreas Karrer)
Subject: Re: backreferences and /i in regex
Message-Id: <slrn61dg0r.b0a.karrer@kuru.ee.ethz.ch>

In article <slrn61dapq.v2n.tom@mitra.phys.uit.no>, Tom Grydeland wrote:

>1)  The backreference *must* match have the same text (including
>    capitalisation) as the original text

That's what perl5.003nn .. 5.00400 did. nn is somewhere around 09.

>2)  The backreference *must* match have the same text (ignoring case)
>    as the original text

That's what perl2, perl3, perl4, perl5 up to perl5.00308 or so, and
perl5.00401 and later do.

That is, /(<\w+>).*\1/i  *will* match the string  "<foo> bar <fOo>"
in *most* versions of perl.


 - Andi


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

Date: 10 Sep 1997 14:33:42 GMT
From: Ronald Gvggel <r.goeggel@atos-group.de>
Subject: Re: Building dynamically named arrays
Message-Id: <5v6b46$o35$1@news.pop-stuttgart.de>

Matt Noel <mgn00@eng.amdahl.com> write: > 
> I would like to read some data into multiple associative arrays, where
> the array names are based on the data in the file.
> 
> Specifically, a trivial example would be a set of data like this:
> 
> ---------------------------------------------------
> ArrayOne:one:I
> ArrayOne:two:II
> ArrayOne:three:III
> ArrayTwo:one:1
> ArrayTwo:two:2
> ArrayTwo:three:3
> -----------------------------------
> 
> I would like to treat the first thing ('ArrayOne' and 'ArrayTwo' in this
> case) as the name of an associative array.  I would treat the other two
> values as an index into the array, and a value to store at that index.
> 
> I was trying to figure out how to do this with type globbing, reading
> the description of it in the original camel book (pages 101-102) but I
> can't get anything to work.
> 
The camel book is a good reference. Look at "eval".

> Can anyone help out?  I'd really like to get by with a solution which
> works with perl 4.* as I need to port this to a system where the latest
> level of perl is 4.36.
> 
> -- 
> 		Matt Noel                    mgn00@eng.amdahl.com
> 		Amdahl Corporation           Phone (408) 746-6283

Best regards
Ronald


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

Date: 10 Sep 1997 15:54:18 GMT
From: simonson@eagle.uis.edu (Kevin Simonson)
Subject: Re: C++Builder means Future.
Message-Id: <5v6fra$chj@eagle.uis.edu>

Kaz Kylheku (kaz@helios.crest.nt.com) wrote:
: In article <5utbuo$j9a$1@earth.execpc.com>,
: Steve Mading <madings@earth.execpc.com> wrote:

: >The AS/400 looked to me to be nothing more than a leftover of
: >IBM's past era of computers designed to be nice for COBOL people
: >but awful for everyone else.

: Did you ever look into the News/400 magazine (or whatever it's called?) It's
: chock full of horrid programming examples, in which the first column of each
: line has to have some letter like 'D' or 'I'.  These cavemen are still stuck
: in the days of punched cards.  Well over thirty years of free form lexical
: analysis in programming languages seems to have passed them over.

After having been a developer on the AS/400 for a little over a year now, I
find it a very solid and simple platform for development.  The current
version of RPG -- RPGIV allows free form code to some extent.  IBM's ILE
environment allows the programmer to control binding methods and the extent
to which modular architecture is used on a module by module basis.  

The integration of development languages that reside on the '400 with the OS
and DB2/400 allow for very rapid development of bulletproof mission-critical 
applications--from personal experience.  

We recently upgraded to a 64-bit RISC AS/400 from an older model machine in
one weekend without incident, with all programs and source intact.  The
current box also has built-in web server capability.  My shop has been
w/AS/400 since the system/36 days, and it has never crashed...not even once.
	
The primary client side software is usually a simple 5250 'green screen'
emulation that is very very friendly on client resources.   

Our users are happy and safe, the data is happy and safe, the programmers
are happy and safe, and I find the lack of bullshit bells-and-whistles to be
very refreshing.

Also, we NEVER have arguments about coding style...:)

--
Kevin Simonson                      * AS/400 Application Development Team
U of I Springfield/Computer Science * Norwest Mortgage, Inc.
simonson@eagle.uis.edu              * Springfield, IL
		-- Insert Banal Homily Here --


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

Date: Wed, 10 Sep 1997 07:51:56 -0800
From: grega9@mail.idt.net (Greg Aiken)
Subject: Re: Call remote perl script in another script
Message-Id: <grega9-1009970751560001@acs-center20.ucsd.edu>

In article <5v4q2m$l61$1@scapa.cs.ualberta.ca>, wtang@cs.ualberta.ca (Wei
Tang) wrote:

> Hi, there:
> 
> I have two Perl scripts which are on two servers (I have to place
> them on two servers), say site1-perl and site2-perl. I want to run
> site1-perl as a cron job and call site2-perl in site1-perl, let
> site2-perl query a database and then return the results to site1-perl.
> 
> Both scripts can be accessed using URL naming convention.
> 
> Is that possible? Which is the easiest way? I don't want to implement 
> the httpd protocol by myself.
> 
> Please help me out. Thanks.
> 
> CC: wtang@cs.ualberta.ca

You can build your solution using HTTP, or whatever protocol you like. 
When you say you don't want to build HTTP yourself - this is the wrong way
to look at this.  HTTP is already a well defined and documented protocol
(search the internet W3 consortiums' page for the appropriate RFC
documents to get the details of this protocol).  Anyway, HTTP is based on
WWW clients and servers - if you already have this infrastructure in
place, then its clearly possible to use CGI scripting and a Web server, as
well as a Perl client program as the basis for this query response
solution.  As well, if all you need to do is a simple query response,
and/or if you don't already have a Web server already in place, its also
fairly trivial for you to write a Perl server application (which must be
continuously running as a server process tied to some unused port) which
would run on site2, as well to write the Perl client application which
basically establishes a socket connection to the specific server.  Once
the socket is established, its trivial to read/and write data through the
socket, based on YOUR defined protocol.  I've done this myself, and I
don't consider myself to be a Perl guru or expert.

ps - perhaps you can help me with my problem.  I have a Web site
(shell.idt.net/~grega9/home_.htm) that has an HTML form.  I have already
written and tested a Perl CGI script that basically takes this form,
manipulates the content found therein, and sends back to the clients
browser a fully formatted form letter that they can locally print to
facilitate their ordering of my products.  Unfortunately, my service
provider wants to charge me $600 year, to upgrade my web service to a
domain class so that I'd have access to run CGI scripts on their server. 
I'd be willing to help you out if you could let me run my single CGI
script on one of your web servers.  If you want to discuss this further,
please reach me at (grega9@mail.idt.net)


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

Date: 10 Sep 1997 15:49:51 GMT
From: "Michael A. Watson" <fishrman@shell.wco.com>
Subject: Re: Calling a sub function on submit
Message-Id: <5v6fiv$5qp$1@news.wco.com>


I had a similar dilema and solved it in the following manner:
I created a hidden <input> filed on the form that I called mode.
In my script I have a conditional statement that checks the value
of the form field "mode after a submit and conditionally calls
the appropriate subroutine. So all of my forms call the same CGI
script, but with a different value in the mode field.



fischers@execpc.com wrote:
> Here is a dilly of a problem.
> I have a perl script that updates a database.  I want to do a 'onSubmit'
> button that calls a sub function in the current script.  Problem is,
> when the form is submitted, the script looks for the function on my
> server, not in the script itself.  How do I get the script to look for
> the function in itself, not on the server?



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

Date: Wed, 10 Sep 1997 14:54:07 GMT
From: williamw@rooster.igs.deleteTheRooster.net (William Wue(2xP)elma(2xN))
Subject: Re: Converting strings to numbers
Message-Id: <3416b063.4926687@news.igs.net>

On Tue, 9 Sep 1997 14:45:24 -0700, Tom Phoenix <rootbeer@teleport.com>
wrote:

>On 8 Sep 1997, John J Holden wrote:
>
>> I'm using a form on a web page to read some numbers into a perl program.
>> These numbers then need to be written to a file for a Fortran program to
>> subsequently read. It is vital that these numbers are valid and do not
>> contain non-numeric characters. 
>
>What's a non-numeric character? A hyphen? The letter E? A period? A comma? 
>:-) Do any of these have non-numeric characters? (They're all "valid
>numbers" to me! :-) 


Normally, files are saved in text mode, so a number like 1000 is saved
as the string "1000". If you're reading that number back to your
Fortran program in binary, it will read 31h 30h 30h 30h, which can
mean many things depending on how you tell the program to interpret
the numbers. If you're reading the file back in text mode, you have to
have some way to tell the Fortran program that the number you want is
1000, not two numbers: 100 and 0, or 10 and 00 or 10 and 0 and 0 or
whatever.
-------------------------
William Wue(2xP)elma(2xN)
Reply-To: williamw (at) igs (dot) net
--------------------------------------------------------------
It is pitch black. You are likely to receive spam from a grue.


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

Date: Wed, 10 Sep 1997 12:45:29 -0400
From: Jason Crowther <jason@syrres.com>
Subject: Re: Cookies
Message-Id: <3416CEA9.446B@syrres.com>

Stephen Hill wrote:

> Does anyone know if you can set a cookie by calling the cookie script
> with an image tag? And if so, how do you do it?

I don't think its possible because you can't set a cookie after you've
given the content type.  (You couldn't see the page if you hadn't
already printed out the content type...)

=====================================================================
Jason J. Crowther                                   jason@pop.cny.com
=====================================================================
Software Engineer
Syracuse Research Corporation ATC
=====================================================================
My video card has more memory than my first PC compatible.
=====================================================================


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

Date: 10 Sep 1997 10:50:23 -0400
From: brenner@slpyff.ed.ray.com (Leonhard Brenner)
Subject: Exporting and the first parameter
Message-Id: <su2lo15rzo0.fsf@slpyff.ed.ray.com>

After running the following script I get these results:

Results:
-------
This is DOCLIB, DOCLIB=HASH(0xa5cec)
Param is Fooooo!
====
This is , FOOOO
Param is !

script:
------
package DOCLIB;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(foo);

sub new{
  my $type = shift;
  my $self = {};
  
  $self->{fizzle} = shift;
  return bless $self, $type;
}

sub foo {
   my $self = shift;
   my $param = shift;
   my $foo = ref($self);
   print "This is $foo, $self\n";
   print "Param is $param!\n";
}

package main;
import DOCLIB qw(foo);

$obj = new DOCLIB();
$obj->foo("Fooooo");
print "====\n";
foo("FOOOO");

How can I get the second call to work the same as the first? What is
the standard way of handling this? And what is different the
$obj-foo('fooo') call.

Thanks in advance for any help or consideration
Lenny Brenner brenner@ed.ray.com
-- 
________________________________________________________________
                                                 __  _-==-=_,-.
Leonhard Brenner                                /--`' \_@~@.--<
Thinking People Inc.                            `--'\ \  <___>.
E-mail: brenner@lbrenner.ne.mediaone.net             \ \\   " /     
Phone: (508)-647-4074                                 >=\\_/`< 
                                                     /= |  \_/
                                                   _/=== \__/
________________________________________________________________


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

Date: 10 Sep 1997 11:12:55 -0400
From: Douglas McNaught <doug@tc.net>
To: Michael Bueno <tech-support@valueclick.com>
Subject: Re: hash of objects vs array of objects
Message-Id: <m2vi09mcco.fsf@ono.tc.net>

[mailed and posted]

Michael Bueno <tech-support@valueclick.com> writes:

>         $ad_entry = AdEntry->new();
> 
>         push(@add_entries, $ad_entry);
>         $score{$ad_entry} = ${ $ad_entry->{fields} }[19]{value}; 

[...]

>     foreach $ad_entry (sort { $score{$a} <=> $score{$b} } keys %score) {
>         print "$ad_entry ";
>         $ad_entry->hi();

You can't key a hash on an object reference (or any kind of reference
for that matter).  The ref gets converted to a string, which is fine
for keying hashes, but can't be converted back to a reference and used 
to invoke object methods.  You'll have to store the actual reference
in your hash values somewhere.

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: Wed, 10 Sep 1997 16:35:33 GMT
From: jackson@usenix.org (Jackson Dodd)
Subject: Hotel Deadline Sept 22 - USENIX Conf on Domain-Specific Languages (DSL)
Message-Id: <EGAwr9.7n4@usenix.org>
Keywords: USENIX, conference, domain-specific languages


Conference on Domain-Specific Languages (DSL 97)
October 15-17, 1997
Santa Barbara, California

Sponsored by USENIX, the Advanced Computing Systems Association
In cooperation with ACM SIGPLAN and SIGSOFT

Software engineers and programmers:  Join your peers at DSL 97.

If you work with or are interested in domain-specific languages 
and need the latest information, mark your calendar now and plan 
to attend this workshop.

USENIX's Conference on Domain-Specific Languages offers the latest
research during two and one-half days of refereed paper presentations, 
invited talks by noted experts, Birds-of-a-Feather sessions, and
opportunities to meet your peers and share solutions.

You will learn about the newest research during these refereed 
paper sessions:
--Domain-Specific Language Design
--Experience Reports
--Compiler Infrastructure for Domain-Specific Languages
--Logic and Semantics
--Case Studies and Surveys
--Abstract Syntax Trees
--Embedded Languages and Abstract Data Types

=============================================================
FOR DETAILED PROGRAM AND REGISTRATION INFORMATION:

* See the DSL homepage:  http://www.usenix.org/events/dsl97/  
* Send email to: info@usenix.org.  In the body of your message
  state "send dsl97 conferences" 
* Call the USENIX Conference Office at 714-588-8649
* Send a fax to 714-588-9706
=============================================================

The USENIX Association brings together the community of engineers,
system administrators,  scientists, and technicians working on the
cutting edge of computing. Its technical conferences are the essential
meeting grounds for the presentation and discussion of the most
advanced information on new developments in all aspects of advanced
computing systems.





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

Date: Wed, 10 Sep 1997 19:21:56 GMT
From: pascal@granby.net (Pascal Lamoureux)
Subject: How can I prompt the user?
Message-Id: <5v6h3f$50g$1@wagner.videotron.net>

Is there a way in perl to prompt the user...
ie. getting info from the stdin.

I tried whit read but I think I'm not using it correctly (I cannot get
out of the prompt unless I do ^C) 

Thanks for the hint,

Pascal





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

Date: 10 Sep 1997 17:02:43 GMT
From: Kozo <Jan.Vajda@somi.sk>
Subject: M$ WORD convertor
Message-Id: <5v6jrj$qkc@gringo.somi.sk>

is any M$ word convertor to plain text or 
any_other_text in perl5 ?

(LAOLA is not too good for me )

I have idea build a web site which will convert
on-fly *.DOC to HTML 

have U any tip ??

thanks ..

			kozo

            ----------------------------------------------------
                       posted by WWWNews gateway v1.12
               (c) 1997 Somi Systems Ltd. http://www.somi.sk/
               somi.sk is NOT the originators of the articles 
                 and are NOT responsible for their content.


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

Date: 10 Sep 1997 12:41:21 GMT
From: klassa@aursgh.aur.alcatel.com (John M. Klassa)
Subject: make: *** File Makefile' has modification time in the future
Message-Id: <5v64hh$n79$1@aurwww.aur.alcatel.com>

I've been trying to install some perl modules into one of my own directories
(as opposed to the system-wide location, which is writable only by our
sysadmin staff).  When I do a "make Makefile.PL ; make" (whether manually or
through CPAN.pm's shell mode), I get:

	make: *** File Makefile' has modification time in the future

I've never seen this before...  I know what causes the message to pop out
(i.e. I know that Makefile has a timestamp that's actually in the future),
but *why* does Makefile have a timestamp that's in the future? What causes
this?  Anybody else seen this?

Thanks!
John

-- 
John Klassa / Alcatel Telecom / Raleigh, NC, USA


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

Date: 10 Sep 1997 13:40:21 GMT
From: klassa@aursgh.aur.alcatel.com (John M. Klassa)
Subject: Re: make: *** File Makefile' has modification time in the future
Message-Id: <5v6805$1bb$1@aurwww.aur.alcatel.com>

Note that my return address is "klassa@aur.alcatel.com"...  Sorry for
the misconfiguration.

John

-- 
John Klassa / Alcatel Telecom / Raleigh, NC, USA


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

Date: 10 Sep 1997 15:27:52 GMT
From: lvirden@cas.org
Subject: Re: Making a Swiss-Army Knife HTML tool in Perl
Message-Id: <5v6e9o$nhg$6@srv38s4u.cas.org>


According to T. Wheeler <twheeler@m-net.arbornet.org>:
:I am wanting to deelop a do-it-all perl tool that will take plain text
:files and create decent formatted HTML.  Once it is completed, I will
:post it in th epublic domain for all to use.
 
I recommend you see about incorporating the best text to html tool
I've seen:
 
<URL: http://www.cs.wustl.edu/~seth/txt2html/ >
-- 
Larry W. Virden                 INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.


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

Date: 10 Sep 1997 15:50:33 GMT
From: tom@mitra.phys.uit.no (Tom Grydeland)
Subject: Re: Matrices in Perl
Message-Id: <slrn61dge9.v2n.tom@mitra.phys.uit.no>

On	Wed, 10 Sep 97 10:02:32 -0400, Brandon S. Allbery KF8NH; to
reply, change "void" to "kf8nh" <bsa@void.apk.net> wrote:

By doing that I figured you didn't want a reply.

> Perl, as with just about every computer language except BASIC, starts array
> numbering with 0.

Whoops.  There's FORTRAN and derivates, MatLab, and, I'm sure, others.

> If you really want 1-based arrays, you can set the special variable $[ to 1. 

This is heavily deprecated.  You'll break every piece of code you use.

> (But since BASIC is the "odd one out", you might be better off looking up
> OPTION BASE in your BASIC manual....)

Indeed. :-)

> brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Wed, 10 Sep 1997 16:50:51 GMT
From: knetsch@golden.net.no.spam (SJK)
Subject: Re: Matrices in Perl
Message-Id: <3416cfe7.2775069@news.golden.net>

On 10 Sep 1997 12:46:46 GMT, dblack@icarus.shu.edu (David Alan Black) wrote:

>Hello -
>
>akil1@mindspring.com (Kevin Bass) writes:
>
>>(1)
>>@matrix = (
>>	[1, 2, 3 ],
>>	[4, 5, 6 ],
>>	[7, 8, 9]
>>);
>>$matrix [1]  [2] = 100;
>
>>Why would the value of 6 at row 1, column 2 in the matrix change to
>>100?  Why wouldn't the answer be a change of value 2 in the matrix?
>
>Because $matrix[1] is a list reference.  The list to which
>it is a reference has three elements, initially: (4,5,6).
>You then assign 100 to element 2.
>
>Note that you could also write: $matrix[1]->[2] = 100; which
>more graphically displays the dereferencing of the list
>reference.

Remember, list references start at 0

the number pairs of your matrix would be

0,0   0,1   0,2   <--- row 0
1,0   1,1   1,2   <--- row 1
2,0   2,1   2,2   <--- row 2
  |        |       |
col0 col1 col2 

Therefore  $matrix[1][2] points to the SECOND row and the THIRD column, which
previously held the value 6.


>>(2)
>>Why would the following created the answer (matrix) below?
>>$matrix {0} {2} = 100;
>>$matrix {1} {0} = 200;
>>$matrix {2} {1} = 300;
>
>>answer
>>[0, 0, 100]
>>[200, 0, 0]
>>[0, 300, 0]
>
>I'm not sure what you mean here.  The assignments you've
>written create a hash called %matrix.  It has three keys.
>Each of the corresponding values is an anonymous hash
>reference.  Each of the anonymous hashes so referenced
>has one key, and the values for those keys are 100, 200, 300.
>What you've written under "answer" are expressions evaluating
>to list anonymous list references - I'm not sure where that
>came from, or where it fits in.  Maybe there's an intervening
>step that could clarify the connection?
>
>
>David Black
>dblack@icarus.shu.edu
 
I believe Kevin is trying to create a two dimensional hash.  If you look at the
values he assigns to the hash, you see that they correspond to the row,value
positions of the matrix (Start counting from 0).

To my surprise, this actually works.

Try running the following

$matrix {0}{0} = 11;
$matrix {0}{1} = 12;
$matrix {0}{2} = 13;
$matrix {1}{0} = 21;
$matrix {1}{1} = 22;
$matrix {1}{2} = 23;
$matrix {2}{0} = 31;
$matrix {2}{1} = 32;
$matrix {2}{2} = 33;

print ("$matrix{0}{0} ");
print ("$matrix{0}{1} ");
print ("$matrix{0}{2}\n");
print ("$matrix{1}{0} ");
print ("$matrix{1}{1} ");
print ("$matrix{1}{2}\n");
print ("$matrix{2}{0} ");
print ("$matrix{2}{1} ");
print ("$matrix{2}{2}\n");

You will get

11 12 13
21 22 23
31 32 33

Which can be viewed as a matrix.

As far as I can understand, three hashes are created, one for each row.  Each
hash row has three elements which hold three values. 

Am I interpreting this correctly?

Still a newbie and learning every day.

Stuart Knetsch

Remove the you know what from my address to send me E-mail


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

Date: Wed, 10 Sep 1997 09:16:44 -0500
From: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
To: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: Minimizing Memory Needed for Numbers Read from Binary Files
Message-Id: <3416ABCC.167E@lmtas.lmco.com>

Ilya Zakharevich wrote:

> Everything is OK in *my* perl.  Your "unpack" looks broken indeed, try
> to add 0 to the results,
>         0 + unpack "f", $string;

Curiously, adding '0 +' to my unpack() uses *more* memory than before.
Strange.

Brett

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Brett W. Denner                                    Lockheed Martin TAS
 Brett.W.Denner@lmtas.lmco.com                      P.O. Box
748            
 (817) 935-1144 (voice)                             Fort Worth, TX 76101
 (817) 935-1212 (fax)                               MZ 9333


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

Date: Wed, 10 Sep 1997 07:54:55 -0800
From: grega9@mail.idt.net (Greg Aiken)
Subject: Need to load a Perl CGI script on a Web server
Message-Id: <grega9-1009970754550001@acs-center20.ucsd.edu>

Does anyone know where one can upload Perl CGI scripts on a configured Web
server for the purposes of testing their script?  I don't want to have to
spend any more than I already do for my internet access $30/month to do
this.  I'm sure someone could tell me of such a directory thats configured
as both an FTP upload site as well as a CGI directory.  Thanks,
grega9@mail.idt.net


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

Date: Wed, 10 Sep 1997 12:47:22 GMT
From: "Larry G. Dunn" <circuitrdr@geocities.com>
Subject: Newbie Needs help!
Message-Id: <341696DA.7D0A274E@geocities.com>


I am a "newbie" when it comes to PERL progamming. What I need
to be able to do is to change into a directory without knowing
ahead of time what the name of the directory is going to be.

In other words, I want to be able to do something like:

	cd newdirectory*

The directory is a composition of the date and time of day that
the directory is created. Anyone with code "frags" or if someone
might suggest a way this can best be done please mail me at:

	dunn.l.g@wcsmail.com


Thanks in advance,

Larry Dunn
Westinghouse Communications
(412) 244-6559


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

Date: 10 Sep 1997 15:10:04 GMT
From: jzhuang@ringer.cs.utsa.edu (Jun Zhuang)
Subject: Perl and Database
Message-Id: <5v6d8c$d7g@ringer.cs.utsa.edu>


I have try to use some database modules for Perl5. For instance,
Sprote. But I found Sprite only support simple format such as:
   name age  ID
   Joe  25   007
   Mary 18   009
which first line has to be the line contain definitions.

But I have some scientific datbase such as:

Record_009	mouse_A		DNA clone
Date cloned	090197  
Cloner		Dr. John Smith
DNA sequence	atgcggggggatcgagtcgggggggggggggggccccctaaaaaaaaaa
actecccccccccccccctttttttttttgactagggggggggtccccccctttttttttttaa
Animal Species	Mus Domestic
Drug tested	AK45


Which every first word of the line is the definition.

Is there  any more complicated database module for perl5?


--
Jun Zhuang                         |Jun Zhuang 
Department of Computer Science     |Department of Pharmacology
University of Texas                |UT Health Science Center
San Antonio, Texas                 |San Antonio, Texas
Email: jzhuang@ringer.utsa.edu     |Email: zhuang@uthscsa.edu
                                   |       jun@gcrdb.uthscsa.edu


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

Date: Wed, 10 Sep 1997 13:58:20 +0200
From: Karsten Kreher <lo1be.kkrehe01@eds.com>
Subject: perl script works differently on solaris and linux
Message-Id: <34168B5C.1E02@eds.com>

I have a perl script that produces different output on Solaris and
Linux...
I'm clueless on how to find the error/difference.
These's no system interaction but reading a text file and manipulating
it.
The output on the Linux machine seems to be "correct", since it is the
same
that the original bourne shell script gives. When I try to execute 

Maybe somebody has a suggestion?!

Karsten Kreher


############################################

Linux:
perl -v

This is perl, version 5.003 with EMBED
        built under linux at Aug 21 1996 12:57:07
        + suidperl security patch

Solaris:
/net/appl/sun/bin/perl -v
 
This is perl, version 5.003 with EMBED
        built under solaris at Jan 12 1997 16:11:29
        + suidperl security patch

##############################################

The script:
#!/usr/bin/perl

$infile=$ARGV[0];

open(TESTFILE,"$infile") || die "\n kann inputfile nicht oeffnen!\n";

$no=0;

# rectype recname recalt recver reclevel id   unixalias
# typ     name    seq    ver    level    file alias

while (<TESTFILE>) {
        # Inputzeile $_ auf die Variablen aufsplitten
        (       $typ[$no],
                $name[$no],
                $seq[$no],
                $ver[$no],
                $level[$no],
                $file[$no],
                $alias[$no]) = split(' ',$_);
        $no++;  # Zaehler aller Objekte
}

# der Level muss wg. UG Bug in Kleinbuchstaben gewandelt werden
for ($i=0; $i<$no; $i++) {
        $level[$i] =~ tr/A-Z/a-z/;
}

# alle vorhandenen Level herausfinden
# fuer alle vorhandenen Level den jeweiligen Zaehler heraufsetzen
for (@level) {
        $level_count{$_}++;
}
for (sort keys %level_count) {
        #       print "$_ $level_count{$_}\n";
        $FILEHANDLE=FH.$_;
        open $FILEHANDLE, ">$infile.$_";
}

# Hauptschleife ueber alle Objekte
$last_i = 0;

for ($i=0; $i<$no; $i++) {
  # falls
  #  a) erstes Objekt bearbeitet wird oder
  #  b) typ/name/seq anders als beim letzten bearbeiteten Objekt ist
  # dann soll es genommen werden, ansonsten ist es lediglich
  # eine aeltere Version (die uebrigens auch in einem niedrigeren
  # Release-Level stehen kann)
  if (($i==0) or
    ($typ[$i]  ne $typ[$last_i] ) or
    ($name[$i] ne $name[$last_i]) or
    ($seq[$i]  ne $seq[$last_i] )) {
    # alle ausser DWGFMT, DWGFMT nur falls im RELEASE
    if (($typ[$i] ne "DWGFMT") or
      ($typ[$i] eq "DWGFMT") and ($level[$i] eq "release")) {
          # incative soll im approved erscheinen
          if ($level[$i] eq "inactive") {
            $level[$i] = "approved"
          }
          # Ausgabe in File, aber: don't show MLREF in WIP and PENDING
          if (($typ[$i] ne "MLREF") or
            ($level[$i] eq "approved")) {
              $FILEHANDLE=FH.$level[$i];
              select $FILEHANDLE;
              # typ name seq ver level file alias
              #print "$typ[$i] $name[$i] $seq[$i] $ver[$i] $level[$i]
$file[$i] $alias[$i]\n";
              print "$file[$i] $alias[$i]\n";
          }
    }
    # Wert merken, um mit dem letzten zu vergleichen
    $last_i = $i;
  }
}
# files schliessen
for (sort keys %level_count) {
    #   print "$_ $level_count{$_}\n";
    $FILEHANDLE=FH.$_;
    close $FILEHANDLE
}


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

Date: 10 Sep 1997 08:57:03 -0700
From: klander@primenet (Kevin)
Subject: Re: perldoc
Message-Id: <3416c274.432579876@news.primenet.com>

On 8 Sep 1997 12:56:28 GMT, mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
>Kevin <klander@primenet> wrote:
>>The previous perl installation here was pretty screwed up, so maybe
>>it's screwing this one up too...
>
>Hmmm.   Perhaps you are getting the wrong version of perldoc?   Try running
>it as
>
>     /explicit/path/to/bin/perldoc IO::Socket
>

It was running the correct perldoc, but that perldoc was calling
/usr/local/bin/perl5, which is version 5.001 (I left the old version
when I installed 5.00401 because initial testing found some 5.001
scripts that don't work under 5.00401 and I don't have the time right
now to port them).  I changed it to call perl5.00401, and it works
fine now.  Jeez, this is a mess.

Thanks.

-Kevin


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

Date: 10 Sep 1997 16:06:09 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: Solved: easy instalation of IlyaZ's Perl in DOS
Message-Id: <5v6ghh$shv$1@boco.fee.vutbr.cz>

If you are interested in the extremely easy instalation of the latest
Ilya Zakharevich's port of Perl under DOS or Windows, check the following
URL:

    http://www.fee.vutbr.cz/~prikryl/tools.html


You can find there three archive files with the support and the description
which starts:
------------------------------------------------------------------------
Instalation of Ilya Zakharevich's perl 5.004 under DOS
------------------------------------------------------

The istalation is based on the document README.os2 (POD format)
included in the Ilya Zakharewich's port of Perl. I routinely use
the same instalation in MS-DOS (version 6.22), Windows 3.1, and
Windows'95. 

The Perl can be installed from within plain MS-DOS or from DOS
window in Microsoft Windows. 

This file and also the archive files with support for instalation of
the Ilya Zakharewich's Perl can be found at

        http://www.fee.vutbr.cz/~prikryl/tools.html

Follow the steps below.

Petr Prikryl (prikryl@dcse.fee.vutbr.cz) http://www.fee.vutbr.cz/~prikryl 
I want to thank to Eli Napchan (napchane@mis.bskyb.com) for valuable
corrections and suggestions.
-------------------------------------------------------------------------

0. Quick overview: To install the Perl, you need to get the archive
   files mentioned in steps 1 and 2. Then you unzip one of them
   manually (step 3), and execute the install.bat (step 4). Then you
   can modify your autoexec.bat (step 5), or you can call the Perl
   via a batch file perl.bat placed into some PATH directory (step
   6). And that's all.

   All the archive files mentioned in the following steps must be
   placed in one separate directory. It can be c:\tmp, d:\xxxx, or
   whatever directory you want. You can erase it after the
   instalation. It is called TMP (temporary) in the text.

   The instalation was developed to solve 4 problems:

   a) I wanted to make the instalation very easy. If you accept the
      instalation directory c:\perl, you just execute the
      install.bat. If you want to use another directory, you need to
      modify only one line inside the install.bat before the
      execution (see step 4).

   b) When I boot the system from the local disk, I want to set
      environment variables automatically in autoexec.bat (see step
      5 for details).

   c) When the Perl is launched from a computer where the
      autoexec.bat cannot be modified, the Perl can be launched via
      the perl.bat placed in some searched directory (see step 6).

   d) The instalation of Perl should work the same way in MS-DOS and
      in Windows, and the ported functionality should be as good as
      possible. This was done (accepting the Ilya Zakharewich
      recommendation) by usage of RSX instead of EMX also in MS-DOS.
      See description of setperl.bat in step 4 for details.

   Now, follow the first step.


1. Find the nearest CPAN ...
-------------------------------------------------------------------

Petr

--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz)   http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering;    tel. +420-(0)5-7275 218


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

Date: Wed, 10 Sep 1997 06:22:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: STDIN buffer empty ?
Message-Id: <ftv5v5.7o4.ln@localhost>

Boris Pioline (bpioline@mail.cern.ch) wrote:

: Hello,
: is there (of course there is) a way of finding out
: whether there is **already** something in <STDIN>, without affecting
: its contents ?


Perl FAQ, part 5:

   "How can I tell if there's a character waiting on a filehandle?"


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Wed, 10 Sep 1997 11:48:12 -0400
From: Chris Gaston <cgaston@lds.com>
Subject: Web/Systems Architect Position
Message-Id: <3416C13C.7B0CB0A2@lds.com>


Logical Design Solutions, a leader in the design and development of
Interactive Business Communications has an immediate full-time opening
in their Morristown, NJ office for a Web Architect.

Job Description:
In this visible role, the ideal candidate will possess experience in
configuration of Internet technologies as part of a multi-tiered
information technology architecture.  Keeping up-to-date with
current technology trends is essential, as is the ability to evaluate
appropriate technology components for development and delivery
environments.  This individual must also have the ability to integrate
application support technologies with preexisting client IT
infrastructure.  Experience with C/C++, Perl, HTML, Java, CGI and
knowledge of Internet protocols and standards is required.
Knowledge of Active X a plus.

Send resume with cover letter and salary requirements or contact:

Technical Recruiter
Logical Design Solutions
Phone: (201) 971-0100
Fax:   (201) 971-0103
email: recruiter@lds.com

For further info:   http://www.lds.com




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

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

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