[10372] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3965 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 13 17:07:20 1998

Date: Tue, 13 Oct 98 14:00:19 -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, 13 Oct 1998     Volume: 8 Number: 3965

Today's topics:
    Re: Are there any "perl.newbie" group or forum? <mp@mkt2mkt.com>
    Re: Are there any "perl.newbie" group or forum? <eashton@bbnplanet.com>
    Re: building perl on Windows NT with MSVC5 (Jan Dubois)
    Re: comp.lang.perl.win32?? <dgris@perrin.dimensional.com>
    Re: email with windows 98 perl script? (Hawkwynd (Scott Fleming))
    Re: encryption (Joergen W. Lang)
    Re: encryption (Larry Rosler)
    Re: Exporting environment variables to parent shell <bradw@newbridge.com>
    Re: fading text <bravo@bravodesign.com>
        Help Debugging Formatted Writes (Perl 5.005) <whitepr@scp1.bellcore.com>
    Re: Help Debugging Formatted Writes (Perl 5.005) <rootbeer@teleport.com>
    Re: Newbie needs help transposing two words in a file <aqumsieh@tigre.matrox.com>
    Re: Newbie needs help transposing two words in a file (Larry Rosler)
    Re: Newbie needs help transposing two words in a file <uri@camel.fastserv.com>
    Re: Newbie needs help transposing two words in a file (Larry Rosler)
    Re: Perl Cookbook - is this the best perl book? (Ben Coleman)
    Re: Perl Cookbook - is this the best perl book? (Abigail)
    Re: Perl Cookbook - is this the best perl book? (Charles DeRykus)
        perl scripts won't work: (RH5.1 Linux) "command not fou (Mark den hartog)
    Re: sorting hack <dgris@perrin.dimensional.com>
    Re: sorting hack (Larry Rosler)
    Re: Unix Perl vs. Unix Perl? <rootbeer@teleport.com>
        Using Filesecurity.pm ? <Oleg_Waisberg@Health.Lmig.ca>
    Re: which chars to escape in reg.exp? <merlyn@stonehenge.com>
    Re: which chars to escape in reg.exp? (Larry Wall)
        Win32/95 and resolving problem under CGI hladik3@hladik.cz
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 13 Oct 1998 12:42:34 -0800
From: madame philosophe <mp@mkt2mkt.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <3623BB29.EB751E75@mkt2mkt.com>

As I said " I think you mean intelligent independently studious people who are
full of
themselves need never ask that question."

 ... or I'm not Martha Stewart. :)
> 

Please refrain from cat-fighting Martha.  I find that very boring.

(And,  I'll bet you're in Mensa too!) If you desire to attack me rather 
than discuss the learning of perl, so be it, I won't stop you.

I can't understand why you would be so defensive for people to want to learn
to program.

My sense is that the newbie problem will just get moreso unless the leaders of
the pack
don't create some sort of shoehorn to help things along.

As Tad said in another posting to this thread:


Tad McClellan (tadmc@flash.net) wrote:

:    The demand is there despite it being a bad thing.

 It now occurs to me that Bill got rich from such a thing...  ;-)

Which leads us to a real problem all you tried and true programmers should
think about.

Would you rather have another Bill Gates come along and spoil the fun?  Or
would you rather
everyone share in the treasures of Perl?


BTW

I just took a look at that new tutorial:

http://www.lies.com/begperl/

It looks pretty good. For all you lurking newbies out there take a looksee!

mp

-- 
------
madame philosophe 

"I am not a troll!"

- Famous last words before
the
guillotine of comp.lang.perl.misc

She's here to save the world from herself...


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

Date: Tue, 13 Oct 1998 20:11:51 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <3623B188.AE2EBC34@bbnplanet.com>

madame philosophe wrote:

> As I said " I think you mean intelligent independently studious people who are
> full of themselves need never ask that question."

To search for the answer for yourself is one thing. To troll a newsgroup
for 'The Idiots Guide to Perl' is not the product of 'intelligent
independently studious' people, full of themselves or not. 

> Please refrain from cat-fighting Martha.  I find that very boring.

Actually, I have a subscription to her magazine and find her style of
decorating tasteful, quiet and much to my liking. I just don't have a
house staff of 50 and work 15 hours a day. Truth be known, I'm jealous.
(Shhh! Don't tell my mother ;)

> (And,  I'll bet you're in Mensa too!) If you desire to attack me rather
> than discuss the learning of perl, so be it, I won't stop you.

Mensa? Puhleez. I'm not much of a joiner. And I'm not attacking you per
se, I'm attacking your unsharpened argument for documentation for the
uninitiated. Perl may, or may not be a learners language but it is
certainly more so than most. 

> I can't understand why you would be so defensive for people to want to learn
> to program.

You aren't understanding my retort. You are stating that all of the
documentation out there has little value for the 'newbie' to learn Perl.
I disagree. I see so many people in r/l as well as on-line that give up
too easily on actually having to work a little bit at learning
something. I'm sure that this is not uncommon. If there is that much
demand for an 'idiots' guide then I'm certain there will be one. 

> My sense is that the newbie problem will just get more so unless the leaders of
> the pack don't create some sort of shoehorn to help things along.

Why wait for the leaders? You seem to be intimately acquainted with this
problem, write one yourself and encourage input from others.

One fine point in all of this is, yes, as Perl is being advocated, etc.
there needs to be a bit more 'hand holding' mechanisms to encourage the
not quite so bold or motivated to wade on in. Perhaps I've read too much
Thoreau but I don't know if I like this approach. 

> Would you rather have another Bill Gates come along and spoil the fun?  Or
> would you rather everyone share in the treasures of Perl?

You are comparing apples and oranges here. Perl is free and available to
anyone who wants it and has a use for it. Perl attracts a different
audience. 

> It looks pretty good. For all you lurking newbies out there take a looksee!

>From the page:

Assumptions I do make:

You're reasonably intelligent. 
You're an experienced computer user,

Hmm....Right there you nix 50% of the people you are whining on about.
feh.

e.


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

Date: Tue, 13 Oct 1998 21:03:59 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: building perl on Windows NT with MSVC5
Message-Id: <3624a124.7385419@news3.ibm.net>

[mailed & posted]

teds@intex.com wrote:

>I downloaded the latest perl from CPAN built perl using MSVC5.0.
>The compile and test ran correctly. When I do
>
>nmake install,
>
>it starts installing perl into a directory which is not the one I
>specified at the top of makefile.mk.  It seems to find my existing
>perl directory and stuff things in there.

nmake use Makefile and not makefile.mk

>The Installation finishes and then I start getting many messages like
>
>..\installhtml: ../pod/*.pod: can't resolve L<h2xs> ...
>
>Am I doing something wrong?

No, that is completely normal. We all get those :-)

-Jan


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

Date: Tue, 13 Oct 1998 19:29:55 GMT
From: Daniel Grisinger <dgris@perrin.dimensional.com>
Subject: Re: comp.lang.perl.win32??
Message-Id: <m31zocjmib.fsf@perrin.dimensional.com>

John Porter <jdporter@min.net> writes:

> The range of perl-related questions which are NOT platform-
> independent, and in fact are Win32-dependent, is large.
> I would be very happy for the people who ask and answer them
> to do so somewhere other than clpm.

This sounds like a reasonable idea, but I wonder if clpw32
would actually generate much traffic?  Does anybody have any
data on the actual number of win32 related posts to clp(misc|modules|tk)?

<snip lots>

> Even though I personally think Windows is a miserable excuse for an
> operating system, I support the notion that Win32 programmers
> ought to have a forum in which "NT Sucks!" is considered a troll.

NT Sucks!!!  ( hey, I'm not trolling, John said so :-).

dgris
-- 
Daniel Grisinger          dgris@perrin.dimensional.com
`By about halfway through I was beginning to guess the 
ending, but it still kind of surprised me.'
      David Hatunen, talking about the movie Titanic


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

Date: Tue, 13 Oct 1998 20:48:40 GMT
From: remove_me.hawkwynd@adelphia.net.remove_me! (Hawkwynd (Scott Fleming))
Subject: Re: email with windows 98 perl script?
Message-Id: <3623ba5d.24570690@news.fwi.com>

On Tue, 13 Oct 1998 16:40:54 GMT of the dragon, it was read from the
pen of Tom Phoenix <rootbeer@teleport.com> :

>On Tue, 13 Oct 1998, Hawkwynd wrote:
>
>> So far, all the email scripts for web servers have been for Unix and
>> NT. Is it possible to do this on a Windows 98 Web server? 
>
>Probably, unless someone at Microsoft was really foolish. The docs, FAQs,
>and newsgroups about webservers should be able to help you here. Good
>luck!

Thanks Tom,

What I guess I should have posted, is - are there any *cgi scripts*
specifically written for Windows95/98 web servers for mail handling. I
am looking to provide a small mail service for a group of endusers.



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

Date: Tue, 13 Oct 1998 21:53:43 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: encryption
Message-Id: <1dguxph.19aj5d81jj881qN@host036-210.seicom.net>

Orlando Frooninckx <Frook@mail.dma.be> wrote:

> hi, 
> 
> does anyone have a nice encryption function example so I can crypt
> sentences before writing them to a file?
> 

look for "crypt" in the "perlfunc" manpage;

hth, Joergen
-- 
  To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
   "Everything is possible - even sometimes the impossible"
             HOELDERLIN EXPRESS - "Touch the void"


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

Date: Tue, 13 Oct 1998 13:35:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: encryption
Message-Id: <MPG.108d59559cb3626989808@nntp.hpl.hp.com>

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

In article <1dguxph.19aj5d81jj881qN@host036-210.seicom.net> on Tue, 13 
Oct 1998 21:53:43 +0100, Joergen W. Lang <jwl@_munged_worldmusic.de> 
says...
> Orlando Frooninckx <Frook@mail.dma.be> wrote:
> > does anyone have a nice encryption function example so I can crypt
> > sentences before writing them to a file?
> 
> look for "crypt" in the "perlfunc" manpage;
> 
> hth, Joergen

That won't help.  The 'crypt' function is useful only for encrypting 
passwords.  It is effective only for the first eight characters of the 
input string.

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


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

Date: 13 Oct 1998 15:28:28 -0400
From: bj <bradw@newbridge.com>
Subject: Re: Exporting environment variables to parent shell
Message-Id: <op13e8suuqr.fsf@ca.newbridge.com>

fl_aggie@thepentagon.com (I R A Aggie) writes:

> In article <361C978E.BF59E917@no-junkmail.please.pison.com>, Halfdan
> Ingvarsson <halfdan@no-junkmail.please.pison.com> wrote:
> 
> + Is there any way of exporting environment variables, set in a perl
> + script, out to the parent environment. (I'm probably missing something
> + amazingly obvious).
> 
> That would be a security flaw, and can not be done. Would you really
> want a program to reset your environment?

Under certain conditions it would be _wonderful_ to be able to modify
the envrionment of a parent process. I do agree that it would be good
if there was decent security around such an ability... :-)

You can of course go the kludge route of sourcing a wrapper script, that
calls a program that brilliantly builds you a environment, and
conclude by having the wrapper script source the syntactically correct
dynamically built environment setting script. Tis ugly and annoying to 
make portable across multiple os's and shells.

I do this to autobuild environments for users so they can run various
tools that have incompatible envrionmental requirements, with all
program requirements maintained in a perl data structure.

bj


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

Date: Tue, 13 Oct 1998 15:31:59 -0500
From: Darrick Wolfe <bravo@bravodesign.com>
Subject: Re: fading text
Message-Id: <3623B8BF.6E8B@bravodesign.com>

being that it has to do with the actual workings rather the end product,
it's more like saying "Nowhere in my owners manual does it show me how
to install a gas pump" :o)

Thanks for the help!
-Darrick

Tom Phoenix wrote:
> 
> On Sun, 11 Oct 1998, Darrick Wolfe wrote:
> 
> > My problem is that I can not find info on manipulating the hex colors
> > in Perl (or in any language for that matter).
> 
> This is like saying, "Nowhere in my driver's training course did they tell
> us how to drive to Yellowstone, and it's not in my owner's manual
> either!" :-)
> 
> If you wish to convert to and from hex, use the pack and unpack functions
> listed in perlfunc. Once you've got ordinary numbers, your problem should
> be a matter of mathematics. Hope this helps!
> 
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: Tue, 13 Oct 1998 16:19:44 -0400
From: Paul White <whitepr@scp1.bellcore.com>
Subject: Help Debugging Formatted Writes (Perl 5.005)
Message-Id: <3623B5E0.27C@scp1.bellcore.com>

I would appreciate any help I can get with
this problem ... (scratching my head for awhile).

I am running Perl 5.005 for WinNT in debug
mode to decipher the following error:

Use of uninitialized value at "filename" line "number", <IN> chunk
"number".

The location of the error is a formatted write
to an output datafile.

The program flow goes:

#!/usr/bin/perl -w
format FILENAME =
@<<<<<< @<<<<<< @<<<<
$a,$b,$c
 .
open (FILENAME,">filename.dat");

#... define parameters in this part 

($a,$b,$c) = split(/,/); # want comma field delimiter

write FILENAME;

close (FILENAME);


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

Date: Tue, 13 Oct 1998 20:43:11 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help Debugging Formatted Writes (Perl 5.005)
Message-Id: <Pine.GSO.4.02A.9810131340410.1979-100000@user2.teleport.com>

On Tue, 13 Oct 1998, Paul White wrote:

> Use of uninitialized value at "filename" line "number", <IN> chunk
> "number".

Have you seen what the perldiag manpage has to say about this message?

> The location of the error is a formatted write
> to an output datafile.

> format FILENAME =
> @<<<<<< @<<<<<< @<<<<
> $a,$b,$c
> .

I'm guessing that one or more of those three variables is undefined.

> open (FILENAME,">filename.dat");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> ($a,$b,$c) = split(/,/); # want comma field delimiter

You're using $_ here; are you sure that it is defined?

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: 13 Oct 1998 11:57:26 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Newbie needs help transposing two words in a file
Message-Id: <x3yu318lajd.fsf@tigre.matrox.com>


"Michael Mongeau" <michael_mongeau@stratus.com> writes:

> 
> This is a good use for regular expressions.  Assuming the filehandle opened
> is call F,
> 
> while (<F>) {
>  ($last,$first,$company) = /SMTP:(\w+)\.(\w+)@(.+)/;
>  print "SMTP:$first.$last\@$company\n";
> }
> 

Not very efficient since the original poster has a file that contains
several hundred lines to be changed.

how about a one-line shell command:

perl -pi.bak -e 's/SMTP:([^.]+)\.([^@]+)/SMTP:$2.$1/g;' yourfile

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


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

Date: Tue, 13 Oct 1998 12:27:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie needs help transposing two words in a file
Message-Id: <MPG.108d49883825ae0d989805@nntp.hpl.hp.com>

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

In article <x3yu318lajd.fsf@tigre.matrox.com> on 13 Oct 1998 11:57:26 -
0400, Ala Qumsieh <aqumsieh@tigre.matrox.com> says...
! "Michael Mongeau" <michael_mongeau@stratus.com> writes:
! > This is a good use for regular expressions.  Assuming the filehandle
! > opened is call F,
! > 
! > while (<F>) {
! >  ($last,$first,$company) = /SMTP:(\w+)\.(\w+)@(.+)/;
! >  print "SMTP:$first.$last\@$company\n";
! > }
! > 
! 
! Not very efficient since the original poster has a file that contains
! several hundred lines to be changed.
! 
! how about a one-line shell command:
! 
! perl -pi.bak -e 's/SMTP:([^.]+)\.([^@]+)/SMTP:$2.$1/g;' yourfile

What makes you think this approach is more efficient?  Have you measured 
it?  Where are the results of the measurements?

I know about 'theoretical' science and 'experimental' science.  But not 
about 'conjectural' science, at least not in programming.

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


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

Date: 13 Oct 1998 15:54:44 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Newbie needs help transposing two words in a file
Message-Id: <sarpvbwqltn.fsf@camel.fastserv.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> [Posted to comp.lang.perl.misc and a copy mailed.]
  LR> In article <x3yu318lajd.fsf@tigre.matrox.com> on 13 Oct 1998 11:57:26 -
  LR> 0400, Ala Qumsieh <aqumsieh@tigre.matrox.com> says...
  LR> ! "Michael Mongeau" <michael_mongeau@stratus.com> writes:
  LR> ! > This is a good use for regular expressions.  Assuming the filehandle
  LR> ! > opened is call F,
  LR> ! > 
  LR> ! > while (<F>) {
  LR> ! >  ($last,$first,$company) = /SMTP:(\w+)\.(\w+)@(.+)/;
  LR> ! >  print "SMTP:$first.$last\@$company\n";
  LR> ! > }
  LR> ! > 
  LR> ! 
  LR> ! Not very efficient since the original poster has a file that contains
  LR> ! several hundred lines to be changed.
  LR> ! 
  LR> ! how about a one-line shell command:
  LR> ! 
  LR> ! perl -pi.bak -e 's/SMTP:([^.]+)\.([^@]+)/SMTP:$2.$1/g;' yourfile

  LR> What makes you think this approach is more efficient?  Have you measured 
  LR> it?  Where are the results of the measurements?

  LR> I know about 'theoretical' science and 'experimental' science.  But not 
  LR> about 'conjectural' science, at least not in programming.


actually larry, as i am sure you could tell, they are basically the same
code. i won't try to benchmark them.

one works from a given file handle the other uses a -p loop. the
overhead on each for file I/O is the same. the win for the second
approach is the one liner, no match for company and no temp vars vs. a
full loop for the first method. but on efficiency they are
probably very close to each other. i would guess the one liner is faster
by too little to care.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Tue, 13 Oct 1998 13:32:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie needs help transposing two words in a file
Message-Id: <MPG.108d58b463b342ba989807@nntp.hpl.hp.com>

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

In article <sarpvbwqltn.fsf@camel.fastserv.com> on 13 Oct 1998 15:54:44 -
0400, Uri Guttman <uri@camel.fastserv.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
 ...
>   LR> What makes you think this approach is more efficient?  Have you measured 
>   LR> it?  Where are the results of the measurements?
> 
>   LR> I know about 'theoretical' science and 'experimental' science.  But not 
>   LR> about 'conjectural' science, at least not in programming.
> 
> actually larry, as i am sure you could tell, they are basically the same
> code. i won't try to benchmark them.

D'uh.  Yes, I knew that.  Maybe I was being too subtle.  I was trying to 
hit Ala (who posts too often before he thinks) over the head about sound 
methodology.  His response (if any) should be interesting.  (His e-mail 
address is bogus, BTW.)

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


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

Date: Tue, 13 Oct 1998 19:28:12 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <3623a8c2.403233408@news.mindspring.com>

On Tue, 13 Oct 1998 15:01:32 +0100, Anthony Clark
<anthony.clark@adv.sonybpe.com> wrote:

>However, I was disappointed it didn't answer
>this:
>
>foreach $item ( @array )
>{
>    # delete the current $item from the @array if it matches a pattern
>}
>
>How the hell do I do this?

I believe the canonical way to do this is to use grep:

@array = grep(!/pattern/, @array);

Insert the particular pattern you're looking for.  Essentially, the grep
returns a list of all of the array items that _don't_ match the pattern.
This is equivalent to deleting those that do match the pattern, once you've
assigned the list back to the original array.

Ben
-- 
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA


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

Date: 13 Oct 1998 19:26:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <7009hp$8oq$2@client3.news.psi.net>

Mike Stok (mike@mike.stok.co.uk) wrote on MDCCCLXIX September MCMXCIII in
<URL:news:7002br$jng@news-central.tiac.net>:
++ In article <36235D50.1E46F15C@adv.sonybpe.com>,
++ Anthony Clark  <anthony.clark@adv.sonybpe.com> wrote:
++ 
++ >foreach $item ( @array )
++ >{
++ >    # delete the current $item from the @array if it matches a pattern
++ >}
++ >
++ >How the hell do I do this?
++ 
++ for ($index = $#array; $index >= $[; $index--) {
++     if ($item should be deleted) {
++         splice @array, $index, 1;
++     }
++ }
++ 
++ is one way to do it.
++ 
++ Maybe not the best, but it does avoid cutting the ground out from beneath
++ yourself.  Whether it's OK depends on the side of your data set, how many
++ elements get removed and where they are in the array...


It's not very likely to be the best.


@array = grep {! (expression matching item to be removed)} @array;




Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Tue, 13 Oct 1998 18:27:32 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <F0s39w.62u@news.boeing.com>

In article <36235D50.1E46F15C@adv.sonybpe.com>,
Anthony Clark  <anthony.clark@adv.sonybpe.com> wrote:
>> Could anybody who has read the Perl Cookbook please tell me if this is the
>> best perl book to get.
>
>I'm no Perl expert, but I found this book invaluable.  It has many examples that
>are spot on to what I wanted to do.  However, I was disappointed it didn't answer
>this:
>
>foreach $item ( @array )
>{
>    # delete the current $item from the @array if it matches a pattern
>}
>

No, everything worth knowing is in the Perl Cook Bookbook :) 

Look at the discussion of grep on page 114 for example. With 
a little juggling, you can easily do what you want. (Hopefully, 
you're not dealing with multi-dimensional arrays)  

   @array = grep { /^wanted/ } @array; 

or,

   @array = grep { not /^unwanted/ } @array; 


You could use map too:

   @array = map { /^wanted/ ? $_ : () } @array 


regards,
--
Charles DeRykus


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

Date: 13 Oct 1998 20:42:22 GMT
From: mdh@cyberjunkie.com (Mark den hartog)
Subject: perl scripts won't work: (RH5.1 Linux) "command not found" plz help
Message-Id: <3623bae0.2623515@news.euro.net>

Hello, hope you can help me on this one:

problem: Perl-scripts won't work. The bash returns : "command not
found".
I have given the simple script chmod +x, and even the "political
correct" chmod 755 <filename.pl>.
Since my Linux-box isn't up 24 hrs a day, I ran the updatedb crontab
(lot's of hda1 activity) , and perl is well located: /usr/bin/perl,
and lot's of other places. But still the scripts won't work.

I could really do with some help on this one..

Regards,
Mark


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

Date: Tue, 13 Oct 1998 19:18:07 GMT
From: Daniel Grisinger <dgris@perrin.dimensional.com>
Subject: Re: sorting hack
Message-Id: <m367dojn1z.fsf@perrin.dimensional.com>

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

> "Always" is a rather strong statement.

But accurate, at least as far the impossibility of sorting without
looping.

>                                         Below is the code I posted 
> yesterday, modified to deal with Xah's unreasonable requirement that the 
> input numbers (all non-negative integers) can be of arbitrary length.  I 
> cannot find a loop in the comparison routine; either directly in my 
> program, or somewhere behind the scenes.

Hmmmm....  I count 4 implicit loops in your code, verified by
scanning the output of -Dtl.  But it seems obvious that you can't
repeatedly apply the same expression to all elements of an array
without some sort of loop, so perhaps you were being facetious :-).

> my @out = map $_->[0] => sort { $a->[1] cmp $b->[1] }
            ^^^            ^^^^
Loops 0 and 1.

>     map { [ $_, sprintf "%${max}s" x @$_ => @$_ ] } @in;
      ^^^
Loop 2

> print '(';
> {
>     local ($,, $") = (', ', ', ');
>     print map "[@$_]" => @out;
            ^^^
Loop 3

> }
> print ")\n"; 
> __END__
<snip>

dgris
-- 
Daniel Grisinger          dgris@perrin.dimensional.com
`By about halfway through I was beginning to guess the 
ending, but it still kind of surprised me.'
      David Hatunen, talking about the movie Titanic


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

Date: Tue, 13 Oct 1998 13:25:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sorting hack
Message-Id: <MPG.108d572d4652f479989806@nntp.hpl.hp.com>

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

In article <m367dojn1z.fsf@perrin.dimensional.com> on Tue, 13 Oct 1998 
19:18:07 GMT, Daniel Grisinger <dgris@perrin.dimensional.com> says...
! lr@hpl.hp.com (Larry Rosler) writes:
! 
! > "Always" is a rather strong statement.
! 
! But accurate, at least as far the impossibility of sorting without
! looping.
! 
! >                                         Below is the code I posted 
! > yesterday, modified to deal with Xah's unreasonable requirement that
! > the input numbers (all non-negative integers) can be of arbitrary
! > length.  I cannot find a loop in the comparison routine; either
! > directly in my program, or somewhere behind the scenes.
! 
! Hmmmm....  I count 4 implicit loops in your code, verified by
! scanning the output of -Dtl.  But it seems obvious that you can't
! repeatedly apply the same expression to all elements of an array
! without some sort of loop, so perhaps you were being facetious :-).

Sorry, you have missed the point completely.  OF COURSE one can't sort 
without looping.  The statement Abigail made referred to always needing 
'a loop IN THE COMPARISON ROUTINE' to solve the requested problem.  And 
that is not so, as I have shown.

And I'm sorry for shouting, but ...

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


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

Date: Tue, 13 Oct 1998 19:01:06 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Unix Perl vs. Unix Perl?
Message-Id: <Pine.GSO.4.02A.9810131157120.1979-100000@user2.teleport.com>

On Tue, 13 Oct 1998, Chilton Webb wrote:

> I've lately come to find several differences between the Perl on my
> new server and the Perl on the old server. But I could just be
> *wrong*. Both of them have the same version (5.002)

How can you be sure? If it's running on the server, as opposed to your
command line, you may be using a different binary than you expected. The
symptoms you describe sound like maybe Perl four (eek!). If you can't use
the command '/usr/bin/perl -v' on the command line, this may be useful:

    #!/usr/bin/perl

    print "Content-type: text/plain\n\n";
    print "This perl is version $]\n";

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 13 Oct 1998 15:36:55 -0400
From: Oleg Waisberg <Oleg_Waisberg@Health.Lmig.ca>
Subject: Using Filesecurity.pm ?
Message-Id: <3623ABD7.AAE9E483@Health.Lmig.ca>

Hello All!

We are  considering to write a program
which allows to set Dir/File permissions
on NTFS. We'd like to use FileSecurity.pm
package from the Perl Resource Kit Win32,
but we came across to few problems:

1. How to set permissions on File/Dir
    without overriding of existing permissions?

2. If we want to set a special access to Dir/File
    I mean not Access Type but specific
    permission: read or write or exec only how
    do we do it? I've tried to use names from
    of exported variables in FileSecurity.pm
    but it's confusing a little what the difference
    between GENERIC_WRITE and
    STANDARD_RIGHTS_WRITE for instance?
    And where can I find the exact description of
    each of these flags?

3. How can I use a domain names ? It looks like
    functions Set and Get from FileSecurity.pm
    understand a local accounts only ?

4. Is there source of this package ? I'd like to see
    some details and may be to change an error
    handling? When an error occurs in one of
    of the functions of FileSecurity package the
    execution of a program stops but I want to
    continue processing while setting or getting
    permissions for multiple files.........

Thanks in advance.
Sincerely
Oleg Waisberg
------------------------------------------------
w.oleg@mailcity.com
Oleg.Waisberg@health.lmig.ca
------------------------------------------------



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

Date: Tue, 13 Oct 1998 19:09:11 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: which chars to escape in reg.exp?
Message-Id: <8caf30e0to.fsf@gadget.cscaper.com>

>>>>> "Ilya" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:

Ilya> Perl tries to be smart, and DWYM.  In particular, you can never
Ilya> predict how a complicated RE is going to be parsed, since perl
Ilya> considers several different variants, and chooses one basing on
Ilya> weights assigned by unintellegible algorithms.

I bet there's at least *one* person on the planet who understands
those algorithms. :)

-- 
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: 13 Oct 1998 13:24:54 -0700
From: larry@kiev.wall.org (Larry Wall)
Subject: Re: which chars to escape in reg.exp?
Message-Id: <700cum$f0t@kiev.wall.org>

In article <7004jq$4d$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to Daniel Grisinger 
><dgris@perrin.dimensional.com>],
>who wrote in article <m3emscjsvy.fsf@perrin.dimensional.com>:
>> What I meant was, I can't get @[ to interpolate without explicitly
>> disambiguating it as Abigail shows.
>> 
>> This surprised me as I thought that variable interpolation was the
>> first thing that happened when a regular expression is constructed.
>> I had thought that @[ would interpolate automatically before it
>> could be construed as the start of a character class.  I was wrong.
>
>See the thread on "jumping into your face".  
>
>Perl tries to be smart, and DWYM.  In particular, you can never
>predict how a complicated RE is going to be parsed, since perl
>considers several different variants, and chooses one basing on
>weights assigned by unintellegible algorithms.

Now you're just jumping onto your own bandwagon.  This has nothing to
do with weighted dwimming, and nothing to do with regular expressions.
@ will simply *never* interpolate an array named "[" anywhere, ever.
In fact, the next character must be alphanumeric, unless you happen to
be saying one of

    @::foo, @'foo, @{foo}, @$foo

Please don't overstate your case--it prejudices me against it, and
I don't like to be prejudiced.  :-)

Larry


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

Date: Tue, 13 Oct 1998 19:33:59 GMT
From: hladik3@hladik.cz
Subject: Win32/95 and resolving problem under CGI
Message-Id: <7009v7$boc$1@nnrp1.dejanews.com>



I test my Perl script localy under W95 system and Fasttrack server.
All things i made with ActiveState perl build 502 and 503 are without any
problems with one exception:

resolving hostnames under and ONLY under fasttrack server/W95.
It is very strange problem because under command line all works great.
If i use ip addresses all is OK.

If i try trace problem it indicate that this is exactly in inet_aton
routine or gethostbyname routine which returns udefined value.
I checked paths, registry values and all seems to be ok. Simple script:

                      use Socket;
                      print "Content-type: text/html\n\n";

                      $adr = inet_aton('www.netscape.com');
                      $adr = gethostbyname('www.netscape.com');
                      if ( defined $adr) {
                      print "$adr";
                      } else {
                      print "undef!";
                      }

It does work under commandline environment but returns undef! under Fasttrack
CGI environment!!!

It seems this is some BUG in socket.dll??

                      Zdenek Hladik
                      INFIMA-WAN

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


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

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

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