[8433] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2050 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 8 04:07:21 1998

Date: Sun, 8 Mar 98 01:00:36 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 8 Mar 1998     Volume: 8 Number: 2050

Today's topics:
        Another RegExp Question (blindspot)
    Re: Another RegExp Question <jdf@pobox.com>
        Can't get socket to work! <mhazen@franklin.uga.edu>
    Re: Connecting to a Database with Perl schwern@starmedia.net
        Does Perl have equivalents to these C Functions ??? <mike.schleif@aquila.com>
    Re: help NetBSD perl 5.004 make test <gd@xeno.demon.co.uk>
    Re: HELP with SUBROUTINES and @_ <jdf@pobox.com>
    Re: Matching words anywhere in strings: need \A, \Z? <rick.delaney@shaw.wave.ca>
    Re: Memory limitation of Perl for OS/2 <webmaster@fccjmail.fccj.cc.fl.us>
        More thoughts on c.l.p.m. (Andy Lester)
    Re: Perl Editor <gd@xeno.demon.co.uk>
        Perl/Tk and OpenGL <kistler@erdw.ethz.ch>
    Re: Problem with "goto" in Perl schwern@starmedia.net
    Re: Pw32i302...now this is just plain frustrating! (Andy Lester)
    Re: Q: obscuring Perl scripts? <webmaster@fccjmail.fccj.cc.fl.us>
    Re: Q: obscuring Perl scripts? (Andy Lester)
    Re: Retriving last item in array. [FAQ] (Robert F. Harrison)
    Re: Retriving last item in array. <mhanson@arrowweb.com>
    Re: Retriving last item in array. (Martin Vorlaender)
    Re: Summing Up Array Values - How Do I? <jdf@pobox.com>
    Re: Tom, grow up [Re: The -w switch (was Re: better way twod@not.valid
    Re: Tom, grow up [Re: The -w switch (was Re: better way <joseph@5sigma.com>
        Urgent! Help Want On Developing Scripts <maestro8@email.msn.com>
        Win32::AdminMisc::GetDriveSpace and Active Server Pages <jmcross@wwisp.com>
    Re: Year 10000 Compliance twod@not.valid
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 8 Mar 1998 05:53:51 GMT
From: mgk13002@Bayou.UH.EDU (blindspot)
Subject: Another RegExp Question
Message-Id: <6dtbpf$pi2$1@Masala.CC.UH.EDU>



--
 	"How much more is there to living now! Instead of our drab 
	 slogging forth and back to the fishing boats, there's a 
	 reason to life! We can lift ourselves out of ignorance, we 
	 can find ourselves as creatures of excellence and intelligence
	 and skill. We can be free! We can learn to fly!"

				from "Jonathan Livingston Seagull"
							-a story


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

Date: 08 Mar 1998 03:01:22 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Another RegExp Question
Message-Id: <u399pq5p.fsf@news.concentric.net>

mgk13002@Bayou.UH.EDU (blindspot) writes:

>  	"How much more is there to living now! Instead of our drab 
> 	 slogging forth and back to the fishing boats, there's a 
> 	 reason to life! We can lift ourselves out of ignorance, we 
> 	 can find ourselves as creatures of excellence and intelligence
> 	 and skill. We can be free! We can learn to fly!"
> 
> 				from "Jonathan Livingston Seagull"

Either this fellow forgot to include a message body, or this newsgroup
has become a clearing-house for allegorical exchanges.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Sun, 8 Mar 1998 00:17:46 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
Subject: Can't get socket to work!
Message-Id: <Pine.WNT.3.96.980308000343.-388893A-100000@fcsg1.franklin.uga.edu>


Due to the volume on this newsgroup, if you can reply to this message,
please email me a copy as well to make sure I don't miss it... thanks!

Now down to business.... ARRRGH! I'm about to pull my hair out over this
one. I'm following both the Camel and the Pelican (web client programming
in perl) on this one, and I still can't seem to get a socket to return
valid data. I can connect, and I do get data back... but even when I'm
supposed to be getting ascii text back, I am getting a wad of what looks
like raw data. 

This is under Perl 5.004 running on Redhat Linux 5.0, or the same version
of Perl running under Solaris 2.5 (I've tried it on two different
systems). 

For a simple example (I've tried this against several services including
ftp, http, and this one, telnet), here's my code:

#!/usr/bin/perl -Tw
use strict; use sigtrap; use Socket;
use vars qw( $host $response $iaddr $paddr $proto);
require 5.002;

$host='wicker';

MAIN:
{
       # create & connect to a socket
       
    $iaddr = inet_aton($host)   or die "Could not get host address for $host\n";
    $proto = getprotobyname("tcp");
    $paddr = sockaddr_in(23, $iaddr);

    socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!\n";
    connect(SOCK, $paddr) or die "connect: $!\n";
    $count=sysread(SOCK, $response, 400);
    print $response; 
       
    close(SOCK) or die "close: $!\n";          
         
   }

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

 ...I can't even post what I get back; it's an ascii representation of
binary data. I've tried using 'unpack "a*" , $response' to get the data
back, but no worky. 

So, anyone want to tell me what magic I'm missing? Please?!?? :)

TIA,

-mh.
----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?



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

Date: Sun, 08 Mar 1998 02:23:28 -0600
From: schwern@starmedia.net
Subject: Re: Connecting to a Database with Perl
Message-Id: <6dtkg4$5sp$1@nnrp1.dejanews.com>

Perhaps you should elaborate on -why- DBI isn't working on your system.  Those
error messages are there for a reason, ya know.  Maybe one of us experienced
people (whom you have oodles of respect for, remember?) might be able to help
you out.

Maybe.

I don't know, if you return a person's help with an ungrateful and sarcastic
reply like that... should we bother?


In article <6doo35$chv@camel18.mindspring.com>,
  "Kevin Bass" <akil1@mindspring.com> wrote:
>
> Aditya Mishra:
>
> The FAQ has been read and the method(s) used to connect to the database
> using Perl do(es) not work on my system.  In computer programming within any
> language, there are alternative methods to perform a task.  Books and FAQ
> newletters are a start but not always a solution to learning.  Learning
> methods and technics from persons within the field is the best method of
> learning (when backed up by reviewing the information that a person is
> looking).  It's called respect for experience!!
>
> Get going!!
>
> Kevin
>
> Mishra, Aditya wrote in message <6dng6e$2gd0@ljcqs003.cnf.com>...
> >This question has been asked a million times here.
> >
> >If you read the FAQ you would not ask this question...
> >
> >Get DBI.(www.perl.com/CPAN-local/modules/by-module/DBI)
> >Get Oracle DBD (www.perl.com/CPAN-local/modules/by-module/DBD/)
> >
> >get going!
> >
> >Adi



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 07 Mar 1998 23:13:40 -0600
From: "Michael D. Schleif" <mike.schleif@aquila.com>
Subject: Does Perl have equivalents to these C Functions ???
Message-Id: <35022904.6580390@aquila.com>

I need to perform the following C functions in Perl:

        htonl()

	getrpcbyname()

Several other "get ... byname()" functions are mirrored internally to Perl -- I
can only hope that this is also the case.

Does anybody know of ways to avoid system calls?  If I cannot do getrpcbyname
internal to Perl, then I will need to make system calls, which almost always
begs the question, which OS am I on?

For instance, is "rpcinfo," or its equivalent on EVERY system that runs Perl? 
How can I know?  I am building a socket program for a client that must query the
server, to see which port the rpc registered program is using during this
session.  The port is dynamically set each time the rpc program starts and is
different on every server.  Therefore, HOW do I obtain this port information
dynamically, at the client?

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we think
we know.  The more I know, the more I know I don't know . . . "


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

Date: Sun, 08 Mar 1998 07:25:11 GMT
From: Giles Davidson <gd@xeno.demon.co.uk>
Subject: Re: help NetBSD perl 5.004 make test
Message-Id: <638229811wnr@xeno.demon.co.uk>

In article: <35004373.4C46@cityscape.co.uk>  patmac <patmac@cityscape.co.uk> writes:
> 
> Hello,
> 
> make test on my NetBSD 1.3 (perl5.004_04) and perl5.004 both 
> fail to find IO/File.pm 
> 
> I believe its a lack of shared library failure, but /lib doesnt
> exist on my FreeBSD 2.2.2 system and perl's running fine on that on
> that one.
> 
> 
> please mail pgm@demon.net
> 
> thanks patmac
> 
>
I had an apparently similar problem building Perl on AIX 4.1.4 using gcc, basically the dynaload stuff 
had built correctly and perl was core dumping. I had to export CC=gcc before running configure, but it's 
something to do with shared libs. I haven't yet had time to figure out why this actually made any 
difference.
-- 
Giles Davidson




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

Date: 08 Mar 1998 02:40:16 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: HELP with SUBROUTINES and @_
Message-Id: <wwe5pr4v.fsf@news.concentric.net>

mercuryz@mail.alabanza.com (MercuryZ) writes:

> sub uppercase {
>    local ( *string ) = @_;
>    foreach $string (@string) {$string =~ tr/a-z/A-Z/; }
>    return @string;
> }
> 
> $string = "lower case";
> @change = ("Sean", "F");
> @return = uppercase( *change );

> I have many Perl books, and have studied hard,
> but I can't understand for one reason or another
> how file globbing works in combination with localizing
> variables. 

You are confusing the typeglob data type with the concept of file
globbing, because they both use a star.  They are, however, not at
all related.  Let's put aside fileglobbing for a second, and talk
about the "local" builtin.  (There's a thorough discussion of local()
and my() in the perlsub doc).  

   {
      local $foo;
      # do stuff to $foo
   }

If the global $foo is already defined, its current value is saved,
and $foo is undefined.  As soon as the perl interpreter exits the
block in which $foo is localized (at the right curly, in my example), the
old value is restored.  That's all there is to local.  Keep in mind,
$foo *is still a global variable*, whose value can be changed by
subroutines.

Now typeglobs.  (See perldata, perlsub, and especially perlref.)  The
notation

   *foo

refers to symbol table entry "foo," which is to say, a structure that
keeps track of all of the variables spelled "foo" (there may be a scalar,
an array, a hash, a format, a filehandle, and maybe some other things
that don't occur to me now at 2:20AM).  If you assign a typeglob to
another typeglob, then the new one becomes an *alias* for the old, and
any change you make to the new is also a change to the old.  So, it
used to be that in order to pass a variable by reference rather than
by value, you'd pass that variable's typeglob to the subroutine.  The
sub makes a copy of the typeglob, and can operate on the original
variable via the resulting alias.  Nowadays it's cleaner and more
idiomatic simply to pass a *reference*, like so:

   sub do_something_with {
      my $aref = shift;          # or my ($aref) = @_;   as you like it
      $aref->[0] = 'swampwater';
   }   
   
   my @granfaloon = qw( wampeter foma );
   do_something_with( /@granfaloon );  #that slash creates the ref
   print "output: @granfaloon\n";

output: swampwater foma

In brief (too late!), unless you have good reasons to do otherwise:

   Use my(), not local().  my() creates actual private variables.

   Use references for parameter passing, not typeglobs (there's a
   common idiomatic exception to this guideline when using
   filehandles.  See perldata.)

> And most importantly, what is the function of @_?

@_ contains the parameters passed to the sub.  It's simply an array
with a weird name.  So, $_[0] contains the first parameter, etc.

If I haven't utterly confused you (or even if I have), you should now
read the various documents I mentioned above.  Have you read _Learning
Perl_ yet?  If not, do.  Have fun.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Sat, 07 Mar 1998 15:43:18 -0500
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Matching words anywhere in strings: need \A, \Z?
Message-Id: <3501B166.5A13A700@shaw.wave.ca>

Ronald G"oggel wrote:
> 
> Peter Scott schrieb in Nachricht <6dnhg6$cd8@netline.jpl.nasa.gov>...
> >Wanting to detect and count number of occurrences of the word "abc" in
> $str,
> >I wrote:
> >
> > $str = "abc def abc def abc ghi abc";
> > $count= () = $str =~ /\Wabc\W/ig;  # require 5.004 :-)
> >
> >but this misses the first and last "abc".  My next attempt was:
> >
> > $count = () = $str =~ /(?:\W|\A)abc(?:\W|\Z)/ig;
> >
> >which works.  But it looks darn ugly.  Am I missing an easier way?
> 
> $count= () = " $str " =~ /\Wabc\W/ig;  # require 5.004 :-)
> 
> HTH

$count= () = $str =~ /\babc\b/ig;  # require 5.004 :-)

HTAH


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

Date: Sun, 08 Mar 1998 04:55:47 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Memory limitation of Perl for OS/2
Message-Id: <35022393.F4A34341@fccjmail.fccj.cc.fl.us>

I answered this via e-mail,
but on second thought, I think I'll
stop trying to answer questions...

:-)
Bill



Ilya Zakharevich wrote:

> [A complimentary Cc of this posting was sent to Bill Jones
> <bill@astro.fccj.cc.fl.us>],
> who wrote in article <3501C883.72CF3D81@fccjmail.fccj.cc.fl.us>:
> > The memory issue is not Perl, it is a problem with
> > versions of OS/2 prior to OS/2 Warp Connect v3 and
> > can be corrected with Service Pack 17 or 22
> > (SP are accumulative.)
> >
> > If you are on OS/2 Warp Connect, SP 17 is available
> > for free (see www.os2bbs.com), otherwise you
> > must upgrade to Warp Connect.
>
> Wow!  What an info!  What was that problem exactly, to put in READMEs?
> I have never seen a report like this before.  But very old EMX's had
> 32M limitation of sbrk()-ed memory.
>
> Btw, I do not have Warp Connect, but it works OK with fixpak17.  I do
> not have a fixpakless machine around to check your claim.
>
> Ilya





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

Date: 8 Mar 1998 06:14:39 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: More thoughts on c.l.p.m.
Message-Id: <6dtd0f$q3m$3@usenet53.supernews.com>

Here's some more strange behavior I don't understand:

Why do people think that simply by saying "my X doesn't work with Y", with
not so much as an error message, that we'll be able to solve their
problems?  "I typed in the program from the book, but it doesn't work!"

I was discussing the last month of hoohah here in c.l.p.m. with a friend
of mine, and he said "It seems like the newer people see Usenet as chat."
I think he's dead on.  Look at how this causes many of the problems here:
* People write very short messages
* People don't realize that there's a history and reference to this
* They don't think that we have anything to do besides talk to them.
* (I suspect) they don't understand why they get yelled at for it all.

xoox,
Andy


--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: Sun, 08 Mar 1998 07:25:13 GMT
From: Giles Davidson <gd@xeno.demon.co.uk>
Subject: Re: Perl Editor
Message-Id: <320481652wnr@xeno.demon.co.uk>

In article: <ximbtvl5j9m.fsf@jihad.amd.com>  Quentin  Fennessy <quentin@jihad.amd.com> writes:
> 
> >>>>> "BDR" == Bavo De Ridder <bavo@ace.ulyssis.student.kuleuven.ac.be> writes:
> 
>     BDR> Is it possible to write such an editor using Perl as the
>     BDR> extention language?  This would be very interesting, since
>     BDR> all of us know Perl but not necessarily Lisp or a dialect.
> 
> nvi (one current version of vi from Keith Bostic and others)
> can have perl linked in.  Cool.  Long time ago I thought awk
> was _the_ macro language for vi--I've seen the light.
> 
> Check out:
> 
> 	http://mongoose.bostic.com/vi/
> 
vim (VImproved) 5.0w, may now even be out of beta as vim 5.0 can be linked with Perl or Python, or may 
be both.
> -- 
> Quentin Fennessy			AMD, Austin Texas
> 
> 
-- 
Giles Davidson




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

Date: Sun, 08 Mar 1998 09:31:18 +0100
From: Per Kistler <kistler@erdw.ethz.ch>
Subject: Perl/Tk and OpenGL
Message-Id: <35025756.CA75056C@erdw.ethz.ch>

Hi All

How do I combine the tk and opengl module?
In C++ on SGI I have a special widget: GLwDrawingArea
What's that in perl?

Thanks, Per.
-- 
Per Kistler, Unix Systems Administrator, kistler@erdw.ethz.ch
Swiss Federal Institute of Technology, Zuerich, Switzerland
---------------------------------------------------------------------


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

Date: Sun, 08 Mar 1998 02:14:44 -0600
From: schwern@starmedia.net
Subject: Re: Problem with "goto" in Perl
Message-Id: <6dtjvn$5ca$1@nnrp1.dejanews.com>

That which I scream at you three time while frothing at the mouth and pounding
on your skull is true:

Don't use goto! <POUND!>
Don't use goto! <POUND!>
DON'T USE GOTO!!! <POUND!> <POUND!> <POUND!>

Everyone will laugh at you if you use goto.
Girls won't go out with you if you use goto.
Your dog won't be your best friend if you use goto.
The universe, in general, will loathe you if you use goto.

Never, ever, ever use goto() unless you've got a really, really, really good
reason to do so.  In every case (except extreme error recovery) it would be
better served with a loop (while, for, foreach...), loop control (last, next,
continue, redo...) or a subroutine.

Read the perlsub and perlsyn man pages.  See also _Code Complete_ by Steve
McConnel, chapter 16.1 "Unusual Control Structures:  Goto"


if( &IsThisOur(@stuff) ) {
	&DoSome(@stuff);
	&DoSomeMore(@stuff);
	&PopOffForAPizza;
	&FinishWithAllThat(@stuff);
}
else {  # I guess its not our stuff.
	die; die; die;
}

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 8 Mar 1998 06:08:21 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Pw32i302...now this is just plain frustrating!
Message-Id: <6dtckl$q3m$2@usenet53.supernews.com>

: HELP... I downloaded Ps32i302.exe and ran it from my

There are newer versions at www.activestate.com

xoxo,
Andy



--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: Sun, 08 Mar 1998 04:51:01 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <35022275.6A10CFA4@fccjmail.fccj.cc.fl.us>

I agree with you; I also do not wish to reopen the
topic of 'Where does one draw the line between
what I worked hard to learn and make a living
from' and 'How much free code can a person find
and will the author support it?'

:-)
Bill


Jarkko Hietaniemi wrote:

> Bill Jones <webmaster@fccjmail.fccj.cc.fl.us> writes:
> : Somehow I think the point was missed...
>
> Yes, and not probably by Steve.
>
> The only thing thusly encrypted software would tell to me is that the
> software vendor does not trust me.  He does not trust me not to leak
> his code and/or he does not trust his own code so much that he could
> show it it plaintext.  Therefore, why should I trust him?
> Some proponents for such mangling moan that what if the customer
> modifies the code, breaks it, and then sues them for the damages?
> Well, again, that does not sound like trust to me.
>
> Yes, scripting languages are exceptional in the sense that giving the
> executable product and the source code are the same and only.  Selling
> the first one forces you to give the second one.  Nevermind.  It is
> still all down to trust.
>
> : Steve Palincsar wrote:
> : > And you actually paid good money for a product with code that looks
> : > like this?  What does that make you?  And what "useful purpose"
> : > has been thus served other than protecting the bug from correction?
> : > This product could walk on water, double my agency's appropriation and
> : > be totally free of charge and I wouldn't recommend we even test it.
> : > Steve Palincsar
> : > > $bgYF =
> : > > "JExzZGlyID0gIi4vIjskV3NhVXcgPSAwOyRybVRPRXYgPSAwOyRGUVp4b3kgPSAwOyZaYkV
> : > > KcXI7aWYgKCRGUVp4b3kgPT0gMSkgeyR0VVdRSyA9ICJMaW5rU3B5ZGVyIjsgfQ==";eval(&TKuB($b
> : > > gYF));
> : > > $cfQkd = "";foreach $mUDBJ (@ARGV) {$cfQkd = "$cfQkd $mUDBJ";}$cfQkd =~
>
> --
> $jhi++; # http://www.iki.fi/~jhi/
>         # There is this special biologist word we use for 'stable'.
>         # It is 'dead'. -- Jack Cohen





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

Date: 8 Mar 1998 06:07:17 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <6dtcil$q3m$1@usenet53.supernews.com>

: Yes, scripting languages are exceptional in the sense that giving the
: executable product and the source code are the same and only.  Selling
: the first one forces you to give the second one.  Nevermind.  It is
: still all down to trust.

It boggles my mind that giving out source code is a condition of doing
business with someone.  Are you suggesting that you use NO products that
don't have the full source code given to you?

It's business, not bar buddies.

xoxo, Andy

--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: 8 Mar 98 03:07:52 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: Retriving last item in array. [FAQ]
Message-Id: <slrn6g42sm.d69.harrison@localhost.localdomain>

[courtesy cc of this posting sent to cited author via email]
On Sat, 07 Mar 1998 18:39:01 -0800, Mike <mhanson@arrowweb.com> wrote:
> How would you retrieve the last item in an array?

I'd read the documentation, perlfunc comes to mind.
Wouldn't you, pop?

-- 
rfh harrison@pixi.com



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

Date: Sat, 07 Mar 1998 22:17:20 -0800
From: Mike <mhanson@arrowweb.com>
Subject: Re: Retriving last item in array.
Message-Id: <350237F0.3707@arrowweb.com>

Mike wrote:
> 
> How would you retrieve the last item in an array?

Thanks I've got the answer now.


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

Date: Sun, 08 Mar 1998 08:11:05 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Retriving last item in array.
Message-Id: <35024489.524144494f47414741@radiogaga.harz.de>

Mike (mhanson@arrowweb.com) wrote:
: How would you retrieve the last item in an array?

How would you read the documentation?
>From perldata.pod:

    The length of an array is a scalar value. You may find the
    length of array @days by evaluating `$#days', as in csh.
    (Actually, it's not the length of the array, it's the subscript
    of the last element, because there is (ordinarily) a 0th element.)

(And there's more after that paragraph.)

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 08 Mar 1998 02:56:33 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <vhtppqdq.fsf@news.concentric.net>

goclimb@azstarnet.com writes:

> Basically, I'm trying to take an array of numbers and sum them up.

You *just* missed an inordinately long thread on this very topic.
You'll find it at DejaNews.

> I guess I should mention I only learned perl about a week ago.

Oh?  You learned perl last week?  Hm.  I think I'll learn bridge
building next weekend.  :-/

> @yards[1] = 2;

Oops, you're assigning to an array slice, which is not what you
meant.  You meant to assign $yards[1].  Actually, you *really* meant
to assign to $yards[0], which is the first element of @yards.  Hey, is
this really the code that you ran?  The -w switch that you used should
have emitted a warning about your inappropriate use of slices.

> @total_yards[1] = 0;

Why are you using an array to keep track of a scalar value?  Why not
just use $total_yards ?

> print $total_yards[$i};

This is definitely not the code that you ran.  It's a syntax error.

> I think you can see what I'm trying to do, but all it does is print out a
> blank line. Hey, at least it runs, right?!

It shouldn't!

You really ought to slow down a bit, and get a hold of some reading
material.  Many of us started with the book _Learning Perl_, and it's
highly recommended.  Get a firmer grasp of the Perl data types and
control structures (like loops), and then your problem of summing an
array will become just another thing that there's more than one way to
do.

   foreach (@numbers) { $sum += $_ }

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 8 Mar 1998 06:32:46 GMT
From: twod@not.valid
Subject: Re: Tom, grow up [Re: The -w switch (was Re: better way to do this?)]
Message-Id: <6dte2e$c91$2@vnetnews.value.net>

Joseph N. Hall (joseph@5sigma.com) wrote:
: This is how Tom addressed my complaint about what was basically
: a slur on my book. 

Did you ask Tom for his permission before posting his private email to you 
on this newsgroup ?  I see nothing in the alleged email that indicates this
permission was given and it is bad form to post private email to a public
forum without permission.

If you feel you have a legitimate case then I suggest that you look up the
words 'slander' and 'libel' in a dictionary, consult some legal advice and
go from there. Whilst you are reading the books please look up the phrase 
'pissing into the wind'

IAP



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

Date: Sat, 07 Mar 1998 11:37:23 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Tom, grow up [Re: The -w switch (was Re: better way to do this?)]
Message-Id: <350193CC.FDF27BA2@5sigma.com>

s/Foreword/Preface/

Joseph N. Hall wrote:
> 
> This is how Tom addressed my complaint about what was basically
> a slur on my book.
> 
> My Foreword is quite clear on Randal's role in the book[...]

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Sun, 8 Mar 1998 02:01:28 -0500
From: "Leonard Chan" <maestro8@email.msn.com>
Subject: Urgent! Help Want On Developing Scripts
Message-Id: <u3#2EEmS9GA.159@upnetnews02.moswest.msn.net>

I need help to develop a set of scripts for my web site, please email me if
interested.

Leonard Chan
maestro@msn.com





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

Date: Sat, 7 Mar 1998 23:58:06 -0600
From: "Jeff Cross" <jmcross@wwisp.com>
Subject: Win32::AdminMisc::GetDriveSpace and Active Server Pages
Message-Id: <6dtc24$a2c$1@ns15.wwisp.com>

When checking disk space on a drive in a remote NT server, I can use the
following script with the AdminMisc module -

use Win32::AdminMisc;
$Server=MYSERVER;
$UNCPath = "\\\\".$Server."\\"."C"."\$"."\\";
($Total, $Free) = Win32::AdminMisc::GetDriveSpace($UNCPath);
print "$Total\n";
print "$Free\n";

The Total disk space and Free disk space of the remote server displays
correctly.

When using the following PerlScript in an Active Server Page, the Total and
Free space equals zero?

<%@LANGUAGE = PerlScript %>
<HTML>
<HEAD>
<Title>Get Drive Space</Title>
</HEAD>
<BODY>
<H1>Get Drive Space</H1>

<%
use Win32::AdminMisc;
$Server = MYSERVER;
%>

<H2>Server <%= $Server %></H2>

<%
$UNCPath = "\\\\".$Server."\\"."C"."\$"."\\";
%>

<%
($Total, $Free) = Win32::AdminMisc::GetDriveSpace($UNCPath);
%>

<h2>Total = <%= $Total %></h2>
<h2>Free = <%= $Free %></h2>

</BODY>
</HTML>

Why isn't the correct drive information being returned?  Anyone have
experience with this?  I've searched the web and cannot find any help with
this as it appears that most developers use VBScript instead of PerlScript
with ASP.  The build of Perl and PerlScript is 315.  IIS is version 4.0.

Thanks,

Jeff




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

Date: 8 Mar 1998 06:43:13 GMT
From: twod@not.valid
Subject: Re: Year 10000 Compliance
Message-Id: <6dtem1$c91$3@vnetnews.value.net>

:  We don't need to worry about this, by then we'll all be assimilated as part
:  of the BORG collective.  No need to worry about trivial computers...

Actually I watch more South Park than Star Trek (+ derivatives) and can
assure you that large flaming anal probes are far more likely in the given
timeframe.

IAP :)


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

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

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