[13184] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 594 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 19 22:07:20 1999

Date: Thu, 19 Aug 1999 19:05:09 -0700 (PDT)
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, 19 Aug 1999     Volume: 9 Number: 594

Today's topics:
    Re: Bragging about killfiling (Was: New posters to comp (Abigail)
    Re: Bragging about killfiling (Was: New posters to comp <tchrist@mox.perl.com>
        Can I use regx with eof()? <vmurphy@gamora.ndhm.gtegsc.com>
        Don't these things come together? (Bill Moseley)
    Re: Don't these things come together? (Martien Verbruggen)
    Re: expect module (?) question (Quinn Wilson)
    Re: HARASSMENT -- Monthly Autoemail <acinorev@earthling.net>
    Re: HARASSMENT -- Monthly Autoemail <acinorev@earthling.net>
    Re: how do i keep output from going to stdout <cassell@mail.cor.epa.gov>
    Re: How Test If Function Exists? (elephant)
    Re: How Test If Function Exists? <tchrist@mox.perl.com>
    Re: How Test If Function Exists? (elephant)
    Re: How Test If Function Exists? <tchrist@mox.perl.com>
    Re: How to view code as text in working cgi script <resource@ERASEjps.net>
    Re: OOP in perl - not modules!!! <mpersico@erols.com>
    Re: Passing undef to a subroutine (Abigail)
    Re: Perl function that searches $PATH for a filename (Abigail)
    Re: Perl Help (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 19 Aug 1999 20:40:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Bragging about killfiling (Was: New posters to comp.lang.perl.misc)
Message-Id: <slrn7rpchd.ath.abigail@alexandra.delanet.com>

David H. Adler (dha@panix7.panix.com) wrote on MMCLXXIX September
MCMXCIII in <URL:news:slrn7rok93.53t.dha@panix7.panix.com>:
// 
// Given that even an invocation of Godwin seems not to work, I wouldn't
// hold my breath... :-/


Only those that have misunderstood Godwins law try to invoke it.



Abigail
-- 
perl -wlpe '}$_=$.;{' file  # Count the number of lines.


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 19 Aug 1999 19:59:29 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Bragging about killfiling (Was: New posters to comp.lang.perl.misc)
Message-Id: <37bcb681@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    abigail@delanet.com writes:
:Only those that have misunderstood Godwins law try to invoke it.

Yup.  That reminds me of how those who have the audacity to call
themselves a "wizard" thereby automatically disqualify themselves from
the epithet. :-)

--tom
-- 
    "Big Brother is hallucinating."  
--Elizabeth D Zwicky (zwicky@cis.ohio-state.edu), title of a comp.risks article


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

Date: Fri, 20 Aug 1999 01:52:29 GMT
From: Vincent Murphy <vmurphy@gamora.ndhm.gtegsc.com>
Subject: Can I use regx with eof()?
Message-Id: <xjgso5frzfm.fsf@gamora.ndhm.gtegsc.com>

I have a file which has, amoung other things, a list of elements.  The
setup is:

element element_name_1 element_branch_1
element element_name_2 element_branch_2
:
:
:
element element_name_n element_branch_n

I want to grab everthing from element to the begining of the next element.
The element is both the begin pattern and the end pattern.  The element
name and branch could span multiple lines.  OK, so far so good. Now the
last element is the tricky one.  I can't get it to figure out how to get
/element/ .. eof() within this regx.


my $input = shift;

$/='';
open(INPUT, $input) || die "can't open $input: $!\n";
my $data;
my( $max_length, @lines ) = ( 0, ());
while ( defined( $data = <INPUT>) ) {
    while ( $data =~ m {
                        \b           # starts at a word boundary
                        (element.*?) # element whatever ...
                        \b           # followed by another word boundary
                        (=?          # see if it has
                         element     #   element
                         |           #     or
                         eof()       #   at end of file.
                         ## eof not currently working with this.
                        )
                       }xgs ) 
    {
        # need to reset pos in order to backtrack to "element"
        pos( $data ) = pos( $data ) - length( "\belement" );
        my $line = $1;
        $line =~ s/\n//g;
        push( @lines, $line );
    }
}

Any ideas on how I would get the last element?

-- 
Vinny 


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

Date: Thu, 19 Aug 1999 17:35:39 -0700
From: moseley@best.com (Bill Moseley)
Subject: Don't these things come together?
Message-Id: <MPG.122642ba3fb038619896c5@nntp1.ba.best.com>

135) ~/public_html/lii %perl -MHTML::Parser
^C

136) ~/public_html/lii %perl -MHTML::TokeParser
Can't locate HTML/TokeParser.pm in @INC (@INC contains: 
/usr/local/perl5.005/lib/5.005/sun4-solaris 
/usr/local/perl5.005/lib/5.005 
/usr/local/perl5.005/lib/site_perl/5.005/sun4-solaris 
/usr/local/perl5.005/lib/site_perl/5.005 .).
BEGIN failed--compilation aborted.



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Fri, 20 Aug 1999 02:02:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Don't these things come together?
Message-Id: <KG2v3.144$873.6312@nsw.nnrp.telstra.net>

In article <MPG.122642ba3fb038619896c5@nntp1.ba.best.com>,
	moseley@best.com (Bill Moseley) writes:
> 135) ~/public_html/lii %perl -MHTML::Parser
> 
> 136) ~/public_html/lii %perl -MHTML::TokeParser

They do, in version 2.23 of the HTML-Parser archive. Possibly not in
earlier versions. Which one do you have?

# perl -MCPAN -e shell
cpan> i /HTML::Parser/
Module id = HTML::Parser
    CPAN_USERID  GAAS (Gisle Aas <gisle@aas.no>)
    CPAN_VERSION 2.23
    CPAN_FILE    GAAS/HTML-Parser-2.23.tar.gz
    MANPAGE      HTML::Parser - SGML parser class
    INST_FILE    /usr/local/lib/perl5/site_perl/HTML/Parser.pm
    INST_VERSION 2.20

cpan> i /HTML::TokeParser/
Module id = HTML::TokeParser
    CPAN_USERID  GAAS (Gisle Aas <gisle@aas.no>)
    CPAN_VERSION 2.05
    CPAN_FILE    GAAS/HTML-Parser-2.23.tar.gz
    MANPAGE      HTML::TokeParser - Alternative HTML::Parser interface
    INST_FILE    /usr/local/lib/perl5/site_perl/HTML/TokeParser.pm
    INST_VERSION undef

Hmm. I see I need to update these as well.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd.       | excuse - Lazarus Long
NSW, Australia                      | 


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

Date: Fri, 20 Aug 1999 02:04:18 GMT
From: qwilson@eatmespambot.midworld.org (Quinn Wilson)
Subject: Re: expect module (?) question
Message-Id: <37bcb622.74306827@news.mbnet.mb.ca>

On Fri, 06 Aug 1999 15:31:20 -0400, "Brian D. Jones"
<brdjon11@us.ibm.com> wrote:

>Hi, I'm trying to write a script that logs into a remote machine,
>launches another program (xterm, let's say), and returns, leaving the
>launched program running.  Since the remote machine will prompt for a
>password, I'm using the Expect module to provide the password provided
>in a .netrc file (yes I know it's a security hazard, but that's not what
>I'm asking).  The program logs into the remote machine fine
>($rlogin=Expect->spawn("rlogin $host -l $user");) and launches xterm
>(print $rlogin "xterm &";), but as soon the script finishes, the xterm
>window closes.  Is there a way to completely disassociate the launched
>xterm window from the script such that it will continue beyond the life
>of the script?
>
>I realize my solution is pretty clunky, so I am open to suggestions for
>other ways to implement this.  Thanks!
>
>Brian
>(please cc brdjon11@us.ibm.com)
>
try
		#!/usr/bin/perl
		
		use Expect;
		
		my $command = Expect->spawn("xterm") or
		        die "Can\'t find program\n";
		
		# hide STDOUT
		$command->log_stdout(0);
		
		unless ($command->expect(10, "PASSWORD:")){
		#timeout
		}
		print $command "password";
		
		# unhide STDOUT
		$command->log_stdout(1);
		#$command->debug(1);
		
		# atach stdin to program input handle 
		$command->interact();

From the Expect.pm docs.
       interact() is essentially a macro for calling
       interconnect() for connecting 2 processes together.
       \*FILEHANDLE defaults to \*STDIN and $escape_sequence
       defaults to undef. Interaction ceases when
       $escape_sequence is read from FILEHANDLE, not $object.
       $object's listen group will consist solely of \*FILEHANDLE
       for the duration of the interaction.  \*FILEHANDLE will
       not be echoed on STDOUT.


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

Date: Fri, 20 Aug 1999 02:46:59 +0200
From: Veronica Karlsson <acinorev@earthling.net>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37BCA583.79A2@earthling.net>

Scratchie wrote:
> I R A Darth Aggie wrote:
> : You realize that by posting to Usenet, you are implicitly permitting
> : email responses?
> 
> True, but Tom has a habit of sending auto-replies to addresses that he
> won't accept email from. That's kind of obnoxious.
> 

He is not sending "auto-replies", he is sending auto-*flames*. Bot Boy
sees post he doesn't like. Bot Boy hits "flame" button. Poster gets
email saying "I don't like your tie, its colours are too loud, and if
you don't change it I'll send you this letter again, and again, and
again, and again..." (all this in spite of the fact that Bot Boy himself
is wearing a tie around his neck which is a 15 cm wide, psychedelic
creation in hot-pink, purple, orange and brown, which should never have
been allowed to survive past the 70's!).


-- 
:) Irebavpn Xneyffba \  /_ _ _  _ . _ _       Zl bgure fvt vf n Cbefpur
( r93-ixa@fz.yhgu.fr  \/(-| (_)| )|(_(_| uggc://jjj.yhqq.yhgu.fr/~ix/ )
If you have a question about html, read the FAQ before asking it to the
group:  http://www.htmlhelp.com/faq/wdgfaq.htm    (No? Read it anyway!)


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

Date: Fri, 20 Aug 1999 03:30:11 +0200
From: Veronica Karlsson <acinorev@earthling.net>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37BCAFA3.2A30@earthling.net>

Curly++ wrote:
> Uriel Wittenberg wrote:
> > 
> > The irony is considerable. Tom Christiansen's own post in the above-mentioned
> > thread, sent around the same time he lobbed his clever grenade at me, uses a full
> > 18 lines to promote the entry of hard RETURN's when composing messages.
> 
> Hard returns are strongly recommended.  Many
> newsreaders do not display the text beyond 80 collumns.
> As for that ugly software autowrap, it doesn't work.

I use the news reader in Netscape 3 (unix version! the one I've seen on
my mother's PC sucks badly!). It has auto-wrap set to 72 characters but
it does not wrap quoted text. If I want to I can turn off the auto-wrap
for specific posts (e.g. if I want to post an ascii image wider than 72
characters, which, as a regular poster to alt.ascii-art I sometimes do).

Posting to alt.ascii-art taught me to be very picky about how my posts
"come through" and I soon developed the good habit to always check my
messages after sending them.

>  o  No software has been written that wraps properly.
>   I use both OE5 and NN4.61 and the autowrap in both is
>   badly flawed and unuseable.  I also use 3 other
>   newsreaders on occassion and they don't have autowrap.

My experience is different.

>  o  Read your own messages before posting them.  If you
>   are replying, read the original _again_ before
>   pressing send.  Then go back and re-read your own
>   posting before pressing send. 

Then go back and re-read your own posting *after* pressing send. If it
looks ugly, figure out why and correct it before posting to the group
again (alt.test is very useful for this purpose). Also compare your
style to other people's style, especially those who seem to be "old on
the net".


-- 
:) Irebavpn Xneyffba \  /_ _ _  _ . _ _       Zl bgure fvt vf n Cbefpur
( r93-ixa@fz.yhgu.fr  \/(-| (_)| )|(_(_| uggc://jjj.yhqq.yhgu.fr/~ix/ )
If you have a question about html, read the FAQ before asking it to the
group:  http://www.htmlhelp.com/faq/wdgfaq.htm    (No? Read it anyway!)


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

Date: Thu, 19 Aug 1999 17:18:46 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: how do i keep output from going to stdout
Message-Id: <37BC9EE6.F2EEBAA@mail.cor.epa.gov>

sparky21@my-deja.com wrote:
> 
> I have a program that returns the output of sp_sysmon to the terminal
> even though I have not called print. How can I redirect the stdout in
> the beginning of my program so that everything that would go to the
> screen goes to an array??

You'll have to give us a little more info.  Are you using 
system() to get the output?  Does sp_sysmon output to STDOUT
or STDERR ?  Have you tried using backticks or qx() ?

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 20 Aug 1999 10:14:19 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: How Test If Function Exists?
Message-Id: <MPG.122740323579089e989c61@news-server>

Tom Christiansen writes ..
>Note that you can only do this with scalars and functions.
>For arrays and hashes, you have to use:
>
>    if (%hash) {
>	# ....
>    } 
>
>or 
>
>    if (@array) {
>	# ....
>    } 

eh ? .. are you saying that

  my %alive = ( x => 1);
  if ( defined %alive) { print "\%alive is alive\n"; }
  unless ( defined %dead) { print "\%dead is dead\n"; }

will not work ? .. works for me

if that's not what you were saying .. then what were you saying ? .. or 
what are the exception cases that I'm not seeing ?

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 19 Aug 1999 19:40:15 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How Test If Function Exists?
Message-Id: <37bcb1ff@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    elephant@squirrelgroup.com (elephant) writes:
:  my %alive = ( x => 1);
:  if ( defined %alive) { print "\%alive is alive\n"; }
:  unless ( defined %dead) { print "\%dead is dead\n"; }
:will not work ? .. works for me

defined(%hash) is deprecated at /tmp/bad line 2.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at /tmp/bad line 3.
(Maybe you should just omit the defined()?)
Name "main::dead" used only once: possible typo at /tmp/bad line 3.
%alive is alive
%dead is dead

The code is wrong.    defined on an aggregate doesn't mean
what you think it does.  It's been deprecated in the docs
for two years.  Now it's -w deprecated as well.

--tom
-- 
    "I can only bend the rules so much before it starts looking like I'm breaking
    the rules." --Larry Wall


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

Date: Fri, 20 Aug 1999 11:52:34 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: How Test If Function Exists?
Message-Id: <MPG.12275febf88fe4ef989c62@news-server>

[ item posted to comp.lang.perl.misc and CCed to Tom Christiansen ]

Tom Christiansen writes ..
>In comp.lang.perl.misc, 
>    elephant@squirrelgroup.com (elephant) writes:
>:  my %alive = ( x => 1);
>:  if ( defined %alive) { print "\%alive is alive\n"; }
>:  unless ( defined %dead) { print "\%dead is dead\n"; }
>:will not work ? .. works for me
>
>defined(%hash) is deprecated at /tmp/bad line 2.
>(Maybe you should just omit the defined()?)
>defined(%hash) is deprecated at /tmp/bad line 3.
>(Maybe you should just omit the defined()?)
>Name "main::dead" used only once: possible typo at /tmp/bad line 3.
>%alive is alive
>%dead is dead
>
>The code is wrong.    defined on an aggregate doesn't mean
>what you think it does.  It's been deprecated in the docs
>for two years.  Now it's -w deprecated as well.

thank you for telling me this .. something else that ActiveState have 
left me in the dark about it would seem (5.005_03 build 519)

C:\>cat blah.pl
#!/usr/bin/perl -w
#use strict;

my %alive = ( x => 1);
if ( defined %alive) { print "\%alive is alive\n"; }
unless ( defined %dead) { print "\%dead is dead\n"; }

C:\>perl -w .\blah.pl
Name "main::dead" used only once: possible typo at .\blah.pl line 6.
%alive is alive
%dead is dead

C:\>

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 19 Aug 1999 20:02:46 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How Test If Function Exists?
Message-Id: <37bcb746@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    elephant@squirrelgroup.com (elephant) writes:
:thank you for telling me this .. something else that ActiveState have 
:left me in the dark about it would seem (5.005_03 build 519)

In that version, it's in the docs, but not in the warnings until 
the developers' version.

--tom
-- 
    "You're flame-proof in the same sense that certain plastics are fluorine-proof."
    	--Larry Wall


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

Date: Thu, 19 Aug 1999 14:20:32 -0700
From: Warren Bell <resource@ERASEjps.net>
Subject: Re: How to view code as text in working cgi script
Message-Id: <37BC7520.911877CE@ERASEjps.net>





> > // How can I call a cgi program on the web to see it's code?  Is there a
> > // way to do this? Any adjustments I can do to my browser?
> >
> > No, you cannot steal CGI programs that way.
>
> I wasn't planning on it.
>
> You should really get a little more info before accusing someone.  Just
> because I want to SEE the code doesn't mean I'm going to steal it.  And
> who's to say I'm not doing some sort of experiment and the script in
> question is on my own server.
>
                   
If the script in question is on your own server, then you could just log
in and view it.

Going back to what I originally said:
> who's to say I'm not doing some sort of ***experiment*** <-- and the script in
> question is on my own server.
>

You cannot SEE the code,
because than anyone could SEE the code, and it could be stolen.
Once you SEE the code, you cant un-SEE it, so its already been stolen
once you've SEEn it.

I just want to know how I'm suppose to steal my own code. Hmm?

Once you ASSUME somthing, you cant un-ASSUME it, it's already been
ASSUMEd...


                   
> You see, think before you speak.
>
                   
-- 
####### Remove ERASE to reply #######


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

Date: Thu, 19 Aug 1999 20:45:55 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: OOP in perl - not modules!!!
Message-Id: <37BCA543.ADB21EA@erols.com>



Andrew Johnson wrote:
> 
<snip>
> h2xs is not just for creating C extenstions---it can also be used as
> a simple method of creating a skeleton module along with extra files
> for making a standard distribution package.
> 
> $ h2xs -Xn Foo
> Writing Foo/Foo.pm
> Writing Foo/Makefile.PL
> Writing Foo/test.pl
> Writing Foo/Changes
> Writing Foo/MANIFEST
> 

And if you are doing inheritance AND you name your modules to match the
inheritance tree like so:

$ pwd

/home/mop/perldevel

$ h2xs -Xn Foo
Writing Foo/Foo.pm
Writing Foo/Makefile.PL
Writing Foo/test.pl
Writing Foo/Changes
Writing Foo/MANIFEST

$ h2xs -Xn Foo::Bar
Writing Foo/Bar/Bar.pm
Writing Foo/Bar/Makefile.PL
Writing Foo/Bar/test.pl
Writing Foo/Bar/Changes
Writing Foo/Bar/MANIFEST

then you can do this:

$ cd Foo

and all of the module building commands:

	perl Makefile.PL
	make test
	make install

get run recursively down the tree. One shot, everything is updated and
sync'ed. I'm highly impressed.

in 
	/home/mop/perldevel

-- 
Matthew O. Persico
    
You'll have to pry my Emacs from my cold dead oversized
   control-pressing left pinky finger. -- Randal L. Schwartz


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

Date: 19 Aug 1999 20:48:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Passing undef to a subroutine
Message-Id: <slrn7rpd21.ath.abigail@alexandra.delanet.com>

Clinton Gormley (clint@drtech.co.uk) wrote on MMCLXXVIII September
MCMXCIII in <URL:news:7pf1qu$dfe$1@taliesin.netcom.net.uk>:
?? 
?? Consider this example:
?? sub bar {
??     return
?? }

Which, as the manual will tell you, returns the empty list in list context,
and undef in scalar context.

?? sub foo {
??     print "$#_\n";
?? }
?? 
?? foo (1,2,3,4)
?? prints 3
?? 
?? foo (1,2,bar,4)
?? prints 2

Indeed, as you do: foo (1, 2, (), 4).

?? However if we change bar to :
?? sub bar {
??     return $_[0];
?? }

Which will return undef in scalar context, or a 1 element list with
its first element undef in list context.

?? then foo (1,2,bar,4)
?? prints 3

Indeed, as you do: foo (1, 2, (undef), 4).

?? So when does Perl decide that a return value of undef should be an element
?? in the parameter list,and when not?


Context.


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 19 Aug 1999 20:52:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl function that searches $PATH for a filename
Message-Id: <slrn7rpd88.ath.abigail@alexandra.delanet.com>

Angelo Bonet (abonet@rincon.com) wrote on MMCLXXVIII September MCMXCIII
in <URL:news:37BB163C.3075A37B@rincon.com>:
[] Hello-
[] 
[] Is there any Perl function that searches $PATH for a file?  Something
[] similar to the "which" or "whereis" command in Unix?


#!/opt/perl/bin/perl -wT

#
# $Id: which,v 1.1 1999/02/25 04:57:21 abigail Exp abigail $
#
# $Log: which,v $
# Revision 1.1  1999/02/25 04:57:21  abigail
# Initial revision
#
#

use strict;

my ($VERSION) = '$Revision: 1.1 $' =~ /([.\d]+)/;

if (@ARGV) {
    if ($ARGV [0] eq '--version') {
        $0 =~ s{.*/}{};
        print "$0 (Perl bin utils) $VERSION\n";
        exit;
    }
    if ($ARGV [0] eq '--help') {
        $0 =~ s{.*/}{};
        print <<EOF;
Usage: $0 [OPTION] [COMMAND [COMMAND [COMMAND ... ]]]

For each command, report the full path to this command, if any.

Options:
       --version:  Print version number, then exit.
       --help:     Print usage, then exit.
       --:         Stop parsing options.
EOF
        exit;
    }
    if ($ARGV [0] eq '--') {
        shift;
    }
}

# Split the path.
my @PATH = split /:/ => $ENV {PATH};

COMMAND:
foreach my $command (@ARGV) {
    foreach my $dir (@PATH) {
        if (-x "$dir/$command") {
            print "$dir/$command\n";
            next COMMAND;
        }
    }
}


__END__

=pod

=head1 NAME

which -- report full paths of commands.

=head1 SYNOPSIS

which [option] [commands]

=head1 DESCRIPTION

I<which> prints the full paths to the commands given as arguments,
depending on the I<$PATH> environment variable.  Nothing is printed if
the command is not found.

=head2 OPTIONS

I<which> accepts the following options:

=over 4

=item --help

Print out a short help message, then exit.

=item --version

Print out its version number, then exit.

=item --

Stop parsing for options. Useful if you want to find where in your path
the commands I<--help> and I<--version> are found.
Use I<which -- --> to find the path to I<-->.

=back

=head1 ENVIRONMENT

The environment variable I<$PATH> is used to find the list of directories
to check for commands.

=head1 BUGS

I<which> has no known bugs.

=head1 COMPATABILITY

Traditionally, I<which> also parses ones F<~/.cshrc> file to look for 
aliases, and reporting the alias when applicable. This version of
I<which> does not do that, because there are more shells than I<csh>.

=head1 REVISION HISTORY

    $Log: which,v $
    Revision 1.1  1999/02/25 04:57:21  abigail
    Initial revision


=head1 AUTHOR

The Perl implementation of I<which> was written by Abigail, I<abigail@fnx.com>.

=head1 COPYRIGHT and LICENSE

This program is copyright by Abigail 1999.

This program is free and open software. You may use, modify, distribute
and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others to do the same.

=cut
-- 
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 19 Aug 1999 20:52:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Help
Message-Id: <slrn7rpd9f.ath.abigail@alexandra.delanet.com>

Gary Segler (gary.segler@bms.com) wrote on MMCLXXVII September MCMXCIII
in <URL:news:37B9D584.272CAEB1@bms.com>:
** 
** I have a small problem.  I would like to print out numbers from
** my PERL script using commas as the thousand separators but I
** don't know how.  Is the a "printf" statement I can use or another
** simple way?


RTFFAQ


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 594
*************************************


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