[10312] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3905 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 6 15:07:21 1998

Date: Tue, 6 Oct 98 12:00:28 -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           Tue, 6 Oct 1998     Volume: 8 Number: 3905

Today's topics:
        "Many Jars" Mystery (Patrick Timmins)
    Re: "Many Jars" Mystery <eashton@bbnplanet.com>
        .h to Perl (Homer J Kidd)
    Re: .h to Perl (Brand Hilton)
    Re: A bug in Perl 5.003??? <nverhaeghe@wanadoo.fr>
    Re: Are there any "perl.newbie" group or forum? (Michael J Gebis)
    Re: CGI.pm objects <mp@mkt2mkt.com>
    Re: Compile <commitman@digitalnet.com.br>
    Re: Data Search Question <aqumsieh@tigre.matrox.com>
    Re: Date (M.J.T. Guy)
        Deleting files <info@edoc.co.za>
    Re: Deleting files <eashton@bbnplanet.com>
    Re: Deleting files (Brand Hilton)
        Help converting C xor function to Perl? <seanr@rmci.net>
        How to invoke a macro from perl?(Newbie) (xinyu cui)
    Re: How to match exactly x occurrences of a character (Brand Hilton)
    Re: How to match exactly x occurrences of a character <careys@paciolan.com>
    Re: How to match exactly x occurrences of a character (Snowhare)
    Re: How to match exactly x occurrences of a character (Brand Hilton)
    Re: How to match exactly x occurrences of a character <ajohnson@gatewest.net>
    Re: How to pass a hash array to a sub program <aqumsieh@tigre.matrox.com>
    Re: How to write a MS Excel file <info@edoc.co.za>
    Re: I hate it when I do that. <jdporter@min.net>
    Re: Keeping a running list of the top n values retrieve (Abigail)
    Re: NEEDED: A good perl programer to... (MTNBIKE151)
    Re: newbie trying to parse one file into three (Tad McClellan)
        OT: Please don't bother reading this <minich@globalnet.co.uk>
    Re: Perl and Access <commitman@digitalnet.com.br>
    Re: Perl and Access <Paul.Makepeace@POBox.com>
    Re: Perl and Novell Netware v4 palincss5797@my-dejanews.com
    Re: Perl scripts not writing - no access token <commitman@digitalnet.com.br>
    Re: Please don't bother reading this <Paul.Makepeace@POBox.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 06 Oct 1998 18:05:33 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: "Many Jars" Mystery
Message-Id: <6vdm5d$a9l$1@nnrp1.dejanews.com>

As many of you know, John Porter began using the "Many Jars"
in his signature on or about September 17, 1998. A DejaNews
search reveals that earlier posts on that same date from John
Porter *did not* contain the "Many Jars" tag. Beginning with
message 360132DE.F5BE9C87@min.net and ever since, the "Many
Jars" is present.

What happened just prior to this post to trigger the tag?
Is this a secret code to other DC area Perl types to begin
a Perl insurrection? Is this some sort of a moonshine order or
request to other Perl bootleggers? Or could it be something even
more shocking?

Is John Porter working on some Department of Defense "remote
Perl viewing" or time travel experiment? 7 days *after* the tag
first appears in his sig, a thread on a clpm post begins to
follow a "Perl comes with every jar of Skippy peanut butter" tack
(see clpm message uhfxyniwp.fsf@jimbosntserver.soundimages.co.uk).
Could this explain the "Many Jars" mystery?

I would have emailed John directly, but I thought, for my own
safety, it might be wiser to search for the Truth in a more
public fashion. I live and work literally minutes from U.S.
Strategic Air Command at Offutt AFB, so hopefully this public
exposure will decrease the likelihood of some "Men in Black"
knocking on my door within a few minutes.

Is the Truth out There?

Patrick Timmins
$monger{Omaha}[0]

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


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

Date: Tue, 06 Oct 1998 18:57:16 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: "Many Jars" Mystery
Message-Id: <361A6592.CAB4B4D1@bbnplanet.com>

Patrick Timmins wrote:

> follow a "Perl comes with every jar of Skippy peanut butter" tack
> Could this explain the "Many Jars" mystery?

Hmmm. I thought it was that he, like many geeks, is collecting jam jars
for all those bits on the toolbench. Of course, they are in the sink,
unwashed and fuzzy, but they have a future purpose.

> Strategic Air Command at Offutt AFB, so hopefully this public
> exposure will decrease the likelihood of some "Men in Black"
> knocking on my door within a few minutes.

That can be arranged :). They tend to wear awful grey and blue though.

> Is the Truth out There?

Is truth really truth or merely a single perspective? Can there be more
than one? Does it have to be out there, why not 'in there'? 

e.

Existiria a verdade 
 Verdade que ninguem ve 
  Se todos fossem no mundo iguais a voce  - Jobim -


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

Date: Tue, 06 Oct 1998 18:06:24 GMT
From: user@Blah.com (Homer J Kidd)
Subject: .h to Perl
Message-Id: <361a5b70.16385751@news.efni.com>

Any ideas on how to convert a .h  C Header file to a WIN32 compatible
Perl file?? ( .pm )

Thanx


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

Date: 6 Oct 1998 18:38:14 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: .h to Perl
Message-Id: <6vdo2m$7p28@mercury.adc.com>

In article <361a5b70.16385751@news.efni.com>,
Homer J Kidd <user@Blah.com> wrote:
>Any ideas on how to convert a .h  C Header file to a WIN32 compatible
>Perl file?? ( .pm )
>
>Thanx

There are two ways to interface C libraries to Perl.  One comes with
Perl.  It's called XS.  perldoc perlxstut and perldoc perlxs for the
full scoop.

The other way is to use SWIG (Software Wrapper and Interface
Generator).  My SWIG Users Guide says you can get it at:
<http://www.cs.utah.edu/~beazley/SWIG>, but that may be stale.  It's
been a year or so since I looked.

Based on the text of your question, you appear to be expecting some
magical utility that you can feed a .h file to and it'll spit out a
 .pm file that you can 'use' and get the full functionality of the C
function library the .h file interfaces to.  It's not nearly that
simple.  Just wanted to warn you in case you thought this was going to
be an afternoon job.

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Tue, 06 Oct 1998 19:06:19 +0100
From: Nicolas Verhaeghe <nverhaeghe@wanadoo.fr>
To: Jim Vaught <jvaught@ichips.intel.com>
Subject: Re: A bug in Perl 5.003???
Message-Id: <361A5C1B.AE91FCCF@wanadoo.fr>

Try:

sub jim () { ... }

&jim(1);


or 

sub jim { ... }

&jim;

Jim Vaught wrote:
> 
> Am I doing something wrong or is this a bug in Perl?  This is the
> strangest thing I've ever seen in all my days of programming.  Here is
> my entire program
> 
> sub jim   {die;}
> 
> if (defined $a)
>    {&jim(1);}


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

Date: 6 Oct 1998 17:13:07 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <6vdj33$28j@mozo.cc.purdue.edu>

Dave Barnett <barnett@houston.Geco-Prakla.slb.com> writes:

}Being told to read the f*&king manual (RTFM) is this groups way of
}'teaching you to fish', rather than just feeding you.  (You know the old
}adage:  Give a man a fish, he'll eat for a day.  Teach a man to fish,
}and he'll eat for a lifetime.)

Aha!  Read the fishing manual.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Tue, 06 Oct 1998 10:37:38 -0800
From: madame philosophe <mp@mkt2mkt.com>
To: John Porter <jdporter@min.net>
Subject: Re: CGI.pm objects
Message-Id: <361A636B.DD74715E@mkt2mkt.com>

> > I know you can retrieve names of the params like this:
> >
> >   @names = $q->param();
> >
> > but how to assign to a hash rather than only this array for the
> > set param keys?
>
> Ever heard of map?
>
> > I know there is this stub below too, but it's not secure:
> >
> > foreach $name (param()) {
> >     $value = param($name)
> > }
>
> What's not secure about:
>
>         my %hash;
>         for my $name ( $q->param ) {
>                 $hash{$name} = $q->param( $name );
>         }
>

Well, in the CGI sense how do I know that the params and corresponding values are
getting passed to the hash are the ones that I want?  But I think that you
answered that question in your other posting...

Thanks!

mp



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

Date: Tue, 6 Oct 1998 15:00:19 -0300
From: "Commitman" <commitman@digitalnet.com.br>
Subject: Re: Compile
Message-Id: <6vdlur$16n$1@srv4-poa.nutecnet.com.br>

But I it works on linux ???
Scott Ranzal wrote in message ...
>Look into pl2exe.  It is available in the resource kit and at the companies
>web site.
>
>




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

Date: 06 Oct 1998 12:27:38 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Data Search Question
Message-Id: <x3yww6dejut.fsf@tigre.matrox.com>


lr@hpl.hp.com (Larry Rosler) writes:

> while (<DATA>) {
>     my $xor = $_ ^ $datum;

Ouch!! I wouldn't declare variables inside a loop. I am not exactly an
expert on this but I would believe that this slows down your execution

- At the beginning of each loop, a variable has to be declared and
space has to be reserved in memory.
- At the end of the loop, the compiler has to clean up your unused
variables.
- What if the compiler can not free up the entire space? leeks?
inefficiencies?

I choose not to do that .. just in case!

cheers,
Ala
-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


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

Date: 6 Oct 1998 17:52:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Date
Message-Id: <6vdlcn$7eq$1@pegasus.csx.cam.ac.uk>

In article <36123020.1BB7@rcbowen.com>, Rich Bowen  <rbowen@rcbowen.com> wrote:
>cim@online.ee wrote:
>> 
>> How can i accurately get tomorrows and day after tomorrows date.
>> Simply adding +1 or +2 to todays number will not do.
>> The same goes for yesterday. I could define the max number of days for
>> each month, but February on some years...!?!?
>> Any simple methods?
>
>Add (or subtract) 24*60*60 to the current value of time, then call
>localtime to get the day, month, year, etc.
>
>$today = time;
>$tomorrow = $today + (24*60*60);
>@tomorrows_date = localtime($tomorrow);

Frequently Repeated Mistake.

Not all days have 24 hours in them.    Consider changes in daylight saving.


Mike Guy


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

Date: Tue, 06 Oct 1998 19:58:22 +0200
From: Nico <info@edoc.co.za>
Subject: Deleting files
Message-Id: <361A5A3E.1F2A@edoc.co.za>

Hi,

I want to delete files using PERL.

Where can I find it in the manuals?

perldoc -f ????

Thanks

Nico

PS:  Hopes this question keeps all the wiseguys shouting on us stupid
newbies happy!


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

Date: Tue, 06 Oct 1998 18:18:43 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Deleting files
Message-Id: <361A5C89.408F2A66@bbnplanet.com>

Nico wrote:

> perldoc -f ????

perldoc -f unlink.
 
e.

 Existiria a verdade 
  Verdade que ninguem ve 
   Se todos fossem no mundo iguais a voce  - Jobim -


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

Date: 6 Oct 1998 18:29:13 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Deleting files
Message-Id: <6vdnhp$7p18@mercury.adc.com>

unlink
-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Mon, 5 Oct 1998 21:12:18 -0600
From: "Sean Rietze" <seanr@rmci.net>
Subject: Help converting C xor function to Perl?
Message-Id: <361984c4.0@news.rmci.net>

Can some C/Perl guru help me translate the following
C function into Perl?

I am trying to convert a simple auth daemon that I found
to Perl, but data being sent to me is XORed using this routine
below.  Not sure exactly what this function is doing, the loops
pretty obvious, but not sure what it is doing with the rest of
this data.

Any help would be appreciated!!!!

Sean Rietze


static void
MScramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key)
{
 int i;
 unsigned int j = 0;
 unsigned int x;
 unsigned int ch;
 unsigned char *k2;
 size_t keyLen;

 keyLen = strlen(key);
 k2 = (unsigned char *) key;
 for (i=0; i < (int) dsize; i++) {
  ch = src[i];
  x = k2[j];
  dst[i] = ch ^ x;
  ++j;
  if (j >= keyLen)
   j = 0;
 }
} /* MScramble */

It is called like this...

/* Decode the request inline. */
MScramble((unsigned char *) &astate, sizeof(astate), (unsigned char *)
&astate, "\x7f\xff\xfe\xff");





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

Date: 6 Oct 1998 18:14:44 GMT
From: xcui@chat.carleton.ca (xinyu cui)
Subject: How to invoke a macro from perl?(Newbie)
Message-Id: <6vdmmk$hs2$1@bertrand.ccs.carleton.ca>


This is another EXCEL question, I am just wondering if it's possible to
invoke an excel macro using perl. If yes, what are the commands? Thanks in
advance!


Xin


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

Date: 6 Oct 1998 17:19:52 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: How to match exactly x occurrences of a character
Message-Id: <6vdjfo$7p17@mercury.adc.com>

In article <6vdgis$ahh$1@nnrp2.crl.com>,
Carey Sublette <careys@paciolan.com> wrote:
>This seems like a simple thing to do, but I haven't found how to do it yet:
>
>I want to match exactly x occurrences (say, 2) of a character (say, "a") in
>a row, delimited by anything that is not "a". a{2} doesn't do it, since it
>also matches substrings of "aaa". I could of course indicate that I want
>"aa" to be embedded in a non-a context ([^a]aa[^a]), but this includes the
>context in the match also.  

[^a]aa[^a] also won't work if the 'aa' is at the beginning or end of a
line.

>Attempts to use a{2}*? to get a non-greedy match fail with a "nested *? in 
>regexp" message.

I think maybe you were trying to do 'a{2}?' there, which is
functionally equivalent to 'a{2,2}'.  I'm not sure that's what you
want, though, since this will match the first two 'a's in 'aaa'.

I think parenthesized subexpressions are what you want here.  If you
use  /(^|[^a])(aa)([^a]|$)/  then $2 will contain 'aa'.  

However, even this will get you into trouble if you're trying to find
all occurrences of 'aa' inside a loop with the /g option.  If that's
the case, the above pattern won't work on patterns like, 'baabaab'.
If that's the case, you need:

while (/(^|[^a])(aa)(?=[^a]|$)/g) { print "match is $2\n" }

So, did that answer all possible permutations of your question?  :-)

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Tue, 6 Oct 1998 10:46:28 -0700
From: "Carey Sublette" <careys@paciolan.com>
Subject: Re: How to match exactly x occurrences of a character
Message-Id: <6vdl1n$bfb$1@nnrp2.crl.com>


Snowhare wrote in message <6vdgun$g83$1@xmission.xmission.com>...
>
>
>Nothing above this line is part of the signed message.
>
>In article <6vdgis$ahh$1@nnrp2.crl.com>,
>Carey Sublette <careys@paciolan.com> wrote:
>>This seems like a simple thing to do, but I haven't found how to do it
yet:
>>
>>I want to match exactly x occurrences (say, 2) of a character (say, "a")
in
>>a row, delimited by anything that is not "a". a{2} doesn't do it, since it
>>also matches substrings of "aaa". I could of course indicate that I want
>>"aa" to be embedded in a non-a context ([^a]aa[^a]), but this includes the
>>context in the match also.  Attempts to use a{2}*? to get a non-greedy
match
>>fail with a "nested *? in regexp" message.
>>
>>What should I be doing?
>
>You almost had it. You just need to move the parense: [^a](aa)[^a]
>
>Benjamin Franz


Thanks everyone, I realize now that I should have explained that I am trying
to do a search-and-replace of the substring, not just detectingits
existence. Thus surrounding context cannot be matched, or it will be
replaced also (unless someone has a clever way of putting the context back
in the replacement operation).

Carey


---




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

Date: 6 Oct 1998 12:14:17 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: How to match exactly x occurrences of a character
Message-Id: <6vdmlp$792$1@xmission.xmission.com>



Nothing above this line is part of the signed message.

In article <6vdl1n$bfb$1@nnrp2.crl.com>,
Carey Sublette <careys@paciolan.com> wrote:
>Benjamin Franz wrote:

>>You almost had it. You just need to move the parense: [^a](aa)[^a]
>
>Thanks everyone, I realize now that I should have explained that I am trying
>to do a search-and-replace of the substring, not just detectingits
>existence. Thus surrounding context cannot be matched, or it will be
>replaced also (unless someone has a clever way of putting the context back
>in the replacement operation).

  s/([^a])(aa)([^a])/$1replacement_string$3/

Benjamin Franz


Version: 2.6.2

iQCVAwUBNhpd5ejpikN3V52xAQEO1wP9EHdqqjsfTj49YN/lqYeJRVjIOvrvx4cP
tRTZfxH5yyhW81yx6NE84v5XacIe9stkrU4RRI/BV3ZVR0jTSggRWjweWvxSGoHN
e7uZoZI5HlkMpG/rkq+l8e9ResJli1tpkdijZ28nPbu3nE2GIgf91sn40UHS/7Sy
zCEMQvm2bWo=
=HlG0
-----END PGP SIGNATURE-----


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

Date: 6 Oct 1998 18:19:27 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: How to match exactly x occurrences of a character
Message-Id: <6vdmvf$7p27@mercury.adc.com>

In article <6vdl1n$bfb$1@nnrp2.crl.com>,
Carey Sublette <careys@paciolan.com> wrote:
>Thanks everyone, I realize now that I should have explained that I am trying
>to do a search-and-replace of the substring, not just detectingits
>existence. Thus surrounding context cannot be matched, or it will be
>replaced also (unless someone has a clever way of putting the context back
>in the replacement operation).

Aha... I wondered.

s/(^|[^a])(aa)(?=[^a]|$)/$1zz/g

changes the 'aa's to 'zz's.

If you don't already have it,

  Mastering Regular Expressions
  Jeffrey E.F. Friedl
  O'Reilly & Associates
  ISBN 1-56592-257-3
 
-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Tue, 06 Oct 1998 13:02:42 -0500
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: How to match exactly x occurrences of a character
Message-Id: <361A5B42.165F1546@gatewest.net>

Carey Sublette wrote:
!
! This seems like a simple thing to do, but I haven't found how to do
! it yet:
! 
! I want to match exactly x occurrences (say, 2) of a character (say,
! "a") in a row, delimited by anything that is not "a". a{2} doesn't do
! it, since it also matches substrings of "aaa". I could of course
! indicate that I want "aa" to be embedded in a non-a context
! ([^a]aa[^a]), but this includes the context in the match also.
! Attempts to use a{2}*? to get a non-greedy match fail with a "nested
! *? in regexp" message.
! 
! What should I be doing?

hmmm,  /[^a](aa)[^a]/ and use $1 to get just the 'aa', but that
probably isn't what you are really asking, and it wouldn't match
an 'aa' at the beginning or end of the string,
/(?:^|[^a])(aa)(?:[^a]|$)/, would take care of that, but you
seem to want to match just the 'aa' while making sure it is
in a "non-a context" (to use your words), perhaps you are really
doing substitutions --- for that, you might want to try perl's
negative look(ahead|behind) zerowidth assertions:

$_='aablah aa aaa blah aa';
s/((?<!a)aa(?!a))/xx/g;
print;

which prints: (using perl5.00502)
xxblah xx aaa blah xx

is that more what you had in mind?

regards
andrew


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

Date: 06 Oct 1998 12:32:42 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: How to pass a hash array to a sub program
Message-Id: <x3yvhlxejmd.fsf@tigre.matrox.com>


huntersean@hotmail.com writes:

>  print_hash(\%hash_array);
> 
>  sub print_hash
>  {
>   print "Here is the hash array passed into the subprogram:\n";
>   while (my ($key,$value) = each %{$_}) {print "$key=$value\n";}
>  }

ALMOST right ... $_ is undefined there!! so the statement 'each %{$_}'
will return undef values. I think you meant

each %{%_[0]}

instead.
-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


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

Date: Tue, 06 Oct 1998 20:01:54 +0200
From: Nico <info@edoc.co.za>
To: Hans Xie <hans.xie@its.csiro.au>
Subject: Re: How to write a MS Excel file
Message-Id: <361A5B12.76C7@edoc.co.za>

Hans Xie wrote:

I do not know exactly your application, but why not write a fixed width
text file (or delimited file) and import that?

Nico
> 
> Hi there,
> 
> Are there tools/packages can help me to output a file into MS Excel format?
> 
> Thanks a lot.
> HB XIE


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

Date: Tue, 06 Oct 1998 14:10:34 -0400
From: John Porter <jdporter@min.net>
Subject: Re: I hate it when I do that.
Message-Id: <361A5D1A.8A02A295@min.net>

Ala Qumsieh wrote:
> 
> > BTW a "nice" way to manipulate a variable through $_, is using "for":
> >
> >       for($ary[-1]) {
> >               chomp;
> >               tr/,/./;
> >       }
> >
> > This will manipulate the last item of this array.
> 
> "Nice" indeed ... but not very useful if you have only one element in
> the list!!

No, that's exactly the point: it's extremely useful even for
only one element.  Rather than 

	$container{header}{preamble}{intro}->config();
	$container{header}{preamble}{intro}->process();
	$container{header}{preamble}{intro}->cleanup();

you can say

	for ( $container{header}{preamble}{intro} ) {
		$_->config();
		$_->process();
		$_->cleanup();
	}


> Hmmm... haven't you heard of map() ??
> 
> To execute your above code on the whole @ary, you can do:
> 
>   @ary = map { chomp; tr/,/./; } @ary;
> 
> which is equivalent to:
> 
>   for (@ary) {
>         chomp;
>         tr/,/./;
>   }

I hope you realize that the foreach is quite a bit more
efficient than that map.  That map would have the intended
effect -- modifying the elements of @ary -- even if you
did not assign its result back to @ary.
Modifying $_ in a map is Not Recommended, IMO.

-- 
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer


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

Date: 6 Oct 1998 16:42:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Keeping a running list of the top n values retrieved
Message-Id: <6vdh9c$ojq$2@client3.news.psi.net>

Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote on MDCCCLXII September
MCMXCIII in <URL:news:slrn71jn1r.7c5.sholden@pgrad.cs.usyd.edu.au>:
++ On Tue, 6 Oct 1998 07:59:00 GMT, Gareth Rees <garethr@cre.canon.co.uk> wrote:
++ >Nick Tonkin <nick@valueclick.com> wrote:
++ >> Is there a standard way to keep a running list of the top 20 scoring
++ >> variables?
++ >
++ >Yes.  It's a data structure called a "heap".  Look in any algorithms
++ >book (for example, "Introduction to Algorithms" by Cormen, Leiserson and
++ >Rivest, chapter 7).
++ 
++ How does a heap help... good for priority queues I admit... but for keeping 
++ track of the top n values surely a bit excessive... especially since perl
++ does arrays for you...and sorting for that matter...
++ 
++ If you have numbers being retrieved and you just want the to record the
++ top n values at any given time then why not :
++ 
++ @top_20 = (sort {$b <=> $a} @top_20,$new_value)[0..19];

If we have n values, and want to get the top m, sorting takes O (n log n).

Using a sorted array of size m, and splice each new element in, takes O (n m).

Using a head gives a running time of O (n log m).

If m is small compared to n, the heap clearly wins.



Just because Perl has nice arrays and build in sorting doesn't mean they
are the best tools for all jobs.




Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: 6 Oct 1998 18:11:09 GMT
From: mtnbike151@aol.com (MTNBIKE151)
Subject: Re: NEEDED: A good perl programer to...
Message-Id: <19981006141109.25997.00003413@ng116.aol.com>


Ok, here is what im am willing to  pay,
$400.00 at the end of the project, I must be able to see a working copy of the
script, i will give any one a sample of the flat-file database.

Please Reply
Chris


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

Date: Tue, 6 Oct 1998 06:42:12 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: newbie trying to parse one file into three
Message-Id: <kmvcv6.hp.ln@flash.net>

Larry Quantz (quartz@nospam.idiom.com) wrote:

:     I've got a text file with various records in it.  Each record is on an
: individual line, and each record is comma delimited.

:     I need to take this file, and put (let's say) fields one, four and seven
: of each record into a file.  Likewise, I need to put fields two and five
: into another file, while fields three and six go into a third file.

:     I've got a rough idea on what to do, but what Perl statements/code will
: best allow me to do so?  I'd like to have a solid footing to go on before I
: start.  Thanks for any and all help.


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

open(FH147, ">147.db") || die "could not open '147.db'  $!";
open(FH25, ">25.db") || die "could not open '25.db'  $!";
open(FH36, ">36.db") || die "could not open '36.db'  $!";

while (<DATA>) {
   chomp;
   @fields = split /,/;

   print FH147 join(',', @fields[0,3,6]), "\n";  # use an "array slice"
   print FH25  join(',', @fields[1,4]), "\n";
   print FH36  join(',', @fields[2,5]), "\n";
}
close(FH147);
close(FH25);
close(FH36);


__DATA__
one1,two1,three1,four1,five1,six1,seven1
one2,two2,three2,four2,five2,six2,seven2
one3,two3,three3,four3,five3,six3,seven3
one4,two4,three4,four4,five4,six4,seven4
-------------------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 6 Oct 1998 18:24:07 +0100
From: "Martin" <minich@globalnet.co.uk>
Subject: OT: Please don't bother reading this
Message-Id: <6vdjo5$t3q$1@newnews.global.net.uk>

Well, I did ask you.

Just in case the spam robots are about today.

Online@pobox.com
Online@pobox.com
Online@pobox.com
Online@pobox.com
Online@pobox.com
Online@pobox.com
Online@pobox.com
Online@pobox.com

They are incidentally a company that will bulk e-mail to people for a
charge.
Since they think spam's OK then I hope the robots have fun with their
address.

Sorry for any inconvenience.




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

Date: Tue, 6 Oct 1998 15:01:15 -0300
From: "Commitman" <commitman@digitalnet.com.br>
Subject: Re: Perl and Access
Message-Id: <6vdm0i$185$1@srv4-poa.nutecnet.com.br>

Try to use Linux SQL !

ST wrote in message <6vctsm$7s9@tuegate.tue.nl>...
>Hello,
>
>The use of Win32::ODBC makes it possible to connect to Access-databases.
>But can this also be used on a server running Apache [Unix] or is there
>another way to do this?
>
>Sincerely,
>
>S.P. Telgenhof Oude Koehorst
>
>
>




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

Date: Tue, 6 Oct 1998 18:15:18 +0100
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: Perl and Access
Message-Id: <6vdp7h$kuk$1@statler.server.colt.net>

[posted and mailed to author]

ST wrote in message <6vctsm$7s9@tuegate.tue.nl>...
>Hello,
>
>The use of Win32::ODBC makes it possible to connect to Access-databases.
>But can this also be used on a server running Apache [Unix] or is there
>another way to do this?

No, since Access doesn't provide the capability of servicing SQL requests
over a network. You'll need a proper RDBMS for that like MySQL (free),
Oracle, SQL Server (NT, Access' big brother), etc or anything that claims
something about 'Enterprise' or 'scalability'.

You could conceivably run a daemon process on the machine running Access.
This process (written in Perl) would listen for requests which it could cope
using Win32::ODBC and pass the information back. You'd have to construct
your own simple protocol for this and learn about sockets and pack. It'd be
a fun mini-project...

Probably the easiest way of doing this though if you have a webserver
running on the Access machine is to write a CGI program that takes the SQL
query as a parameter and returns the answer in some format inside an HTML
document. Investigate securing your server to prevent arbitrary queries of
course.


This is straight off the top of my head, others will doubtless suggest
better ways...

--
Paul Makepeace, Independent Thinkers Ltd (UK)
0171 377 8668 / 0973 800436
"People are all monkeys, and I am Captain Banana"
 -- Vincent Gallo




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

Date: Tue, 06 Oct 1998 16:57:15 GMT
From: palincss5797@my-dejanews.com
Subject: Re: Perl and Novell Netware v4
Message-Id: <6vdi5d$45f$1@nnrp1.dejanews.com>

In article <3619091a.232138519@news.bewellnet.com>,
  mscongdon@hotmail.com (Michael Congdon) wrote:
> Our company is using a Novell Netware 4.0 server and I'm trying to use
> publish our web site using a Perl database script.  I'm wondering what
> the default ROOT directory is in NetWare.
>
> Also, when do you use "sys:" in the PATH.
>
>

Novell Web Server 3.1 allows you to configure the root of the document
tree as you wish.  By default, it is in inw_web\shared\docs\online.  The
documentation for the web server is located there in the form of HTML
documents.  The package can be downloaded from Novell's web site, and
you can try an installation on a PC (i.e., not a novell server) just
to read the documentation.

By default, the web server wants to install in the sys: volume, but
you don't have to put it there.  I have one running at work installed
in the v1 volume.  The admin tools, on the other hand, want to be in
sys:.

I totally agree with what's been said about the perl implementation.
It's terrible.  This is a lousy platform for CGI.  And since you cannot
run any external programs that aren't Novell NLMs you can't extend the
capabilities.

There's really only one thing this package is good for.  You can make
documents in Novell directories available across your network via the http
protocol. At this it's quite good.  And it has a special neat trick: you can
apply access restrictions that make use of the user IDs and passwords in NDS.

The admin utility is moderately OK, but it's incomplete.  I found that to
make use of the alternate document root feature (which was the key reason
we wanted to run the web server in the first place) I had to manually
edit the config file.

Bottom line: NWS is good for static HTML access, but nothing else.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Tue, 6 Oct 1998 14:58:44 -0300
From: "Commitman" <commitman@digitalnet.com.br>
Subject: Re: Perl scripts not writing - no access token
Message-Id: <6vdlrs$14f$1@srv4-poa.nutecnet.com.br>

U must to write files out of the wwwroot !!! There have no permission for
guests !!!

James Michael Stewart wrote in message <361a417d.126914082@news.io.com>...
>On a new system, dual cpus, NT 4.0, SP3 + hotfixes, IIS 4.0 with
>Option
>pack update.
>
>Roots are duplicated from functioning server.
>
>Perl scripts execute, accept data, display new screens, but cannot
>create new files or write to existing files.
>
>I think I've made all of the standard mappings, permissions, and
>related settings.
>
>The W3SVC log displays a 502 error for the perl script. The Event
>Viewer lists an error with Event ID 16 and text "The script started
>from the URL '/cgi-bin/savextr.pl' with parameters 'fileid=ecdum' has
>not responded within the configured timeout period. The HTTP server is
>terminating the script. "
>
>I used the NTHANDLE utility and determined that when a Perl script is
>called, it is not assigned a security context. The error from NTHANDLE
>states "<unable to open token>".
>
>Is there a way to force a token or re-define the token used by Perl
>scripts? I thought scripts took on the security context of the IUSR
>account....
>
>Any help or suggestions appreciated!
>
>Thanks.
>-Michael
>michael@lanw.com
>




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

Date: Tue, 6 Oct 1998 17:35:38 +0100
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: Please don't bother reading this
Message-Id: <6vdmrt$irl$1@statler.server.colt.net>

[posted and mailed to author]

Martin wrote in message <6vdjo5$t3q$1@newnews.global.net.uk>...
>Well, I did ask you.
>
>Just in case the spam robots are about today.
>
>Online@pobox.com
>Online@pobox.com
>Online@pobox.com
>Online@pobox.com
>Online@pobox.com
>Online@pobox.com
>Online@pobox.com
>Online@pobox.com
>
>They are incidentally a company that will bulk e-mail to people for a
>charge.
>Since they think spam's OK then I hope the robots have fun with their
>address.

How do you know this? Because it said so in the mail headers? That is NOT a
way to determine the originator of the post, and is commonly used to stop
replies, by providing an address they don't have to read but is valid so as
to fight anti-spam products.

That email account is owned by http://www.pobox.com/~online/ who doesn't
appear to offer any such service. You may be right, but please be careful
before posting this sort of message. Perlfaq9 suggests "... the best way is
often just to ask the user".

Besides, it's got nothing to do with Perl.

--
Paul Makepeace, Independent Thinkers Ltd (UK)
0171 377 8668 / 0973 800436
"People are all monkeys, and I am Captain Banana"
 -- Vincent Gallo




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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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