[8973] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2591 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 14 04:07:24 1998

Date: Thu, 14 May 98 01:01:17 -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           Thu, 14 May 1998     Volume: 8 Number: 2591

Today's topics:
    Re: Actually a proposal: (was: Grieving our dying commu <andy@wonderworks.co.uk>
        Catch Exception <peng7072@cs.nyu.edu>
    Re: Catch Exception <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: character echo <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Does Perl have a IDE?I don't like command line. (Chip Salzenberg)
    Re: Does Perl have a IDE?I don't like command line. (Koos Pol)
    Re: Does Perl have a IDE?I don't like command line. (Mark Maurer)
    Re: Does Perl have a IDE?I don't like command line. (Frank)
    Re: Does Perl have a IDE?I don't like command line. (Mark Maurer)
    Re: Friday-night Problem, Week 20 ... :) (Tina Marie Holmboe)
    Re: Get remote host dir using ftp.pl (Martien Verbruggen)
    Re: Grieving our dying community (Chip Salzenberg)
    Re: How can you break out of a 'while... ' loop in a fu (Chip Salzenberg)
    Re: How can you break out of a 'while... ' loop in a fu (Chip Salzenberg)
    Re: How can you break out of a 'while... ' loop in a fu (Ilya Zakharevich)
    Re: How can you break out of a 'while... ' loop in a fu (Tina Marie Holmboe)
    Re: How can you break out of a 'while... ' loop in a fu (Tina Marie Holmboe)
    Re: How can you break out of a 'while... ' loop in a fu (Tina Marie Holmboe)
        Ignore - I'm posting to get the FAQ from AutoFAQqer!!! <ara@neWave.net.au>
        IPC with not nice programs <haverlan@agric.gov.ab.ca>
    Re: New IDE for Perl (Chip Salzenberg)
        pattern matching problem: some string "with quotes" and (Jobst Schmalenbach)
    Re: Randomly sorting an array (Chip Salzenberg)
    Re: Randomly sorting an array (Chip Salzenberg)
    Re: Really Basic Questions (Chip Salzenberg)
    Re: regexp for strings of chars <monty@primenet.com>
    Re: Regular Expression Question <lr@hpl.hp.com>
        Running Perl on Windows genfil@my-dejanews.com
    Re: Running Perl on Windows <gawronskip@usa.net>
        Tearing my hair out over Regular Expressions - help! (Luke Steele)
    Re: Tearing my hair out over Regular Expressions - help (Luke Steele)
        The battle against WIMPs (was Re: Does Perl have a IDE? (Chip Salzenberg)
        Win32: Use of Command Line Parameters? <gibney@triad.apana.org.au>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 13 May 1998 16:18:25 +0100
From: Andy Armstrong <andy@wonderworks.co.uk>
Subject: Re: Actually a proposal: (was: Grieving our dying community)
Message-Id: <6SkzQFABnbW1EwLx@wndrwrks.demon.co.uk>

In article <35599D9D.82C50D9@nortel.co.uk>, Frank L. Quednau
<quednauf@nortel.co.uk> writes

[snipped: diagnostic wizard idea]

How would you point people at the wizard instead of this newsgroup? If
people were prepared to do the necessary legwork to find the answers to
their questions rather than blithley posting here then the problem
would, to a great extent, cease to be.

-- 
** Don't CC any follow-ups to me - I *do* read the newsgroups I post to **
Andy Armstrong, Wonderworks, http://www.wonderworks.co.uk


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

Date: Thu, 14 May 1998 00:04:28 EDT
From: Alex Peng <peng7072@cs.nyu.edu>
Subject: Catch Exception
Message-Id: <6jdqgc$a00$1@earth.superlink.net>

I am looking the same method as java
try {


} catch (.....) {}

I have following coding in perl

eval("\$len=length(\$ENV{QUERY_STRING})";

if ($@) ...


My query string can be nothing, and I want to have error handling.
I check server error log, the "eval" can't catch error.
In my CGI, I don't use get or post method and I am not going to use
that.
CGI is call by URL w/o or with appending query string.

I appreciate anyone can point out the clue.

Alex



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

Date: 14 May 1998 09:40:02 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Catch Exception
Message-Id: <7xhg2tl2r1.fsf@beavis.vcpc.univie.ac.at>

Re: Catch Exception, Alex <peng7072@cs.nyu.edu> said:

Alex> eval("\$len=length(\$ENV{QUERY_STRING})";

It's not exactly answering your question, but use Lincoln's
CGI module instead:

    http://www-genome.wi.mit.edu/ftp/pub/software/WWW/

It lets you get on with solving your problem rather than
re-inventing the solution.

hth,
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: 14 May 1998 09:15:07 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: character echo
Message-Id: <7xiun9l3wk.fsf@beavis.vcpc.univie.ac.at>

Re: character echo, Cameron <cgl@acpub.duke.edu> said:

Cameron>     Does anyone know how to read in a password from
Cameron> stdin without echoing characters to the screen?

The Curses package will turn off echo'ing.

-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: Wed, 13 May 1998 22:23:51 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jd6kp$aj$1@cyprus.atlantic.net>

Greg Bacon <gbacon@cs.uah.edu> writes:
> The very act of exposing Perl's pristine beauty to the unappreciative,
> unthinking, and, hence, unworthy clueless droves of lose32 users is
> dumbing down the language.  

Mmm.  Think of it as our responsibility to do what we can to help
those less fortunate than us.  It's the Real Programmers' Burden.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 14 May 1998 06:36:19 GMT
From: koos@stag (Koos Pol)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6je3d3$o7q@news.nl.compuware.com>

Michael J Gebis (gebis@albrecht.ecn.purdue.edu) wrote:
| Help me, I'm in hell.  I'm saying "A Perl IDE with a clever help
| system might increase the percentage of folks who read the
| documentation."  I refered to an excellent book about design, and
| pointed out that a flood of questions might indicate that the help
| system might not be optimal.  I never claimed the language should
| change, or be dumbed-down, in any way.

| Programming languages are not an everyday thing, but help systems
| should be.  Perldoc is an oddity for non-unix programmers.  They can
| understand it, but it clashes, and will continue to be ignored
| forever.

Applause. I program in Perl for about a year now. Mostly in OS/2 and
since a few months on Solaris. I must say that Ilya's OS/2 helpsystem
has helpded me infinitely much better that the man pages
(Thanks Ilya!). I hardly ever use the man pages at all. My employer
luckily decided to throw in the Perl Resouce Kit.... Flipping pages is
better that flipping manpages after all... I program, but it
doesn't mean it has to be the archaic way.

--
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
Systems Administrator                      email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: 14 May 1998 02:37:48 -0400
From: mwmaurer@mtu.edu (Mark Maurer)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6je3fs$cgi$1@pace1.cts.mtu.edu>

Chip Salzenberg (chip@mail.atlantic.net) wrote:
: Greg Bacon <gbacon@cs.uah.edu> writes:
: > The very act of exposing Perl's pristine beauty to the unappreciative,
: > unthinking, and, hence, unworthy clueless droves of lose32 users is
: > dumbing down the language.  
: 
: Mmm.  Think of it as our responsibility to do what we can to help
: those less fortunate than us.  It's the Real Programmers' Burden.

I wouldn't worry about distant lose32 brethren.  If perl really catches on,
pretty soon someone will create Visual Perl, thereby proving even Perl can be
made useless by adding the Visual... :)

-- 
Mark Maurer  markm@dct.com                      mwmaurer@mtu.edu
Programmer,  Digital Magic Interactive          http://www.dminteractive.com
Senior,      Michigan Technological University  Houghton, MI
-- Views do not represent those of my employer or school


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

Date: 14 May 1998 09:15:25 +0200
From: dont_use_this_ey@hotmail.com (Frank)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <yo9u36t2uia.fsf@nym.sc.philips.com>


Tom Christiansen <tchrist@mox.perl.com> writes:
> 
> See http://www.salon1999.com/21st/feature/ for more on this.

This whole discussion makes me sick. 



Using Perl _is_ dumbing down programming. Perl is full of constructs
which behave strange (I think it is called special variables,MAGIC,
context). 


Perl is full of wizards (in this context called MODULES) which allow me
to tackle tasks which I should better have avoided. The usage of these
Modules/Wizards will backfire at some point of time. 

Perls InstallShield wizard is called CPAN. Both will fail if you try
to influence the way they behave.


To give new names to these things does not make them better.


bye
	Frank

- Perl is one of many ways to do things.







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

Date: 14 May 1998 03:46:59 -0400
From: mwmaurer@mtu.edu (Mark Maurer)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6je7hj$cub$1@pace1.cts.mtu.edu>

Frank (dont_use_this_ey@hotmail.com) wrote:
: 
: Tom Christiansen <tchrist@mox.perl.com> writes:
: > 
: > See http://www.salon1999.com/21st/feature/ for more on this.

A VERY good site, I thought...

: This whole discussion makes me sick. 

???

: Using Perl _is_ dumbing down programming. Perl is full of constructs
: which behave strange (I think it is called special variables,MAGIC,
: context). 

Uhh, no.  All useful (and many nonuseful) programming languages contain
ideosyncracies.  Having the special variables, such as $_, $|, etc does NOT
make dumbed-down programming. 

: Perl is full of wizards (in this context called MODULES) which allow me
: to tackle tasks which I should better have avoided. The usage of these
: Modules/Wizards will backfire at some point of time. 

Well, they already have for some people.  A LOT of people flat out do not use
them.

: Perls InstallShield wizard is called CPAN. Both will fail if you try
: to influence the way they behave.

You lost me here...

: To give new names to these things does not make them better.

Well, perl is not just giving these things a new name, they are rather
differeint, IMO...

: - Perl is one of many ways to do things.

In my estimation, usually one of the better ways...

-- 
Mark Maurer  markm@dct.com                      mwmaurer@mtu.edu
Programmer,  Digital Magic Interactive          http://www.dminteractive.com
Senior,      Michigan Technological University  Houghton, MI
-- Views do not represent those of my employer or school


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

Date: 14 May 1998 07:49:51 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: Friday-night Problem, Week 20 ... :)
Message-Id: <6je7mv$cnf$3@news1.sol.no>

In article <l0aaj6.5cd.ln@localhost>,
	tadmc@flash.net (Tad McClellan) writes:

> Tina Marie Holmboe (tina@scandinaviaonline.se) wrote:
> 
>:      die("Unable to [$Command], $!\n") if ( ! open(PTR, "$Command|") ) ;
> 
>:   However: snippet #2 showed an uncharacteristic ability to actually never
>:   die. This was the source of much annoyment until a certain small light
>:   started flashing. More experienced Perl'ers will, now, start guffaw'in.
> 
> 
> The rawest of newbies is also guffaw'in if they are conscientious
> enough to have had a look at the Perl FAQs...

  *Now* can you imagine how I felt ? It *was* a while since I was a newbie,
I *have* read the faq, but in never even connected. Typically friday night,
that was.

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 14 May 1998 06:46:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Get remote host dir using ftp.pl
Message-Id: <6je40m$fuv$1@comdyn.comdyn.com.au>

In article <6jdngh$kn8$1@tst.hk.super.net>,
	chengcs@news.hk.super.net (Mr Chi Sang Cheng) writes:
> Help!
> 
> I don't know how to obtain remote host dir contents using ftp'dir_open
> in ftp.pl library.

I don't know about ftp.pl. It won't even work anymore for me. 

If you're not too wedded to the use of ftp.pl, with Net::FTP it's
fairly simple:

use Net::FTP;
#
# Set $hostname, $username and $pass here
#
my $ftp = Net::FTP->new($hostname) or die "Cannot ftp";
$ftp->login($username, $pass) or die "Cannot login";
my @dirs = $ftp->ls;
foreach (@dirs) { print "$_\n"; }
$ftp->quit;

It's part of libnet, which you can get from CPAN, if it's not
installed already.

# perldoc Net::FTP

http://www.perl.com/CPAN/

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd.       | inexactitude.
NSW, Australia                      | 


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

Date: Wed, 13 May 1998 22:40:19 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Grieving our dying community
Message-Id: <6jd7jl$bs$1@cyprus.atlantic.net>

According to Andy Armstrong <andy@wonderworks.co.uk>:
>Chris Russo <news@russo.org> writes
>>News flash: Most people are stupid.  More at eleven.
>
>It does however seem inconceivable that they're as stupid as they make out.

I suggest that your difficulties are not due to the population being
smarter than they have been painted, but a failure of your imagination.

"No one ever went broke underestimating the intelligence of the ... public."
    -- someone who presumably made a lot of money that way

"The two most common elements in the universe are hydrogen and stupidity."
    -- Einstein

-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 13 May 1998 22:43:14 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6jd7p5$cu$1@cyprus.atlantic.net>

According to stu-w@usa.net.remove.everything.after.net (Stuart Wright):
>On Mon, 11 May 1998 15:59:09 GMT, Tom Phoenix <rootbeer@teleport.com> wrote:
>>On Mon, 11 May 1998, Stuart Wright wrote:
>>> A simple question, but all the pearl FAQs are useless.
>>Please justify that sweeping generalization.
>
>I read them and I found *no* useful information for the 'novice' Perl
>programmer.

"When [documentation] and a head collide,
  and a hollow sound is heard --
  is it always the [documentation]?"

-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 13 May 1998 22:41:40 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6jd7m6$cd$1@cyprus.atlantic.net>

According to stu-w@usa.net.remove.everything.after.net (Stuart Wright):
>Ah well that explains it then - I've been programming in Perl for a
>year and I've never *had* perl - just a (bad) book and Wordpad.

I boggle.

>What exaclty is 'the perl distribution' then ?  It might be worth me
>getting it for the documenation if nothing else.

See www.perl.com, esp. the CPAN and documentatioin links.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 14 May 1998 05:38:51 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6je01b$efq$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Chip Salzenberg
<chip@mail.atlantic.net>],
who wrote in article <6jd7p5$cu$1@cyprus.atlantic.net>:

> "When [documentation] and a head collide,
>   and a hollow sound is heard --
>   is it always the [documentation]?"

Depends on what is in documentation.  

With Perl4 it would probably be the head.  With perl5...  I think it
is a *giant* step back - at least if the docs are not in Gnuinfo, PDF,
or other online book format with an easy search, table-of-contents and
index available.

And with Gnuinfo and PDF sucking enormously, OS/2 online book not
allowing third party viewers/searchers (though this need comes pretty
rare), I just do not understand how people who did not learn from
Perl4 docs can do anything without a book.

Ilya



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

Date: 14 May 1998 07:23:27 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6je65f$ch9$1@news1.sol.no>

In article <6ja2hs$c64$1@jelerak.scrye.com>,
	angst <angst@scrye.com> writes:

  (I'll just chop your posting abit ;)

> Maybe I'm just not understanding what you're saying here.

  I think the egg is on my face for not explaining myself sufficiently. Let
me see if I cannot use the *right* words this time...

  Firstly, I am *not* saying that next()/last() == goto(). Had I done that
I would be due for some padded room.

  What I *am* saying is that in concept both next() and last() do the same
thing to a loop that a goto() does - it interrupts the flow; it "breaks out"
of it. next() is by far the least 'harmful' - and note the 's there - of
the two, as it merely skips to the next iteration.

  However, IMHO and all that, the last() function creates a situation where
a loop as one entry point, and N>1 exit-points. Consider, since you mention
foreach, the following:

    foreach $key ( sort ( keys ( %hash ) ) ) {
      print "$key\n" ;
    }


  If we read this out, it'll go something like this:

    "Iterate over the sorted keys from the associative array 'hash'" and
     "Print the key"

  From a maintenance-perspective, this is a fairly easy construct to work
with. Everything you need is in that first line. Consider, next, this:



    ITR: foreach $key ( sort ( keys ( %hash ) ) ) {
      if ( $key eq 'lwall' ) { last(ITR) ; }
      print "$key\n" ;
    }


    "Iterate over the sorted keys from the associative array 'hash'" and
     "Print the key... unless it is equal to 'lwall', then stop"


  It still isn't _hard_ to work with, but it suddenly had two exits:

    1) All keys have been processed,
    2) The key is equal to 'lwall'.

  Now add - left as an exercise :) - more tests for special cases inside the
block. The number of exits are then N>1. and the loop - again in my humble
opinion - has become much harder to maintain and debug.

  Secondly, I am *not* saying that next() and last() doesn't have their
rightful place among the tools-of-the-trade, but I am trying to point out that
from a structure and maintenance perspective one should really consider
(twice) whether

    a) next()/last() is a good solution, or
    b) the loop itself needs re-working.


  Whilst I've not been in this game as long as some, I have used a) *once*
since 1993 - and I reworked that loop later on. I have 'inherited' rather
alot of code which utilized last()/next() to a great extent, however, and it
isn't always fun trying to figure out which way was out - of the loop.

  These words make more sense ?

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 14 May 1998 07:35:24 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6je6rs$cnf$1@news1.sol.no>

In article <6jc811$36j$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:

>:> Larry has declared that line of reasoning to be bull.
>:
>:  Your point being ... what ?
> 
> I do grow tired of having to prove every little thing.  I happen to have a
> life, you know.  Being free compsci professor on the net is not that life,

  You made a blanket statement that person X had declared position Y to be
totally rubbish. Bull even. Whether you want to elaborate on that is quite
up to you. I merely asked what point you where trying to make.




> The point is that this phobia about avoiding control-flow alterations
> is pure bunk.  It complicates your program and renders it difficult
> to maintain.  Pascal was a horrible botch.  Remove next, last, redo,

  Here is where we disagree. My *opinion* - not based on any form of phobia
thankyouverymuch - is that a loop with *one* entry and *one* exit point is
often *much* easier to maintain.

  That opinion is something I'll retain. And, as I have pointed out in
another posting, I do *not* insist, but I *do* advice that one take another
look at the loop before using next/last combinations.

  I trust I still have the right to hold this opinion.



  From The Book:

>     Write your code with the number of loop exits (and function returns)
>     that is natural to the problem you're trying to solve.  If you've

  Agreed. The fact, however, is that many people use next/last as a way of
more lazyness than even a Perl programmer should allow himself. In the
*example* sited from the book, 'breaking out' is a Good Thing.

  But that is not *always* the case - hence my original comment, which I 
admit was abit loosely worded.

-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 14 May 1998 07:46:23 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6je7gf$cnf$2@news1.sol.no>

In article <3559bbe3.22846461@news.demon.co.uk>,
	stu-w@usa.net.remove.everything.after.net (Stuart Wright) writes:

> I was wanting to exit the 'foreach' loop if the member was found.
> In a similar example I'm searching through a text file of over 12,000
> records and doing the whole lot even if the record I want is the first !

  Might I suggest that you replace the foreach with a while; something like
this: (untested code; sorry, I'm pressed for time right now)


 $memberfile = "members.txt";
 open(memberfileno, "$memberfile") || die "I can't open that because: $!\n";
 while(<memberfileno>) {
   chop;		
   @all = split(/\n/);

   my($found) = 0 ;
   while ( (@all) && (! $found) ) {
     my($line) = shift(@all) ;

     ($filemember, $a1, $a2, $a3, $a4, $a5, $pc, $dateob) = split(/%/, $line);
     if ($filemember eq $member) {
       $found = 1 ;
       $address1 = $a1;
       $address2 = $a2;
       $address3 = $a3;
       $address4 = $a4;
       $address5 = $a5;
       $postcode = $pc;
       $dob = $dateob;
     }
   }
 }

 This means you'll exit the while *either* when the @all array is empty, *or*
when the member was found. Yes, as some will gripe about, this solution
uses a temporary variable, but ... its a matter of opinion.

  Alternatively:


 $memberfile = "members.txt";
 open(memberfileno, "$memberfile") || die "I can't open that because: $!\n";
 while(<memberfileno>) {
   chop;		
   @all = split(/\n/);

   ITR: foreach $line (@all) {

     ($filemember, $a1, $a2, $a3, $a4, $a5, $pc, $dateob) = split(/%/, $line);
     if ($filemember eq $member) {
         $address1 = $a1;
       $address2 = $a2;
       $address3 = $a3;
       $address4 = $a4;
       $address5 = $a5;
       $postcode = $pc;
       $dob = $dateob;
       last(ITR) ;
     }
   }
 }


-- 
  Tina Marie Holmboe                
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 14 May 1998 07:25:17 GMT
From: "SBS expt" <ara@neWave.net.au>
Subject: Ignore - I'm posting to get the FAQ from AutoFAQqer!!!
Message-Id: <01bd7f08$f36fac90$fdb70eca@nt4>


 Yep! I just want that Perl FAQ...


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

Date: Wed, 13 May 1998 13:46:50 -0600
From: Gordon Haverland <haverlan@agric.gov.ab.ca>
Subject: IPC with not nice programs
Message-Id: <3559F8AA.6565@agric.gov.ab.ca>

I need to set up a method of converting many (thousands)
coordinates from lat-long to something called a WGS-84
(or NAD-83) UTM.  To do one or two is a piece of cake,
I have a program which does this magically.  On the
surface, this program looks quite similar to bc or dc.
When you start up the program, it prints a 3 line header,
and then waits for the user to type in a pair of lat-long
coordinates.  It responds (almost immediately) with the
UTM coordinates (and the UTM zone).
 
I have tried the examples in the perldoc's about using
IPC::Open2 to send data to bc for calculation, and it
works.  If I try the same code with my m.ll2u program,
it just hangs forever.  If I use the older Comm.pl
IPC code, I get a strange buffered return.
There, I open the pty to m.ll2u, and do 3 reads
on the $pty file handle to get the header.  I then
go into a loop to send data to the program and read
the results.  However, when I go to read the UTM coordinates
after writing lat-long, what I read is the first line
of header information (then the second, then the third).
This doesn't seem to be the way pseudo terminals
are supposed to work, so all I can think is that I
am doing something wrong.  I've tried to read every IPC
related page on via CPAN::Search, Wait, Infoseek, Altavista,
 ..., and nothing appears to offer a solution.

Any ideas?

Thanks.
Gordon Haverland
haverlan @ agric.gov.ab.ca


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

Date: Wed, 13 May 1998 22:46:07 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: New IDE for Perl
Message-Id: <6jd7ui$e3$1@cyprus.atlantic.net>

Stuart McDow wrote:
> Samuel King <samk@was.net> writes:
> > This is the place to try the first IDE for perl, well that I know of
> > anyway..
>
> The *first* IDE? What, then, is emacs?

Emacs is too good (general) to be any specific thing.  Thus when someone
makes something more limited (specific), it's the first whatever.  That
doesn't necessarily mean it's an improvement on the general tool.  :-)
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 14 May 1998 07:50:58 GMT
From: jobst@senna.eng.monash.edu.au (Jobst Schmalenbach)
Subject: pattern matching problem: some string "with quotes" and not
Message-Id: <6je7p2$gq1$1@towncrier.cc.monash.edu.au>

Hi netters,

I am trying to find a way (and I tried lots) to use split and other
utils to search and split a pattern like this:

 "some string" "with quotes" without quotes


I like to have them in 4 variables. In the moment I am using
a number of steps eg:

 ($one,$line) = split(' ',$line,2);
 $one =~ s/"//;
 ($two,$line) = split(' ',$line,2);
 $two =~ s/"//;
  
  ......

so I have: 
$one => some string
$two => with quotes
$three => without
$four => quotes

(The quotes are there to show "this belongs together")

Is it possible, given the power of reg-expressions
and Perl, to do that in a one liner or at least less lines?

eg to tell split to get rid of them quicker?
I always have ended up in my tries to have them split at the wrong places.



Any ideas???
Jobst







--
|             __, Jobst Schmalenbach, Monash Uni, Melbourne, Australia |
|   _ _.--'-n_/   Electrical and Computer Systems Engineering          |
| -(_)------(_)=  email jobst@senna.eng.monash.edu.au    61-3-99055705 |
|                 http://senna.eng.monash.edu.au/~jobst  61-41-1611855 |


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

Date: Wed, 13 May 1998 22:22:06 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Randomly sorting an array
Message-Id: <6jd6hg$a2$1@cyprus.atlantic.net>

According to abigail@fnx.com:
>Chip Salzenberg (chip@mail.atlantic.net) wrote:
>++     sub shuffle {
>++         my @new;
>++         push @new, splice @_, rand @_, 1 while @_;
>++         @new;
>++     }
>
>Don't do that! It's horribly inefficient.

Worse than the exchange trick?  Why?
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 13 May 1998 22:21:10 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Randomly sorting an array
Message-Id: <6jd6fn$9d$1@cyprus.atlantic.net>

According to Kjell Arne Rekaa <etoxkar@eto.ericsson.se>:
>None of these examples do work!
>(It's a good idea to test them first)

True, but it's also a good idea to do research.

>Tom C. writes:
>>       for my $i (1..$#list) {         # Yes, start at 1!
>	The "my" before "$i" generates compilation error

Only if you haven't upgraded to Perl 5.004.

All Perl versions before 5.004 have outstanding CERT security
advisories.  So I think you're on the wrong side of the fence.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 13 May 1998 22:44:41 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Really Basic Questions
Message-Id: <6jd7rs$di$1@cyprus.atlantic.net>

According to phounsh@ucdavis.edu (Paul Hounshell):
>I have an excellent Perl book (from what I can tell) but it leaves out
>a couple of fundamental things.  I just need to know what the "not
>equal" comparison operator is, as well as binary And, Or, Not, XOr,
>NAND, and NOr.

Well, you should get used to the online docs ... they're the best base
documentation available, and always provide the missing bits when your
primary chosen doc is a book.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 13 May 1998 23:26:00 -0700
From: Jim Monty <monty@primenet.com>
Subject: Re: regexp for strings of chars
Message-Id: <6je2po$dcb@nntp02.primenet.com>

Craig Berry <cberry@cinenet.net> wrote:
> $_ = 'aaaaaabbb,,,xyfooffff';
> @a = m/.{3}/g;     # ('aaa', 'aaa', 'bbb', ',,,', 'fff')
>      m/(.)\1{2}/g;

I'm a newbie trying to understand, so pardon me if I'm missing something
obvious, but...

$ cat test.pl
#!/usr/bin/perl -w

@a = 'aaaaaabbb,,,xyfooffff' =~ m/(.)\1{2}/g;

foreach (@a) {
    print "$_\n";
}
$ ./test.pl
a
a
b
,
f
$

Is this the intended match/output?

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Wed, 13 May 1998 22:16:10 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Regular Expression Question
Message-Id: <6jduo6$i6t@hplntx.hpl.hp.com>

Ronald J Kimball wrote in message
<1d8zlt9.ltd997xr957qN@bay1-124.quincy.ziplink.net>...
>Larry Rosler <lr@hpl.hp.com> wrote:
>
<snipped in embarrassment>
>
>Whoa, you'd better read that book again, buddy.  That's not how
>non-greedy matching works at all!  Non-greedy matching always tries the
>*shortest* match first - hence "non-greedy".


Yes.

>([^(]*) is *more* greedy than (.*?).  The former has a greedy
>quantifier, after all, and the latter has a non-greedy quantifier.
>
>However, ([^(]*) is more efficient than (.*?).  There are two reasons
>for this.
>First, ([^(]*) involves less backtracking; it matches right out to the
>first \(, whereas (.*?) gets to the first \( only after stopping at
>every preceding character along the way.
>Second, ([^(]*) only involves one entry and exit into capturing
>parentheses, whereas (.*?) exits and reenters the capturing parens for
>every character up to the \(.  And exiting and entering capturing
parens
>is expensive.


I never thought of that.  All the more reason for people to get into the
habit of using (?: for "grouping" parentheses, where the value need not
be captured.

Thanks,

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: Thu, 14 May 1998 06:48:12 GMT
From: genfil@my-dejanews.com
Subject: Running Perl on Windows
Message-Id: <6je43d$20s$1@nnrp1.dejanews.com>

I need help!
I write perl scripts on unix and now I have to write scripts on NT and
Win95.
Is there an equivalent of  "#!/usr/bin/perl" on NT and Win95?
Thank you!

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


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

Date: Thu, 14 May 1998 07:34:03 GMT
From: "Przemyslaw G. Gawronski" <gawronskip@usa.net>
To: genfil@my-dejanews.com
Subject: Re: Running Perl on Windows
Message-Id: <355A9CE1.4F28D8A9@usa.net>

genfil@my-dejanews.com wrote:

> I need help!
> I write perl scripts on unix and now I have to write scripts on NT and
> Win95.
> Is there an equivalent of  "#!/usr/bin/perl" on NT and Win95?
> Thank you!

 Sorry, but I don't think there is any thing like that.

Przemek

--
         __   __  _      _   __   __   __  _
    -== /__) (  )( ) __ ( ) (  ) (  ) (  )( ) ============================--
 --=== //  _ //\\// (  ) \\ //\\ //\\ //\\// ==  Przemyslaw G. Gawronski  ==---
--=== ( ) ( )\\//\\_//\\_//// //((  ))\\//\\ =  mailto:gawronskip@usa.net  =----
 --=== \\_// //\\ \ /  \ / \\-\\ \\// //\\// =======  ICQ:8358522  =======---
   --== \_/ (_)(_)(_)  (_) (_)(_)(__)(_)(__) ===========================--





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

Date: Wed, 13 May 1998 20:10:43 GMT
From: ljs@cableinet.co.uk (Luke Steele)
Subject: Tearing my hair out over Regular Expressions - help!
Message-Id: <3559f6e5.4095422@news.cableinet.co.uk>

Ok, I exaggerated, I haven't torn any hair out yet - but I'm close!

The problem is this:  I have a file containing a number of lines, each
of which consists of a field name (in uppercase) followed by some text
(the 'value' of that particular line) followed by a newline.  The
contents of the file is placed in a scalar.  I wish to be able to
place the text following the field name in each line into a specific
scalar variable determined by the field name.

I've written a regular expression to acheive this but it goes haywire
every time it encounters a line which has a field name but is
otherwise empty (i.e. an empty entry).  Below is an example of the
regular expression I've come up with (I've substituted underscores for
spaces in the variable values):

"CONTACT:  Luke Steele  \nADDRESS: asdf  \n" =~
/^CONTACT:\s*(.*)\s*\n/gmi;
$&==CONTACT:_______Luke Steele___
$1==Luke Steele___

(The idea is $1 should contain Luke Steele with no spaces afterward.)

"CONTACT:\nADDRESS:   asdf   \n" =~ /^CONTACT:\s*(.*)\s*\n/gmi;
$&==&:CONTACT:
ADDRESS:___asdf___
$1==ADDRESS:___asdf___

($1 Should be empty.)

If anyone could help me with this problem I'd be extremely grateful -
it's been holding me up for a couple of days now!  Also if anyone
could recommend any books that could help me that would be useful too
(I already have Learning Perl & Programming Perl - I've read the first
and I'm working on the second.

Thanks again for any help!


--
Luke Steele
ljs@cableinet.co.uk


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

Date: Wed, 13 May 1998 20:14:42 GMT
From: ljs@cableinet.co.uk (Luke Steele)
Subject: Re: Tearing my hair out over Regular Expressions - help!
Message-Id: <3559fee9.6148204@news.cableinet.co.uk>

Sorry, second example should have read

"CONTACT:\nADDRESS:   asdf   \n" =~ /^CONTACT:\s*(.*)\s*\n/gmi;
$&==CONTACT:
ADDRESS:___asdf___
$1==ADDRESS:___asdf___

($1 Should be empty.)




--
Luke Steele
ljs@cableinet.co.uk


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

Date: Wed, 13 May 1998 22:28:41 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: The battle against WIMPs (was Re: Does Perl have a IDE?)
Message-Id: <6jd6ts$b7$1@cyprus.atlantic.net>

gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
> It's time to stop trying to fight a battle you lost a long time ago.
> Instead, it's time to do whatever is necessary to spoon-feed the
> documentation to them so they stop wasting time and bandwidth.

Well, no.  It's time to win the battle by attacking on the enemy's
vulnerable spot instead of their fortified position.  IDEs and other
chrome is the (marketing) strength of Windows.  So the free software
community is striking back where M$ is weakest:  Quality.

Linux is fast, efficient, portable, quickly updated as situations
change and security holes are found.  It extends the life of existing
hardware for year upon year.  Windows is helpless against the
onslought of Linux and other free software.  Is M$ on the ropes?
No... but they're bleeding, and their counterpunches aren't landing.

Granted the battle isn't over.  But the battleground isn't the Windows
Icons Mice Pulldowns (WIMP) interface.  It's where it should be: Solid
engineering.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Thu, 14 May 1998 16:54:52 +1000
From: John Gibney <gibney@triad.apana.org.au>
Subject: Win32: Use of Command Line Parameters?
Message-Id: <355A953B.9A110A22@triad.apana.org.au>

Hiya...

I recently downloaded and installed a copy of the ActiveState
Win32 port of Perl on my Win95 system and it's been working quite
happily in command window boxes, etc.  However, I'm having
some troubles with creating shortcuts and running Perl
scripts from Windows Explorer.

The association to run c:\Perl\bin\Perl.exe with .pl files
has been setup Ok but if I create a shortcut with command
line parameters, those arguments aren't being seen once the
Perl script is running.

Short of creating a batch file, can anyone offer some
suggestion as to how I might setup the shortcut so that the
command line parameters *are* seen?  I've looked through the
FAQs and www.perl.org and www.perl.com but haven't had any joy.

Thanks for any forthcoming info.


John

--
John Gibney       /\/\ . o O ( Tai Chi, Music, Boomerangs, Kites...)
South Blackburn  (o.o )      ( Civil Eng, Tutoring, Computing...   )
AUSTRALIA         >^ <         e-mail: gibney@triad.apana.org.au




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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2591
**************************************

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