[10826] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4427 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 15 12:07:16 1998

Date: Tue, 15 Dec 98 09:00:32 -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           Tue, 15 Dec 1998     Volume: 8 Number: 4427

Today's topics:
    Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) <bradw@kannews.newbridge.com>
    Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) <merlyn@stonehenge.com>
        @$. om7@cyberdude.com
    Re: @$. (Andrew M. Langmead)
    Re: @$. <gwebbQ@Qreedtech.com>
    Re: ANNOUNCE: CodeMagic Universal IDE for Win32 (Free P (Clay Irving)
    Re: array initialisation (Joergen W. Lang)
    Re: Beginner: What's wrong? (Clinton Pierce)
    Re: Bug (array ref in a "void" context) <merlyn@stonehenge.com>
    Re: Can standard Perl functions be overloaded ? (Sean McAfee)
        Computer Based training for PERL? <schneigl@usaa.com>
    Re: Date validation (Clay Irving)
        DBM in perl <kamran@norsar.no>
    Re: Decent Editor <tchrist@mox.perl.com>
        Getting error with "chomp" <lansink@mindspring.com>
    Re: Getting error with "chomp" (Clay Irving)
    Re: Getting error with "chomp" (Matthew Bafford)
        Handling Ctrl-C in NT <Greg.Scher@wdr.com>
        hash predefined length <michaelr@lndn.tensor.pgs.com>
    Re: hash predefined length <gwebbQ@Qreedtech.com>
    Re: hash predefined length (Larry Rosler)
    Re: How can I compare files? <tchrist@mox.perl.com>
    Re: How to extract emails from HTML page <schuette@umr.edu>
        MAPLE V/Win32::OLE <str@zhwin.ch>
        perl + email + winnt = help? <ghoti@telerama.lm.com>
    Re: perl + email + winnt = help? <qdtcall@esb.ericsson.se>
    Re: perl + email + winnt = help? <freeking@nospam.hub.ofthe.net>
        perl - ipc_sysv - semaphore problems martin@mve.com
    Re: Perl and reading from log files (Marc Haber)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 15 Dec 1998 07:58:25 -0500
From: Brad Warkentin <bradw@kannews.newbridge.com>
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <op11zm1woi6.fsf@kannews.newbridge.com>

emclean@slip.net (Emmett McLean) writes:

> >The FAQ doesn't get posted because it is INCLUDED with your copy of
> >Perl.
> 
> Not mine. 

Then, seriously, it is very broken. "perldoc perlfaq" should give it
to you. In a decent install "man perlfaq" should work as well.
The online docs in perl are very very good compared to the norm.

> > And a mini-FAQ gets posted here every few days that says that.
> 
> You're grasping, I searched the most recent listing of 500 messages and didn't
> find a match on FAQ. 

Gets posted often to clpm. Dejanews is your friend. clpm runs at
hundreds of posts per day and many newsfeeds have enthusiastic expiry
policies. 

> >And a copy of *that* gets sent to you after your first post to this
> >group (remember that mail you got?).
> 
> Huh? How could I remember a mail message I never recieved?

Werid. It gets automailed to all new posters to clpm so unless you post
without a valid mail address you should have got it.
> 
>  And another mini-FAQ gets posted
> >every few days to comp.lang.perl.announce as well.  Do we need to
> >attach this info to EVERY post?  <sigh>
> 
> Absolutely not. If you are not inclined to answer you can pass.

But he did answer. While there is no such thing as a free lunch, you
can get good answers to a very wide range of questions, ranging from
faq to details on the internals of the RE engine inside of
Perl. Why??? Because many of the people who work on developing the
language and many of the leading experts are willing to answer
questions. All that is expected of youis that you invest a little
time and verify that your question is not answered by the online
documentation or a faq. 

In keeping with the comcept of "teach a man to fish and he can feed
himself" many of the faqs are answered with a reference to the
appropriate docs.

> Since you see it so often, perhaps you'd be better off if you
> took a break form the newsgroup instead of ignoring the reality 
> of new user's questions and posts.  Accepting reality 
> instead of fighting it will leave you with more energy and the tone
> of your posts won't be so arrogant and grumpy as to need twenty smileys.

No thanks. I very much like having the leading lights available to
answer questions.

>  but I also expect new users to QUICKLY
> >understand that there are FAQs and Dejanews available for first-line
> >research before posting worn-out questions word-for-word and wasting
> >*all* our time with it.
> 
> Just because someone asks a question doesn't mean they haven't
> come up to speed quickly. 

Er, you are the one who asked a faq, after failing to check dejanews
or the online docs that you have to work at to avoid installing when
the executables are installed (Not that I an suggesting that you
failed to install Perl properly, but someone certainly did at your site).

> >Yes, I am intimately familiar with that text, and I can assure you
> >that the answer is not there. :)

> Hum, first you complain I didn't read the FAQ then you agree that the
> answer is not there.

Nope... He is referring to the Camel. Hint: Check the list of authours 
for enlightenment.

>  I supposed the Perl FAQ says that you've been appointed you the 
>  Perl king of c.l.p.m.

Well a case could probably be made to appoint Larry, Tom, Randal and a 
fairly small list as the kings or at least ambassadors of clpm... :-)

>  Yes, go away.
>  That would be best. I'd appreciate answers and helpful suggestions
>  but don't look forward arrogance, grumpy posts and disparaging comments.

I will take correct answers with a tad of grumpyness every time over
well meaning but wrong answers. 

>  Absolutely. If it is difficult for you to tolerate the posts of new users 
>  you should pass. We're here to talk about Perl, and if some
>  career Perl programmer is offended because after a half hour of research
>  I didn't review my non existent perl documentation, and I didn't do a useless
>  query on dejanews then what's the big deal? If you aren't posting to help 
>  Perl users, and you're just the FAQ cop, then just don't post.
> 
>  I've noted this isn't the only thread where new users have been discouraged
>  from posting and disparaged. 

Perhaps you should take a deep breath, deal with the attitude problem
and then come back. People are _never_ discouraged from asking
questions if they give an indication that they tried to find the
answer. OTOH, answers to faqs are often in the form of references to
the docs, with the hope that people will rtfm before posting. This
seems to upset some people who think it is there right to get spoonfed 
answers to faqs.

You should seriously look at getting you installation fixed if you are 
missing the online docs. Depending on what version you have, they are
more complete and correct than the Camel.

Another Perl newbie,
bj


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

Date: Tue, 15 Dec 1998 16:30:57 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <8c90g9mkp8.fsf@gadget.cscaper.com>

>>>>> "Uri" == Uri Guttman <uri@ibnets.com> writes:

Uri> don't do that in public (or in certain movie houses) or you might get
Uri> caught and convicted again! probably violate your parole too!

Uri> :-)

And for the 72nd time... it's not *parole*, it's *probation*.
I've not been to "the big house".  I did not "get out early".

:-)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 15 Dec 1998 13:54:05 GMT
From: om7@cyberdude.com
Subject: @$.
Message-Id: <755pls$5lf$1@nnrp1.dejanews.com>

I have a program which declares a variable, $file.
Later on in the program, I have the following: push(@$file, $anothervariable).
The program ends with the line: $file;.

$file is not referenced anywhere else in the program.

I'm confused as to what the @$ does above.
And what exactly is returned at the end.

Any help would be much appreciated.


Thanks.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 15 Dec 1998 15:34:54 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: @$.
Message-Id: <F40JA6.A4K@world.std.com>

om7@cyberdude.com writes:

>I have a program which declares a variable, $file.
>Later on in the program, I have the following: push(@$file, $anothervariable).
>The program ends with the line: $file;.

This is a perl feature called "references." The scalar variable $file
holds some information about how to find (in this case) an array. In
the line with the push function you are saying "Use the information in
the scalar $file to find the array it knows about. Then push the
scalar $anothervariable onto that array."

Its covered in the perlref man page, although some of the document is
pretty tough reading. There are man pages called "perllol" (perl
lists-of-lists) and "perldsc" (perl data structure cookbook) that talk
about using references of user defined data structures. The perldsc
and perllol are easier reading than perlref, but they assume that you
know some of the information in the perlref man page. (My
recomendation would be to read perlref and ignore whatever you can't
understand, then read perllol and perldsc. Afterwards read perlref
again and try to pick up what you missed.)

-- 
Andrew Langmead


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

Date: Tue, 15 Dec 1998 10:46:15 -0500
From: Garth Webb <gwebbQ@Qreedtech.com>
Subject: Re: @$.
Message-Id: <36768447.9EDB5316@Qreedtech.com>

Please read the perlref.1 man page.  '$file' is an array reference, and @$file is
the array.

om7@cyberdude.com wrote:

> I have a program which declares a variable, $file.
> Later on in the program, I have the following: push(@$file, $anothervariable).
> The program ends with the line: $file;.
>
> $file is not referenced anywhere else in the program.
>
> I'm confused as to what the @$ does above.
> And what exactly is returned at the end.
>
> Any help would be much appreciated.
>
> Thanks.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

----------------------
Garth Webb
Software Developer
Reed Technology and Information Services
gwebbQ@Qreedtech.com

(To reply to me, please remove the 'Q's from my email address.  Thanks.)





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

Date: 15 Dec 1998 09:44:05 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: ANNOUNCE: CodeMagic Universal IDE for Win32 (Free Perl IDE)
Message-Id: <755sjl$f2c@panix.com>

In <754c55$kt$1@nnrp1.dejanews.com> pete@davesworld.net writes:

>ANNOUNCE: CodeMagic Universal IDE for Win32
>Win32 Based FREE IDE for Perl, TclTk, Java, C, Python
>Beta Release 1 (15 Dec, 1998)

>NEVER PAY FOR FREE SOFTWARE!
>NEVER PAY FOR PERL SOFTWARE WHEN ALL YOU WANT IS FREE!
>NEVER PAY FOR PROPRIETARY PERL SOFTWARE!

WARNING!! WARNING!

"pete@davesworld.net" is the same little snot who spammed posters in the
Perl newsgroups with a sob story about his resume last week -- This week
it's "FREE! FREE! SOFTWARE!" posted individually to each newsgroup 
instead of cross-posting...

-- 
Clay Irving
clay@panix.com


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

Date: Tue, 15 Dec 1998 13:35:32 +0100
From: jwl@worldmusic.de (Joergen W. Lang)
Subject: Re: array initialisation
Message-Id: <1dk2v9f.13dxvsbb2k711N@host004-210.seicom.net>

Ala Qumsieh <aqumsieh@matrox.com> wrote:

> Michael Renshaw <michaelr@lndn.tensor.pgs.com> writes:
> 
> > 
> > does anyone know how to preallocate an array size within a hash array ?
> 
> my %hash;
> keys %hash = 100;

print scalar keys %hash;
# gives: 0

If I get this correctly, the above assigns 100 "hash bucket"s for %hash.
I think, Michael wanted to use the size ('number of elements') of a
given array to predestine the number of key-value-pairs of a hash.
Please correct me if I'm wrong.

OWTDI would be:

@given = (1..100);

@hash{@given} = ();
print scalar keys %hash;
# gives 100;

Joergen
--
-------------------------------------------------------------------
   "Everything is possible - even sometimes the impossible"
             HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------


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

Date: Tue, 15 Dec 1998 15:19:31 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Beginner: What's wrong?
Message-Id: <36867d83.685307162@news.ford.com>

On Tue, 15 Dec 1998 02:15:40 GMT, josher19@rocketmail.com wrote:

>From perlfunc Manual Pages:
>
>             The exec() function executes a system command AND
>             NEVER RETURNS.  Use the system() function if you
>             want it to return.
>

The perlfunc Manual Pages have been updated since then.  Exec() does
return if an error was encountered when trying to run the program
indicated by exec().  The Blue Camel does have a correct description of
the behaviour.

exec() does fail.  Be sure to test it.


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

Date: Tue, 15 Dec 1998 16:39:20 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Bug (array ref in a "void" context)
Message-Id: <8c4sqxmkbc.fsf@gadget.cscaper.com>

>>>>> "Bart" == Bart Lateur <bart.lateur@skynet.be> writes:

Bart> I thought that this was one of the reasons. The comma operator seems to
Bart> exist only so people can compress multiple statements into one.

Nope.  I've used it when I want to get two expressions executed in sequence
in a place that can have only one expression.

Bart> Sometimes the artificial distinction between statements and expressions
Bart> is over the top.

I don't think so.  "I'm expecting a value from this" (expression) is a
very different mental state from "I'm not expecting a value from this"
(statement).  Unless you're a lisp hacker. :)

An expression can become a statement by adding a semicolon.  A
statement can become an expression by wrapping a do-block around it.

Bart> I think the next syntax would have been nice:

Bart> 	for ({ $i = 0; $j = 10} ; $i < 10 ; $i++, $j-- ) {

Bart> Notice the lack of a "do".

That looks like an anon-hash constructor to me, except you've got
semi's where you need commas. :)  Please don't give another meaning
for naked braces... we already have far too many.

Are you aware that versions of Perl prior to 5 handled this:

    while {
      step1;
      step2;
      step3;
      step_evalled_in_scalar_context_for_true_or_false_value;
    } {
      body_of_loop;
    }

But Larry finally removed it, since it was undocumented and simply
lead to more confusion?  Yeah, little known secret fact.  Amaze your
friends. :)

print "Just another Perl hacker and archaeologist,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 15 Dec 1998 12:33:03 GMT
From: mcafee@pacman.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Can standard Perl functions be overloaded ?
Message-Id: <3Gsd2.1530$4w2.6694116@news.itd.umich.edu>

In article <913686321.510810@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>	use subs 'open(*$)';
>	sub open (*$) { ... }

It's nice that this works, but how the heck *does* it work?

use subs 'open(*$)';

should be essentially equivalent to

BEGIN {
    my $import = 'open(*$)';
    *{"main::$import"} = \&{"main::$import"};
}

 ...at least, if the subs.pm source is to be believed.  Yet this code has
nothing to do with prototyping at all.  What the hey?

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Tue, 15 Dec 1998 10:27:14 -0600
From: Glenn Schneider <schneigl@usaa.com>
Subject: Computer Based training for PERL?
Message-Id: <36768DE2.2781@usaa.com>

Hiya...
  Does anyone know of a computer based training course that covers PERL?
I'm trying get the people in my shop up to speed on PERL and off of KSH
scripting.

-- 
Glenn Schneider
AIX SysAdmin
schneigl@usaa.com


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

Date: 15 Dec 1998 09:26:15 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Date validation
Message-Id: <755ri7$dke@panix.com>

In <36756a6a$0$203@nntp1.ba.best.com> moseley@best.com (Bill Moseley) writes:

>Is there a 'common' way to validate input dates?

>I'm currently using timelocal() from Time::Local to convert a text date to
>time() seconds, then back to text with localtime() to compare with the
>original date to see if it is valid.

>This catches 2/29/99, for example.

>Is there a small module that will do this work for me?

Date::Manip does it:

  #!/usr/local/bin/perl -w
  
  use Date::Manip;
  
  $date = "02/29/99";
  
  if (! ParseDate($date)) {
      print "$date is a bad date\n";
  }
  
prints:

  02/29/99 is a bad date   


-- 
Clay Irving
clay@panix.com


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

Date: Tue, 15 Dec 1998 14:32:09 +0100
From: Kamran Iranpour <kamran@norsar.no>
Subject: DBM in perl
Message-Id: <367664D9.4F06@norsar.no>

Hi 

I have very little knowledge of perl so please forgive
my ignorance.

I try to use the package DB_File including this single line
in my script:

use DB_File

but I recieve the following error:

---------------------------------
Can't locate auto/DB_File/autosplit.ix in @INC (@INC contains:
/usr/local/perl/lib /usr/local/perl/ext/DB_File .)
 at /usr/local/perl/lib/AutoLoader.pm line 85
at /usr/local/perl/ext/DB_File/DB_File.pm line 157
Can't locate loadable object for module DB_File in @INC (@INC contains:
/usr/local/perl/lib /usr/local/perl/ext/DB_File .)  at printenv.cgi line
 8
---------------------------------

Another problem is that I seem to have difficulties adding
to the list @INC in the runtime. They are simply not added.
I have to use -I when starting perl. What could be the problem ?



I appreciate any help

Thanks in advance


Kamran


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

Date: 13 Dec 1998 16:03:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Decent Editor
Message-Id: <750oh6$m57$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    scott@softbase.com writes:
:Emacs is, and it emulates vi very nicely.

There has never been an emacs emulation of vi -- merely a weak simulation
satisfactory only to those with limited experience and expectations
with vi.

nvi and vim are both fine, though.

    The more tools you bloat your main program with, the more this
    monolithic monstrosity will be loved by the masses yet disparaged
    by programmers.  See also `browser' and `emacs'.

Tools, gentlemen.  Remember your tools.

--tom
-- 
Eighty percent of air pollution comes from plants and trees.
                --Ronald Reagan, famous movie star


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

Date: Tue, 15 Dec 1998 10:22:56 -0500
From: Jeff Lansink <lansink@mindspring.com>
Subject: Getting error with "chomp"
Message-Id: <36767ED0.437805D4@mindspring.com>

Hello.  Obviously I'm very new at this but here goes anyway.

I'm using the standard "Learning Perl" (llama) book and am only on page
6 and already have a problem.  I'm getting an error at the "chomp" line
in the following code.  The script works fine when this line is
commented out (aside from the embedded \n that chomp is supposed to
remove!

Please, if possible, send help to my email address,
lansink@mindspring.com.

Thanks in advance for help on this silly question.

#!/usr/bin/perl -w
print "What is your name? ";
$name = <STDIN>;
chomp ($name);
print "Hello, $name!\n";

Jeff Lansink



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

Date: 15 Dec 1998 10:47:40 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Getting error with "chomp"
Message-Id: <7560as$l7g@panix.com>

In <36767ED0.437805D4@mindspring.com> Jeff Lansink <lansink@mindspring.com> writes:

>Hello.  Obviously I'm very new at this but here goes anyway.

>I'm using the standard "Learning Perl" (llama) book and am only on page
>6 and already have a problem.  I'm getting an error at the "chomp" line
>in the following code.  The script works fine when this line is
>commented out (aside from the embedded \n that chomp is supposed to
>remove!

>Please, if possible, send help to my email address,
>lansink@mindspring.com.

>Thanks in advance for help on this silly question.

>#!/usr/bin/perl -w
>print "What is your name? ";
>$name = <STDIN>;
>chomp ($name);
>print "Hello, $name!\n";

Works fine for me...

-- 
Clay Irving
clay@panix.com


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

Date: Tue, 15 Dec 1998 10:53:21 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Getting error with "chomp"
Message-Id: <MPG.10e04ffd7b77c72c989763@news.scescape.net>

In article <36767ED0.437805D4@mindspring.com>, lansink@mindspring.com 
says...
=> Hello.  Obviously I'm very new at this but here goes anyway.

Hello!
 
=> I'm using the standard "Learning Perl" (llama) book and am only on page
=> 6 and already have a problem.  I'm getting an error at the "chomp" line
=> in the following code.  The script works fine when this line is
=> commented out (aside from the embedded \n that chomp is supposed to
=> remove!
=> 
=> Thanks in advance for help on this silly question.

It's not silly.

=> #!/usr/bin/perl -w
=> print "What is your name? ";
=> $name = <STDIN>;
=> chomp ($name);
=> print "Hello, $name!\n";

*** Perl 4 alert!  Perl 4 alert!  Perl 4 alert!  Perl 4 alert! ***

Do a perl -v, and see what you get.  If it reports the version as 5.*, 
come back.  Otherwise, upgrade. :)

HTH!

=> Jeff Lansink

--Matthew


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

Date: Tue, 15 Dec 1998 11:22:56 -0500
From: "Gregory I. Scher" <Greg.Scher@wdr.com>
Subject: Handling Ctrl-C in NT
Message-Id: <7562d2$a7b$1@ns2.ny.ubs.com>


Hash: SHA1

is anyone familiar with how to work with Signals in NT.  I have a
program that is running as a foreground process.  I wish to be able to
trap Ctrl-C so that instead of having the program terminate it will
execute some of proper shutdown and then exit when I instruct it.  I
have tried the redefining $SIG{INT} = \&SOMEFUNCTION; and exiting from
their but it doesn't seem to work properly.  Can someone help?

Greg

Version: PGPfreeware 6.0 for non-commercial use <http://www.pgp.com>

iQA/AwUBNnaM4HR8vkqIO8a2EQJwFwCePCP20ay/S+yeSLje/bc5hlgedUoAnRzS
DUBwot3+DvSvoidAHkVxp5qF
=0wpW
-----END PGP SIGNATURE-----





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

Date: Tue, 15 Dec 1998 14:59:53 +0000
From: Michael Renshaw <michaelr@lndn.tensor.pgs.com>
Subject: hash predefined length
Message-Id: <36767969.3EB4@lndn.tensor.pgs.com>

does anyone know how to pre-define the size of a hash array ?

I tried this:

$#array = 100;

which works, but this;

$#array{key}=100;

doesnt, any ideas on how to get around this problem, perls complaint is
as follows;

Can't use subscript on array length at prog line 3, near "{key}"

thanx

Mike


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

Date: Tue, 15 Dec 1998 11:28:59 -0500
From: Garth Webb <gwebbQ@Qreedtech.com>
Subject: Re: hash predefined length
Message-Id: <36768E4B.B8831DEB@Qreedtech.com>

You can preset the size of a hash by saying:

keys %hashvar = 100;

Insert whatever number you like in place of 100.  Perl will automatically
increase to the next highest power of 2 whatever number you set for hash
keys.

You can check how many hash entries are filled by saying:

print scalar(%hashvar);

Garth

Michael Renshaw wrote:

> does anyone know how to pre-define the size of a hash array ?
>
> I tried this:
>
> $#array = 100;
>
> which works, but this;
>
> $#array{key}=100;
>
> doesnt, any ideas on how to get around this problem, perls complaint is
> as follows;
>
> Can't use subscript on array length at prog line 3, near "{key}"
>
> thanx
>
> Mike

--

--------------------
Garth Webb
Software Developer
Reed Technology and Information Services
gwebbQ@Qreedtech.com

(To reply to me, please remove the 'Q's from my email address.  Thanks.)





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

Date: Tue, 15 Dec 1998 08:35:53 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: hash predefined length
Message-Id: <MPG.10e02fc8518ab61a98995c@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <36767969.3EB4@lndn.tensor.pgs.com> on Tue, 15 Dec 1998 
14:59:53 +0000, Michael Renshaw <michaelr@lndn.tensor.pgs.com> says...
> does anyone know how to pre-define the size of a hash array ?

You are making several mistakes:  You are not using the '-w' flag and 
'use strict;', and the absence of these is helping you confuse two 
distinct data types:  'hash' and 'array'.

> I tried this:
> 
> $#array = 100;

This sets the size of the *array* named @array.

> which works, but this;
> 
> $#array{key}=100;
> 
> doesnt, any ideas on how to get around this problem, perls complaint is
> as follows;
> 
> Can't use subscript on array length at prog line 3, near "{key}"

array{key} subscripts the *hash* named %array, and the array-length 
notation doesn't apply to a hash.

In your other submission of this question (Subject: 'array 
initialization' -- you are consistently confused :-), one response was, 
in essence, to use a hash slice (which confusingly uses the array 
prefix):

@hash{ 1 .. 100 } = ();

This indeed predefines 100 elements, but they have specific keys, and 
new elements would add to the length of the hash, or the old ones would 
have to be individually undefined.  This all seems like an exercise in 
futility.  Why bother?

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


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

Date: 13 Dec 1998 16:07:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How can I compare files?
Message-Id: <750on5$m57$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Pep Mico <pep_mico@hp.com> writes:
:I'm using Perl under Windows NT. How can I compare two files? I haven't
:found this file function in Perl Manuals. I just only need to know if
:files are Equals or differents.
:
:Should I invoke COMP command from Windows NT?

If you were on a real system, you'd just call the cmp program,
possibly only after checking that the respective st_size fields differ.
Since you're not, you get to have much more fun.

It is distressing to see how many people who, abused by Microsoft and
deprived of proper tools, feel compelled to recreate the wheel in Perl.
If you want Unix (read: a programmer-friendly environment), you know
where you find it.  If you don't want a programmer-friendly environment,
well, then you are welcome to pay as much money as you'd like not to 
get your job done easily.

--tom
-- 
"PC's are backwards ... throw them out! Linux is ok though." 
    --Rob Pike (on the subject of CR/LF etc)


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

Date: Tue, 15 Dec 1998 10:00:45 -0600
From: Matt Schuette <schuette@umr.edu>
Subject: Re: How to extract emails from HTML page
Message-Id: <367687AC.8D7FFA92@umr.edu>

    How do you know he's spamming?  Maybe he happens to have a lot of
friends whose email addresses happen to be randomly spread across the
web in various HTML documents.  And maybe his email program is not
capable of creating an address book, so he needs to create a list of all
of them.  Then again, he may just be trying to spam them all....



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

Date: Tue, 15 Dec 1998 17:48:05 +0100
From: Guido Steiner <str@zhwin.ch>
Subject: MAPLE V/Win32::OLE
Message-Id: <367692C5.BF005D03@zhwin.ch>

I'm wondering if it's possible to start the MAPLE V Application with the
help of a perl script.

use Win32::OLE;

$obj=  Win32::OLE ->new('Matlab.Application' ) || die "CreateObject :
$!";
$obj ->MaximizeCommandWindow;
$obj->Execute("surfl(peaks)");
$obj->Execute("shading interp");
$obj->Execute("colormap(gray)");
$_=<>;

The short  script above shows, how to start the MATLAB.
Is there anybody who can tell me, how I have to call the MAPLE command
window.

I already tried with several names like Win32::OLE
->new('WMAPLE.Application') || die ... or Win32::OLE
->new('MapleV.Application) ...blabla
but I still have not succeeded.

Maybe somebody has got experience with launching MAPLE from the perl
script.

Many thanks !

Guido



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

Date: Tue, 15 Dec 1998 10:22:11 -0500
From: "Adam Stoller" <ghoti@telerama.lm.com>
Subject: perl + email + winnt = help?
Message-Id: <36767e31.0@news.nauticom.net>

I'm a UNIX scripter, temporarilly stuck in a WindowsNT environment, trying
to figure out how to interface perl with windowsNT email - and I could use
some assistance (code, pointers, etc.)

On UNIX, I would simply write a perl script to collect all the data I wanted
in a file, preface the file with standard mail headers (Subject, To), and
envoke sendmail from within the perl script.

Now I'm on a WindowsNT machine, which does not have sendmail, /bin/Mail,
etc. - but instead uses Microsoft Outlook 98 to connect to a Microsft
Exchange server (handling basic SMTP/POP3 services)

I started out copying and slightly modifying a visual basic program that
makes calls to Outlook objects - and, well it works, but I really can't
stand VB.

So, I'm looking for a way to use perl - if possible, to connect to the
Outlook objects in much the same way as VB - though I'm open to other
suggestions as long as they don't involve having to bring in additional
software packages (I'll listen to those ideas, but they're less likely to
fly in my place of business).

Failing that - I'm willing to go through telnet'ing to the SMTP port on the
server - if someone could (a) point me to modules, routines, or bare code to
do the telnet'ing, and (b) remind me how to hold up my end of the
conversation once I connect to the SMTP port :-)

Any and all help appreciated.

--fish
(wishing I was back in UNIX land)




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

Date: 15 Dec 1998 16:38:11 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: perl + email + winnt = help?
Message-Id: <ishfuxs9ek.fsf@godzilla.kiere.ericsson.se>

"Adam Stoller" <ghoti@telerama.lm.com> writes:

> Failing that - I'm willing to go through telnet'ing to the SMTP port
> on the server - if someone could (a) point me to modules, routines,
> or bare code to do the telnet'ing,

Net::SMTP should do, I guess.

> and (b) remind me how to hold up my end of the
> conversation once I connect to the SMTP port :-)

http://sunsite.auc.dk/RFC/rfc/rfc821.html
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
		 Hello? Brain? What do we want for breakfast?


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

Date: Sun, 13 Dec 1998 10:01:48 -0600
From: "Richard H. King" <freeking@nospam.hub.ofthe.net>
Subject: Re: perl + email + winnt = help?
Message-Id: <75609g$oie$1@remarQ.com>


|I'm a UNIX scripter, temporarilly stuck in a WindowsNT environment,
trying
|to figure out how to interface perl with windowsNT email - and I
could use
|some assistance (code, pointers, etc.)


This has happened to many of us by now, you're not alone.

You could do the "telnet" thing (aka Socket.pm), and that's not to
difficult (the "S" in SMTP).
But, other people have already done that and uploaded their *.pm's to
CPAN.

I've used
ftp://sunsite.ualberta.ca/pub/Mirror/CPAN/modules/by-module/Mail/Mail-
Sendmail-0.74.tar.gz and had good results.

-Ryan King




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

Date: Tue, 15 Dec 1998 14:55:45 GMT
From: martin@mve.com
Subject: perl - ipc_sysv - semaphore problems
Message-Id: <755t9g$90s$1@nnrp1.dejanews.com>

Hi-

I am currently having problems compiling perl 5.005_02. When running
a make test it fails tests 8-16 in the lib/ipc_sysv tests.

The section of test code it fails at is:

>> From file perl5.005_02/t/lib/ipc_sysv.t:

if($Config{'d_semget'} eq 'define' &&
   $Config{'d_semctl'} eq 'define') {

    use IPC::SysV qw(IPC_CREAT GETALL SETALL);

    $sem = semget(IPC_PRIVATE, 10, S_IRWXU | S_IRWXG | S_IRWXO | IPC_CREAT);
    # Very first time called after machine is booted value may be 0
    die "semget: $!\n" unless defined($sem) && $sem >= 0;

    print "ok 7\n";

    my $data;
    semctl($sem,0,IPC_STAT,$data) or print "not ";
    print "ok 8\n";
<<

It fails at test eight and then fails the rest of the ipc_sysv tests.

We've had a look through the code, and it seems to be failing
on a call to semctl, passing in IPC_STAT as the cmd. It fails with
EFAULT, though we can't figure out why.

We're building on IRIX 6.5 using egcs-2.91.57 19980901 (egcs-1.1
release).

This is the only part of perl5.005_02 that fails. Has anyone
else faced similar problems, or can anyone give me any indication
of what might be going wrong?

Thanks in advance,

Martin.
--
PS. Please also send any replies to martin@mve.com

Martin Ferguson.
http://www.mve.com/
           ////
          (. .)
-------oOO-(_)-OOo-------

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 15 Dec 1998 13:03:11 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Perl and reading from log files
Message-Id: <755mmg$rn9$1@news.rz.uni-karlsruhe.de>

Kelvin Price <kprice@cardinal.co.nz> wrote:
>I don't know about (1), but see if you like this suggestion for (2)
>
>open (LOGFILE, "tail -f /some/log/file|") or die "a horrible death";
>while ( defined($log_message=<LOGFILE>) ) {
>    &do_something;
>};
>
>Needs more work, but the meat of the idea is there. (IE. tail -f
>filename)

I see. This causes one more process, a shell and a pipe. Hardly what I
call more elegant though. Good idea, however, to take a closer look at
tail's source.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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