[8120] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1738 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 27 08:07:12 1998

Date: Tue, 27 Jan 98 05:00:45 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Jan 1998     Volume: 8 Number: 1738

Today's topics:
    Re: Crontab:Automatically Run a Perl Script? <joseph@5sigma.com>
    Re: Crontab:Automatically Run a Perl Script? <webmaster@fccj.cc.fl.us>
    Re: crypt function ... help. <joseph@5sigma.com>
    Re: crypt function ... help. <webmaster@fccj.cc.fl.us>
        Drag 'n' drop and paste arguments to Perl script? <froz@algonet.se>
    Re: Evaluating stdin text (Craig Berry)
    Re: Freidl's book mystery <joseph@5sigma.com>
        Getting listing of directories as texts <hussain_imran@jpmorgan.com>
    Re: Getting listing of directories as texts (Tad McClellan)
        Graphical Perl Debugger? <zak@iki.fi>
        HELP HELP HELP!!! - with function call parameters <bhanu@usl.edu>
    Re: IP Address as new File <blan0416@uidaho.edu>
    Re: Larry's Quotes <jhi@alpha.hut.fi>
        making lists of items in text file using perl <James@cydaps.demon.co.uk>
    Re: newbie regex question (Lars Gregersen)
    Re: Perl 5.004_04 open with pipe bug on Solaris? (Lack Mr G M)
        Perl and IIS. Trying to get the server running. <vallery@bvsd.k12.co.us>
        printing an image <gcyriac@internetmci.com>
        Profiler for Perl4 (yup. Perl4) bernie@techwriter.com
    Re: Running a package standalone? <joseph@5sigma.com>
    Re: Sending binary files on a Socket. There has to be a <joseph@5sigma.com>
    Re: simple perl question, regx, please help. (Lars Gregersen)
        Sort::Fields man page FYI <joseph@5sigma.com>
    Re: ssh <jhi@alpha.hut.fi>
    Re: Survival Of perl (James Mcpherson)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Jan 1998 02:41:42 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Crontab:Automatically Run a Perl Script?
Message-Id: <34CDABBF.9FFE7F01@5sigma.com>

Is there an echo in here?

I hereby dub January "How Do I Use Cron with Perl Month".

	-joseph

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Tue, 27 Jan 1998 07:19:37 -0500
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccj.cc.fl.us>
Subject: Re: Crontab:Automatically Run a Perl Script?
Message-Id: <34CDD0D9.27084E7C@fccj.cc.fl.us>

This is a multi-part message in MIME format.
--------------4870D71F39E7369E7AB897B8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Joseph N. Hall wrote:

> Is there an echo in here?
>
> I hereby dub January "How Do I Use Cron with Perl Month".
>
>         -joseph
>
> --
> Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
> Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
> Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


1 2 * * * [ -x /usr/sbin/Isecond ] && /usr/sbin/theMotion -c > /dev/null
2>&1

:-)

--------------4870D71F39E7369E7AB897B8
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Jones
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Bill Jones
n:              Jones;Bill
org:            FCCJ
adr:            501 W. State St.;;MCCS Rm. 270;Jacksonville;FL;32202;USA
email;internet: webmaster@fccj.cc.fl.us
title:          Webmaster
tel;work:       (904) 632-3089
tel;fax:        (904) 632-3007
tel;home:       Pager: 1 (904) xxx-xxxx
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------4870D71F39E7369E7AB897B8--



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

Date: Tue, 27 Jan 1998 03:17:05 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: crypt function ... help.
Message-Id: <34CDB409.3459E7FA@5sigma.com>

Next time, use rot13.

:-)

	-joseph

Chipmunk wrote:
> 
> chad wrote:
> >
> > How do I de-crypt a crypt'd string?  I cryp'd it using the perl crypt function.
> 
> Slowly and painfully.

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Tue, 27 Jan 1998 07:15:40 -0500
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccj.cc.fl.us>
Subject: Re: crypt function ... help.
Message-Id: <34CDCFEC.FCB6E2DD@fccj.cc.fl.us>

This is a multi-part message in MIME format.
--------------5D57A3CED6CB92F8182162A8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Chipmunk wrote:

> chad wrote:
> >
> > How do I de-crypt a crypt'd string?  I cryp'd it using the perl crypt function.
>
> Slowly and painfully.
>
> Chipmunk

 So, Chip, it really can be decrypted?  You shouldn't tease us!

:-)

--------------5D57A3CED6CB92F8182162A8
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Jones
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Bill Jones
n:              Jones;Bill
org:            FCCJ
adr:            501 W. State St.;;MCCS Rm. 270;Jacksonville;FL;32202;USA
email;internet: webmaster@fccj.cc.fl.us
title:          Webmaster
tel;work:       (904) 632-3089
tel;fax:        (904) 632-3007
tel;home:       Pager: 1 (904) xxx-xxxx
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------5D57A3CED6CB92F8182162A8--



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

Date: Tue, 27 Jan 1998 08:33:47 +0100
From: Mats Forssblad <froz@algonet.se>
Subject: Drag 'n' drop and paste arguments to Perl script?
Message-Id: <34CD8DDB.840249D0@algonet.se>

How do I make a Perl script start with arguments that 
are given it by drag and drop or pasting from the
clipboard? I am making an ftp-optimizing script that
does two-step ftp, first from ftp server to the 
ISP:s Sun server, then from ISP to home. At least for
me, if I get just 1.2 K speed ftp with my modem, my
ISP still has speeed in the hundreds of K, and ISP-home
is always top speed. I think I can handle all of that
in a script, but what I can't figure out is how to make
it all start by dragging a link from a webbrowser or
pasting contents from the clipboard.


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

Date: 27 Jan 1998 07:08:48 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Evaluating stdin text
Message-Id: <6ak160$7ol$1@marina.cinenet.net>

Chip Salzenberg (chip@mail.atlantic.net) wrote:
: According to rsr@best.com (Roy S. Rapoport):
: >Now, the perl faq ('How do I unescape a string?' and 'How do I expand
: >function calls in a string?') covers this.  Sort of.  The first
: >subject covers very well something like
: >
: >"This is a line with $i in it", but not
: >"This is a line with $i++ in it"
: 
: Well, you'd have to come up with a regex that covers all possible
: expressions, and I think that's impossible.  So maybe your config
: file should bracket the expressions somehow:
: 
:   "This is {{$i++}}"
:   "This is {{++$i}}"

If you can control the input text format, then using a bracket scheme 
like this is infinitely superior to the eval-everything trick I posted 
earlier today (about which I still feel vaguely queasy).

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Tue, 27 Jan 1998 02:36:23 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Freidl's book mystery
Message-Id: <34CDAA80.D94951B@5sigma.com>

Ilya, and Tom, and company,

There are some things that are indisputably faster written
in a other language than Perl, and lexers are one of them.
A lexer written in C, either hard-coded or machine-generated,
translates into extremely efficient byte-twiddling opcodes.
The limiting factor for a lexer written in C or other language
that compiles to machine code is I/O, and that is *not* the
case with a complex Perl regex lexer.

I'm sure people have already written XSUBs that tokenize input.
I'm not sure whether a general purpose tool that interfaced,
say, flex to Perl via an XSUB would be more trouble that it was
worth.  Perhaps it would, but it's not an easy call for me.

To the poster who implored "please use a state machine," I wonder
if he knows how many production compilers use machine-generated
lexers.  Like, not many.

I'm sorry, but string nibbling is just the most ridiculous thing
I've ever seen coded for this application.  scalar m//gc is better
and I'm glad it was incorporated into the language.  But for anything
approaching real-world speed, you've got to move down the language 
food chain.  End of story.

	-joseph

	-who may not know everything there is to know about Perl regexes,
	 but who definitely does know lots about writing lexers and lexer-
	 generating tools


Ilya Zakharevich wrote:
> 
> Come on!  Nothing can beat a good RE (though good RE are still hard
> to write even with the newest RE engine - I hope this will be improved
> very soon).
> 
> Ilya

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Tue, 27 Jan 1998 10:07:50 +0000
From: Imran Hussain <hussain_imran@jpmorgan.com>
Subject: Getting listing of directories as texts
Message-Id: <34CDB1F6.427D@jpmorgan.com>

Is there any ay of getting Perl to return the names of directories at a 
particular location and manipulate those directory names as text.


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

Date: Tue, 27 Jan 1998 05:57:05 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Getting listing of directories as texts
Message-Id: <h2ika6.2j.ln@localhost>

Imran Hussain (hussain_imran@jpmorgan.com) wrote:
: Is there any ay of getting Perl to return the names of directories at a 
: particular location and manipulate those directory names as text.


   perldoc -f opendir

   perldoc -f readdir


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


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

Date: Tue, 27 Jan 1998 14:41:52 +0200
From: K Aleksi Niemela <zak@iki.fi>
Subject: Graphical Perl Debugger?
Message-Id: <34CDD610.71E55E56@iki.fi>

When I get announce from ActiveState which says:

ActiveState Perl Debugger Beta Version
Now Available for Free Download

I thought whether there is any activity going on to produce graphical
debugger with advanced functionality to common ground?

Like Perl Debugger with tk?
-- 
I modem, but they grew back.

                            Aleksi Niemela
                              PVT 15 C 29
                               00750 HKI
                             040-543 08 22
                              zak@iki.fi


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

Date: Tue, 27 Jan 1998 05:39:48 -0600
From: "Bhanu P. Suravarapu" <bhanu@usl.edu>
Subject: HELP HELP HELP!!! - with function call parameters
Message-Id: <34CDC784.41C67EA6@usl.edu>

Hi,

I am using perl5.003.

In my perl script I have something like

open(somefile1....);
print somefile1 $nodenumber;
$response = &travlink($node);
open(somefile....);
print somefile2 $nodenumber;
 ...

I have the above code in a loop where $nodenumber takes values 1..9
My function is something like this:
sub travlink
{
open(somefile....);
print somefile3 $_[0];

1;
}


Now my problem is somefile1 and somefile2 have values 1..9
BUT somefile3 has only few values 2,6,8 (say).

So my function is not being called sometimes I donot know
why this is happening.

i have spent a lot of time to figure out the existance of this problem.

PLEASE HELP ME.

bhanu.
bhanu@usl.edu


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

Date: Tue, 27 Jan 1998 03:30:43 -0800
From: Derek Blandford <blan0416@uidaho.edu>
To: InterActive Promotions <drew@citypost.com>
Subject: Re: IP Address as new File
Message-Id: <34CDC563.526F3F71@uidaho.edu>

You are opening the file for reading, not creating the file....
Also, you are not providing the directory path leading up to the file.
And you do not use parenthesis when printing to the file....
Use:

$file_base = '/home/directory/subdir';

open (TEMP_FILE, ">$file_base/$remote_address");
print TEMP_FILE "$remote_address\|$url\n";
close (TEMP_FILE);

Jason Hansen


> can someone help ?
>
> I am trying to create a new file based on a users IP Addrss.
>
> I have tryed:
>
> $remote_address = $ENV{'REMOTE_ADDR'};
>
> open (TEMP_FILE, "$remote_address");
> print TEMP_FILE ("$remote_address|$url\n");
> close (TEMP_FILE);
>
> This is just part of the script.
>
> Thanks in advance
> Andrew
> drew@citypost.com





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

Date: 27 Jan 1998 14:02:18 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Larry's Quotes
Message-Id: <oee1zxut99x.fsf@alpha.hut.fi>


Jerry Pank <jerryp.usenet@connected.demon.co.uk> writes:

> 
> In one_of_my_my_many_Perl_books/Faqs/c.l.p.m/ or somewhere else,
> I remember seeing a link to a site with Larry's quotes.
> 
> Can't find it now.  Would someone shine the torch ?

http://www.perl.com/CPAN/misc/lwall-quotes.txt.gz

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Tue, 27 Jan 1998 12:31:18 +0000
From: James <James@cydaps.demon.co.uk>
Subject: making lists of items in text file using perl
Message-Id: <WJ1DJBAWOdz0EwjP@cydaps.co.uk>



Hi

Is there any way that I can get perl to search through a delimited text
file for all the occurances of a certain item, (ie if there is a list of
different colour jumpers) and then create a file to store this
information in, but not to repeat duplicate items.

The file would look something like this:

1|L|Red|Pullover|Sweater Plc
2|M|Black|Pullover|ABX Ltd
3|S|Red|Pullover|ABX Ltd
4|L|White|Pullover|ABX Ltd

so the script automatically searches through the database (I can manage
to do this bit!) and picks out the different colours available (I can
manage this bit too), and then lists them out in alphabetical order (not
so easy for me) and writes them to a separate file without entering
duplicates!

The contents of the colour.txt file would look like:

Red
Black
White


having seen that red has already been used and therefore does not enter
it again?

TIA for any help with this!

James




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

Date: Tue, 27 Jan 1998 09:08:18 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: newbie regex question
Message-Id: <34cda313.5272217@130.228.3.8>

[p&m]
On 15 Jan 1998 20:31:01 GMT, "b_kiefer" <bkiefer@hollandhart.com>
wrote:

>What's the best way to find empty characters at the end of a string?

What is empty characters? If you mean whitespace (spaces and tabs and
such) you could get away with:

$str = "This string has a lot of spaces at the end         ";
print "1:$str*\n";
$str =~ s/\s+$//; # and now it doesn't
print "2:$str*\n";

I hope this helps (otherwise write back again and tell us what 'empty'
means in this context).

  Lars

Lars Gregersen, M.Sc., Chem. Engng.
Technical University of Denmark
Department of Chemical Engineering
E-mail  : lg@kt.dtu.dk
Homepage: http://www.gbar.dtu.dk/~matlg/


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

Date: Tue, 27 Jan 1998 10:00:55 GMT
From: gml4410@ggr.co.uk (Lack Mr G M)
To: ric@sri.com (Ric Steinberger)
Subject: Re: Perl 5.004_04 open with pipe bug on Solaris?
Message-Id: <1998Jan27.100055@ukwit01>

In article <6aj3ji$8o6$1@unix.sri.com>, ric@isl.sri.com (Ric Steinberger) writes:
|> This code doesn't execute properly on Solaris 2.5, 2.6:
|> 
|> open(FILE, "/usr/sbin/showmount -a 2 >&1 | ")
|> 
|> After a few seconds, one sees:
|> 
|> showmount: 2: RPC: Rpcbind failure - RPC: Timed out
|> 
|> Take away the "2 >&1" and it works fine.  Can anyone please
|> explain to me why this is so.  I've used the 2 >&1 frequently
|> in perl along with the pipe and had no problems.

   Have you always put a space after the 2?

   Try removing it....(if you notice, the showmount command is
commenting on an error associated with "2").

-- 
----------- Gordon Lack ----------------- gml4410@ggr.co.uk  ------------
The contents of this message *may* reflect my personal opinion.  They are
*not* intended to reflect those of my employer, or anyone else.


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

Date: Mon, 26 Jan 1998 15:57:25 -0700
From: Jason Vallery <vallery@bvsd.k12.co.us>
Subject: Perl and IIS. Trying to get the server running.
Message-Id: <Pine.GSO.3.96.980126155507.29412A-100000@bvsd.k12.co.us>

We have NT Server 4.0 and ISS 4.0 as well. We can't seem to get a snigle
Perl program to execute with a browser, I have went over every FAQ I could
find and nothing, It asks us if we want to save the file to disk. I know
to get around that I am supposed to use a '?' but that doesn't work
either. We derpreatly need help getting this working as soon as possible.
Any sugg. would be appreciated.
Thanks.


  _____________________________________________ 
 / __________  	 Jason Ray Vallery		\
| |       ___)_                                 |
| |       _____) vallery@bvsd.k12.co.us         |            
| |      ______) guide4@bvsd.k12.co.us          |            
| |    _______)  vallery@usa.net                |            
| \_______)      vallery_j@gems.colorado.edu    |
 \_____________________________________________/



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

Date: Tue, 27 Jan 1998 12:46:12 GMT
From: George Cyriac <gcyriac@internetmci.com>
Subject: printing an image
Message-Id: <34CDD74A.74E55D21@internetmci.com>

-- 

How do I print an image out to a web browser?
------------------------------------------------------------
http://www.serve.com/gcyriac/
George Cyriac          Bayweb designs
gcyriac@internetmci.com
------------------------------------------------------------


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

Date: Tue, 27 Jan 1998 01:34:13 -0600
From: bernie@techwriter.com
Subject: Profiler for Perl4 (yup. Perl4)
Message-Id: <885884643.884539397@dejanews.com>

I'm familiar with various profilers for Perl5, but I haven't found one
for Perl4.

Can anyone point me to one?

TIA,

Bernie

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 27 Jan 1998 02:58:51 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Running a package standalone?
Message-Id: <34CDAFC4.89A63E10@5sigma.com>

Looks like a good technique to me.  You must have done some
good doc browsing, since it's not well known that caller() can
give you this information.

Overall, though, you'd be better off using h2xs to create your
module boilerplate.  Then you could just hack your test.pl's to
create your test code.

	-joseph

Diego Zamboni wrote:
> 
> What I have found is that the caller function returns undef when there is
> no caller information, so that I can do something like this:
> 
> package MyPackage;
> 
> sub run() {
>         # ...
> }
> 
> # other method definitions
> 
> if(caller) {
>         MyPackage->new()->run();
>         # maybe other stuff
> }
> 
> I have a couple of questions:
> 
> - Is there a more elegant or easy way of doing this?

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Tue, 27 Jan 1998 02:39:40 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Sending binary files on a Socket. There has to be a better way.
Message-Id: <34CDAB45.327AC95E@5sigma.com>

Why don't you send the length of the data you want to send,
then send that much data.  Or just send the data and then close
the socket.

	-joseph

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Tue, 27 Jan 1998 09:58:40 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: simple perl question, regx, please help.
Message-Id: <34cdad25.7850682@130.228.3.8>

[p&m]
On 24 Jan 1998 15:12:54 -0800, chad wrote:

>
>what is the code for this:
>
>$string should contain only a-z A-Z 0-9 if it contains anything else fail.
>
>I though it was:
>
>  if($string !~ /[a-zA-Z0-9]/) { fail; } but i guess that's wrong.

You will soon find (I hope) that thought and guesses can get you a
long way in programming, but a little thinking will in most
(complicated) cases get you the longest.

Let's see what you are doing:

  $string !~ /[a-zA-Z0-9]/

this line does not say that perl should find something "that is not in
the class [a-zA-Z0-9]". What perl is doing is that it tries to match
the class [a-zA-Z0-9]. If there isn't a match _at all_ it will 'fail'.
So it will fail on something like $string="###".

You want to do something like:

  if ($string !~ /^[a-zA-Z0-9]*$/) { print "fail\n"; } 

That only fails if the entire string does not match the class.

You could also go for

  $string =~ /[^a-zA-Z0-9]/

that fails on _any_ character not in the class.

Note that the class [a-zA-Z0-9] is almost equal to the much shorter \w
(see perlre)

I hope this helps.

  Lars



Lars Gregersen, M.Sc., Chem. Engng.
Technical University of Denmark
Department of Chemical Engineering
E-mail  : lg@kt.dtu.dk
Homepage: http://www.gbar.dtu.dk/~matlg/


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

Date: Tue, 27 Jan 1998 01:22:07 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Sort::Fields man page FYI
Message-Id: <34CD991A.BC8F6F2F@5sigma.com>

I know it's a little voluminous, but this comes up so often that
I thought it would be worthwhile posting this to clpm as well as 
clpmodules (just once).

I'm about to push version 0.01 onto PAUSE, so it should hit CPAN
soon.  Please don't rely on this early version for production
work, since the interface *might* change.  I believe it is working
correctly but there are no tests either.  :-(

I am considering adding a subroutine that will use a regexp with
memory parens instead of split.  As soon as I think of a name ....

I'm open to suggestions, except those along the lines of "make
the specifiers a lot more versatile, like sort(1)".  sort(1) is
just too abstract and complicated for the average non-Unix literate
Perl programmer to use.  I am considering writing some more
sophisticated sort wrappers, don't worry.  Pie-in-the-sky ideas
along those lines will be gratefully accepted.  But alpha/numeric
and forward/reverse is as complex as I want to make this.

Once Sort::Fields is nailed down I'd like to see it become a core 
module.

Please direct followups to comp.lang.perl.modules.  I won't be posting
this in comp.lang.perl.misc again.

	-joseph
-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com

--
NAME
    Sort::Fields - Sort lines containing delimited fields

SYNOPSIS
      use Sort::Fields;
      @sorted = fieldsort [3, '2n'], @lines;
      @sorted = fieldsort '\+', [-1, -3, 0], @lines;

DESCRIPTION
    Sort::Fields provides a general purpose technique for
    efficiently sorting lists of lines that contain data separated
    into fields.

    Sort::Fields automatically imports a single subroutine,
    fieldsort.

    The first argument to fieldsort is a delimiter string, which is
    used as a regular expression argument for a `split' operator.
    The delimiter string is optional. If it is not supplied,
    fieldsort splits each line using `/\s+/'.

    The second argument is an array reference containing one or more
    field specifiers. The specifiers indicate what fields in the
    strings will be used to sort the data. The specifier "1"
    indicates the first field, "2" indicates the second, and so on.
    A negative specifier like "-2" means to sort on the second field
    in reverse (descending) order. To indicate a numeric rather than
    alphabetic comparison, append "n" to the specifier. A specifier
    of "0" means the entire string ("-0" means the entire string, in
    reverse order).

    The order in which the specifiers appear is the order in which
    they will be used to sort the data. The primary key is first,
    the secondary key is second, and so on.

    The remaining arguments are the data to be sorted.

EXAMPLES
    Some sample data (in array `@data'):

      123   asd   1.22   asdd
      32    ewq   2.32   asdd
      43    rewq  2.12   ewet
      51    erwt  34.2   ewet
      23    erww  4.21   ewet
      91    fdgs  3.43   ewet
      123   refs  3.22   asdd
      123   refs  4.32   asdd

      # alpha sort on column 1
      print fieldsort [1], @data;

      123   asd   1.22   asdd
      123   refs  3.22   asdd
      123   refs  4.32   asdd
      23    erww  4.21   ewet
      32    ewq   2.32   asdd
      43    rewq  2.12   ewet
      51    erwt  34.2   ewet
      91    fdgs  3.43   ewet

      # numeric sort on column 1
      print fieldsort ['1n'], @data;

      23    erww  4.21   ewet
      32    ewq   2.32   asdd
      43    rewq  2.12   ewet
      51    erwt  34.2   ewet
      91    fdgs  3.43   ewet
      123   asd   1.22   asdd
      123   refs  3.22   asdd
      123   refs  4.32   asdd

      # reverse numeric sort on column 1
      print fieldsort ['-1n'], @data;

      123   asd   1.22   asdd
      123   refs  3.22   asdd
      123   refs  4.32   asdd
      91    fdgs  3.43   ewet
      51    erwt  34.2   ewet
      43    rewq  2.12   ewet
      32    ewq   2.32   asdd
      23    erww  4.21   ewet

      # alpha sort on column 2, then alpha on entire line
      print fieldsort [2, 0], @data;

      123   asd   1.22   asdd
      51    erwt  34.2   ewet
      23    erww  4.21   ewet
      32    ewq   2.32   asdd
      91    fdgs  3.43   ewet
      123   refs  3.22   asdd
      123   refs  4.32   asdd
      43    rewq  2.12   ewet

      # alpha sort on column 4, then numeric on column 1, then reverse
      # numeric on column 3
      print fieldsort [4, '1n', '-3n'], @data;

      32    ewq   2.32   asdd
      123   refs  4.32   asdd
      123   refs  3.22   asdd
      123   asd   1.22   asdd
      23    erww  4.21   ewet
      43    rewq  2.12   ewet
      51    erwt  34.2   ewet
      91    fdgs  3.43   ewet

      # now, splitting on either literal period or whitespace
      # sort numeric on column 4 (fractional part of decimals) then
      # numeric on column 3 (whole part of decimals)
      print fieldsort '(?:\.|s+)', ['4n', '3n'], @data;

      51    erwt  34.2   ewet
      43    rewq  2.12   ewet
      23    erww  4.21   ewet
      123   asd   1.22   asdd
      123   refs  3.22   asdd
      32    ewq   2.32   asdd
      123   refs  4.32   asdd
      91    fdgs  3.43   ewet

      # alpha sort on column 4, then numeric on the entire line
      # NOTE: produces warnings under -w
      print fieldsort [4, '0n'], @data;

      32    ewq   2.32   asdd
      123   asd   1.22   asdd
      123   refs  3.22   asdd
      123   refs  4.32   asdd
      23    erww  4.21   ewet
      43    rewq  2.12   ewet
      51    erwt  34.2   ewet
      91    fdgs  3.43   ewet

BUGS
    "TRIAL BALLOON VERSION" -- no tests!

    Perhaps something should be done to catch things like:

      fieldsort '.', [1, 2], @lines;

    `'.'' translates to `split /./' -- probably not what you want.

    Passing blank lines and/or lines containing the wrong kind of
    data (alphas instead of numbers) can result in copious warning
    messages under `-w'.

    If the regexp contains memory parentheses (`(...)' rather than
    `(?:...)'), split will function in "delimiter retention" mode,
    capturing the contents of the parentheses as well as the stuff
    between the delimiters. I could imagine how this could be
    useful, but on the other hand I could also imagine how it could
    be confusing if encountered unexpectedly. Caveat sortor.

AUTHOR
    Joseph N. Hall, joseph@5sigma.com

SEE ALSO
    perl(1).


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

Date: 27 Jan 1998 11:56:51 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: ssh
Message-Id: <oee3eiatf30.fsf@alpha.hut.fi>


Thomas Lockney <media@organizedmedia.com> writes:

> 
> I'm looking for a module or any information pertaining to ssh within
> perl. I need to replicate a directory tree across a systems, one of
> which is using ssh. I don't want to have to make system calls to scp
> each time I find a file needing to be copied. Anyone have any experience
> with this?

Wheel.  Reinvent.  Not.

ftp://sunsite.auc.dk/pub/unix/rsync/

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 27 Jan 1998 06:54:31 GMT
From: mljmcphe@mailbox.uq.edu.au (James Mcpherson)
Subject: Re: Survival Of perl
Message-Id: <6ak0b7$i0m$1@nargun.cc.uq.edu.au>

Frank (FHeasley@chemistry.com) wrote:
: I'm referring to any module which will not self extract and install in
: a windows environment.  There are far to many of them, and it's
: frustrating to download them from CPAN only to find that they are
: unusable.  Plus, if you can get them to work on your local machine,
: you still have the additional problem of getting them installed on
: your ISP's system - not always an easy thing to accomplish.

And of course your local ISP probably doesn't want to let just anybody
install a perl module on their system, let alone have access to perl!

As for "self extract and install in the windows environment," what 
you need to do is carefully examine the modules in question and use your
noggin to see whether they are appropriate for your system. Bear in mind
that many modules are _not_ written with the win32 environment in mind,
but with unix or vms in mind instead (where perl runs naturally). IMHO,
if you're not willing to look at what is required and work it out for
yourself, then you shouldn't be complaining.

jcm
--
 I do not speak for the University of Queensland or the University Library
J.McPherson@mailbox.uq.edu..au   | this space _not_ for rent. 
j.mcpherson@library.uq.edu..au   | remove erroneous char to reply properly


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

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

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