[8911] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2528 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 7 11:07:47 1998

Date: Thu, 7 May 98 08:00:49 -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, 7 May 1998     Volume: 8 Number: 2528

Today's topics:
    Re: Bizarre problem with scalar .. operator? <"xuming "@ email.unc.edu>
    Re: CPAN & Module gripes (was Re: Ever Wonder...?) (Stuart McDow)
    Re: CPAN & Module gripes (was Re: Ever Wonder...?) (Chris Nandor)
    Re: CPAN & Module gripes (was Re: Ever Wonder...?) (Chris Nandor)
        Dylan Song Title Generator (was Re: Rainy Day Women #12 (David Faciane)
    Re: Dylan Song Title Generator (was Re: Rainy Day Women (John Howells)
    Re: Ever Wonder Why Not Everyone Uses Modules? (Tina Marie Holmboe)
    Re: Ever Wonder Why Not Everyone Uses Modules? (John Porter)
    Re: Ever Wonder Why Not Everyone Uses Modules? (John Porter)
    Re: Ever Wonder Why Not Everyone Uses Modules? (Chris Nandor)
        Graphing databases, need info (Ryan McGuigan)
    Re: Help Needed for sorting a delimited text file <gary.copeland@cat.com>
    Re: how to run Perl script on remote server not having  (Andrew M. Langmead)
    Re: How to truncate a float value? <lr@hpl.hp.com>
        Julian Dates Cathal.G.Meehan@aib.ie
    Re: Open to suggestions <camerond@mail.uca.edu>
    Re: Perl on Win95? <gdavis@surveystar.com>
        perl scripts dealing with /etc/passwd <lyonsd@atl.hp.com>
    Re: require "file.sub": which script called it? (Honza Pazdziora)
    Re: Share an array (John Porter)
    Re: Truncate() not documented correctly? <lr@hpl.hp.com>
    Re: What is wrong with this? (David A. Black)
    Re: Win95 Perl scripts DONT WORK on UNIX <quednauf@nortel.co.uk>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 07 May 1998 09:45:21 -0400
From: xuming wang <"xuming "@ email.unc.edu>
Subject: Re: Bizarre problem with scalar .. operator?
Message-Id: <6ise0f$47q$1@fddinewz.oit.unc.edu>

Ian Boys wrote:

> Also, an arg seemingly doesn't have to be numeric literal, only an
> expression which evaluates to a constant.  For example (1+0) will still
> be compared against $.

I tried those:

C:\temp>perl -e "for (1..5) {$a = ($_ == 3)..($_ == 3); print\"$_: $a\n\"}"
1:
2:
3: 1E0
4:
5:

C:\temp>perl -e "for (1..5) {$a = ('a' eq 'a')..($_ == 3); print\"$_: $a\n\"}"
1:
2:
3:
4:
5:

C:\temp>perl -e "for (1..5) {$a = ($_ == 3)..('a' eq 'a'); print\"$_: $a\n\"}"
1:
2:
3: 1
4: 2
5: 3

does perl compare ('a' eq 'a') against $.?  so:

open (FH, "test.txt") or die "blah blah";
$foo = <FH>;
print "\$.: $.\n";
for (1..5) {
    $a = ('a' eq 'a')..($_ == 3);
    print "$_: $a\n";
}

$.: 1
1: 1
2: 2
3: 3E0
4: 1
5: 2

seems to me, as long as one operand has no variable in it, .. compares it
against $.
either this is a bug of perlop need to be corrected.

my perl version is standard WIN32, 5.004_02.


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

Date: 7 May 1998 14:11:30 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <6isfei$srq$1@ns1.arlut.utexas.edu>

Jeffrey Davis <davis@ca.uky.edu> writes:
>
> Not only is there a lot of information available, it seems to breed like
> rabbits. If you're like me and tried to learn Perl "by the book" there's
> a very good chance that the book you learned from was way behind the
> curve on where Perl is today. Perl has grown from being a very good
> scripting language into something like a cross between a universal
> solvent and an open-ended Mandarin where new ideograms are invented
> hourly.

Kinda reminds me of what emacs (at least the Lisp portion) was doing
during the 1980s, and early 1990s. Every time you blinked, there were
zillions of new (and/or improved) .el files, and it seemed (to me)
that there was a fair amount of functional overlap between certian
modules. Everybody still used emacs 'cause it was such a good
tool. Eventually, it "stabilized", as perl will surely do. We're in a
high-growth period right now.

--
Stuart McDow                                     Applied Research Laboratories
smcdow@arlut.utexas.edu                      The University of Texas at Austin
  "It is obvious that about 750,000 people ago, Austin was a wonderful City."


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

Date: Thu, 07 May 1998 14:44:18 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <pudge-0705981042250001@192.168.0.3>

In article <slrn6l3buk.88a.mgm@unpkhswm04.bscc.bls.com>,
mmorris@mindspring.com wrote:

# On Thu, 07 May 1998 12:11:24 GMT, Chris Nandor <pudge@pobox.com> wrote:
# [snip]
# >If you want to spend your time doing that, be my guest.  But I am
# >convinced that anyone who is intelligent enough to program usefully will
# >be able to figure CPAN out as-is with a minimal amount of thought and
# >effort.  All they have to do is read the documents, browse around, and
# >maybe ask a question or two, politely.  If they cannot do that, they
# >cannot program.
# 
# I was going to abstain from posting to this thread. Really, I was.
# 
# However, we as a programming community find this user-unfriendly behavior
# completely unacceptable in every other aspect of our professional lives. Why
# would we want to hold it up as the model of interaction when it comes to perl?

I have no idea what you are talking about.  I am not being
user-unfriendly, I am simply stating the facts as I see them.

# In almost every other situation where we need to find our way about a mass
# of information, we provide search tools. In those cases where there aren't
# any, we write them. We, as an Internet using community, have specified through
# our continued behavior that we expect to be able to do keyword searching on
# just about everything.

Since when does CPAN not have keyword searching??

    http://theory.uwinnipeg.ca/SFgate/WAIT4CPAN.html
    http://theory.uwinnipeg.ca/search/cpan-search.html

For crying out loud.  And people wonder why I am frustrated.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Thu, 07 May 1998 14:44:12 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <pudge-0705981042200001@192.168.0.3>

In article <6isekp$pfd$1@kanja.arnes.si>, Matija.Grabnar@arnes.si wrote:

# In article <pudge-0705980809320001@192.168.0.3>,
# Chris Nandor <pudge@pobox.com> wrote:
# >If you want to spend your time doing that, be my guest.  But I am
# >convinced that anyone who is intelligent enough to program usefully will
# >be able to figure CPAN out as-is with a minimal amount of thought and
# >effort.  All they have to do is read the documents, browse around, and
# >maybe ask a question or two, politely.  If they cannot do that, they
# >cannot program.
# 
# I am not a clueless newbie (in fact, I have a module on CPAN myself), but
# let's not pretend that everything on CPAN works smoothly.

Not only do I not pretend that, but I stated that in fact.  Of course CPAN
needs improvement, of course it is not perfect, of course some thing are
broken.  But that is very different than saying that CPAN is unnavigable,
or that it is broken just because clueless newbies are lost.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 7 May 1998 14:32:57 GMT
From: dave@nws.fsu.edu (David Faciane)
Subject: Dylan Song Title Generator (was Re: Rainy Day Women #12 & 35 question)
Message-Id: <6isgmp$8qq$1@news.fsu.edu>

In article <howells.894376052@shell4.ba.best.com>,
John Howells <howells@best.com> wrote:
>My opinion: the title means absolutely nothing. It's just some
>nonsense he thought up on the spur of the moment, like "Alcatraz
>to the 9th Power".  That's just the way his mind works.


Indeed. Here's a quick little hack. Ever notice, during the mid-60s,
how Bob was fond of prefacing a rather mundane song title with an
adverb to kind of spice it up, as in

Positively Fourth Street
Obviously Five Believers
Absolutely Sweet Marie

well now you can Bob-ify any dreary song title. Just copy the program below
and run it on your system. 

For fun, here's what happens when you run the TOOM song titles through it:

Obnoxiously Love Sick 
Familiarly Dirt Road Blues 
Surely Standing In The Doorway 
Superbly Million Miles
Obviously Tryin To Get To Heaven 
Mercilessly Til I Fell In Love With You 
Amply Not Dark Yet 
Eerily Cold Irons Bound 
Simply Make You Feel My Love 
Positively Cant Wait 
Otherworldly Highlands 

Here's the program. Save it as 'bobify' on your UNIX system (you
are running unix or linux, riiiight?). If you are trapped in Mr. Bill's
Funhouse, it should still work as long as you have the perl programming
language interpreter installed.

Just feed it a song title and it will bob-ify it!

$ bobify 'Spinach Salad'

Superbly Spinach Salad 


#!/usr/local/bin/perl
#
# bobify: absolutely dylan title generator
#
#
# usage: bobify <song title>
#
require 5.000;
srand;

my @words= qw/ obviously positively absolutely surely certainly amply eerily 
familiarly fondly fully ghastly ghostly grizzly mercilessly ornately 
otherworldly pitilessly scraggly simply summarily superbly truly wholly 
pitifully obnoxiously/;

print ucfirst($words[rand(@words)]), " @ARGV \n";

-- 
David Faciane                 |web: http://www.nws.fsu.edu/
NOAA National Weather Service |Real-Time Worldwide Marine Weather Reports 
Tallahassee, FL               |  http://www.nws.fsu.edu/buoy	 


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

Date: 7 May 1998 07:26:06 -0700
From: howells@best.com (John Howells)
Subject: Re: Dylan Song Title Generator (was Re: Rainy Day Women #12 & 35 question)
Message-Id: <howells.894551066@shell4.ba.best.com>

dave@nws.fsu.edu (David Faciane) writes:

<In article <howells.894376052@shell4.ba.best.com>,
<John Howells <howells@best.com> wrote:
<>My opinion: the title means absolutely nothing. It's just some
<>nonsense he thought up on the spur of the moment, like "Alcatraz
<>to the 9th Power".  That's just the way his mind works.


<Indeed. Here's a quick little hack. Ever notice, during the mid-60s,
<how Bob was fond of prefacing a rather mundane song title with an
<adjective to kind of spice it up, as in

<Positively Fourth Street
<Obviously Five Believers
<Absolutely Sweet Marie

<well now you can Bob-ify any dreary song title. Just copy the program below
<and run it on your system. 

<For fun, here's what happens when you run the TOOM song titles through it:

<Obnoxiously Love Sick 
<Familiarly Dirt Road Blues 
<Surely Standing In The Doorway 
<Superbly Million Miles
<Obviously Tryin To Get To Heaven 
<Mercilessly Til I Fell In Love With You 
<Amply Not Dark Yet 
<Eerily Cold Irons Bound 
<Simply Make You Feel My Love 
<Positively Cant Wait 
<Otherworldly Highlands 

<Here's the program. Save it as 'bobify' on your UNIX system (you
<are running unix or linux, riiiight?). If you are trapped in Mr. Bill's
<Funhouse, it should still work as long as you have the perl programming
<language interpreter installed.

<Just feed it a song title and it will bob-ify it!

<$ bobify 'Spinach Salad'

<Superbly Spinach Salad 


<#!/usr/local/bin/perl
<#
<# bobify: absolutely dylan title generator
<#
<#
<# usage: bobify <song title>
<#
<require 5.000;
<srand;

<my @words= qw/ obviously positively absolutely surely certainly amply eerily 
<familiarly fondly fully ghastly ghostly grizzly mercilessly ornately 
<otherworldly pitilessly scraggly simply summarily superbly truly wholly 
<pitifully obnoxiously/;

<print ucfirst($words[int(rand($#words))]), " @ARGV \n";


This is cool! But what Bobsong would be complete without a cool
suffix, like "approximately" or "revisited"? Here's a new version:

#!/usr/local/bin/perl
#
# bobify: absolutely dylan title generator
#
#
# usage: bobify <song title>
#
require 5.000;
srand;

my @words= qw/ obviously positively absolutely surely certainly amply eerily
familiarly fondly fully ghastly ghostly grizzly mercilessly ornately
otherworldly pitilessly scraggly simply summarily superbly truly wholly
pitifully obnoxiously/;

my @suffixes= ('More or Less','Most Definitely','Approximately',
               'Revisited','Now and Then','To the Limit',
               'Unlimited','No Limit','No. 27','Sooner or Later');

print ucfirst($words[int(rand($#words))]),
    " @ARGV, $suffixes[int(rand($#suffixes))] \n";

-- 

                                                           John Howells
                                                    howells@bigfoot.com
                                                http://www.punkhart.com


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

Date: 7 May 1998 14:08:55 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <6isf9n$7l6$1@news1.sol.no>

In article <894548332.192479@thrush.omix.com>,
	Zenin <zenin@archive.rhps.org> writes:

> 	only one of many shortcomings.  But I digress, this is a topic
> 	for AHW (Another Holly War).

  You are right.



> Chris Nandor <pudge@pobox.com> wrote:
>: Ah.  Mac OS is broken because it does not include sendmail?  There's a
>: gem.  Flawless logic.
> 
> 	It's a broken OS if it doesn't include common reliable access to
> 	commonly used systems.  Lack of any real mail delivery system is

  Could we, please, atleast separate the OS from the application whilst we
debate modules ? Modules in CPAN, for the most part, is as little a part
of the Perl core as a mail-system is a part of a OS core.

  Thought it *is* a digression...

-- 
  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: Thu, 07 May 1998 14:13:41 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <MPG.fbb8d06692636f69896aa@news.min.net>

On Tue, 05 May 1998 09:34:17 -0500,
in article <302E5B581AFED883.420BD151E48BF084.C9E18FF0A5FC9F05@library-
proxy.airnews.net>,
dballing@speedchoice.com (Derek Balling) wrote:
> John Porter wrote:
> 
> > How convenient for you!  I wouldn't have an account without a shell.
> 
> Then you wouldn't have an account at a large percentage of
> ISP's these days, since most are getting away from allowing
> people to have shell accounts.

Lamentable.  Fortunately, there are still some ISP's, such as the
one I use, MetroNet, which recognize that not everyone who wants
to use the internet is an clueless illiterate thumb-sucker.

John Porter


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

Date: Thu, 07 May 1998 14:41:45 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <MPG.fbb93931584dcbb9896ab@news.min.net>

On Tue, 05 May 1998 20:53:50 -0500,
in article <uK8T1IIeloyD092yn@netins.net>,
phdss@writeme.comm (Brett Tabke) wrote:
> jdporter@min.net (John Porter) wrote:
> >On Mon, 04 May 1998 23:26:42 -0500,
> >in article <CUpT1IIelwLS092yn@netins.net>,
> >phdss@writeme.comm (phdss@writeme.comm) wrote:
> >>

> >> /A:You can usually write the program faster than you can
> >>    dial/dl/hangup/install/read docs/fix it/fix the fix/.
> 
> >s/usually/never/
> 
> s/sometimes/never/

Cute. You embarrass yourself by your ignorance of perl.


> >> And when you are done, you still only have someone elses (usually
> >> lame) code that will only do 75% of what you really wanted in the
> >> first place.
> 
> >Utter b.s.  How would you know?  You don't use modules!
> 
> I've played with my share of them - not to use, just to learn.
> 
> Rarely does a module do what I wanted to do in the first place.  I
> can't think of a one that did exactly what I wanted it to do.

Your criticisms might be somewhat interesting if you gave specific
examples.  I've downloaded many modules -- in addition to the
many that come with the perl distribution -- and have never had
this problem.  The only time I ever modified the code of a module
to suit my needs was to change the value of a default.  I use
HTML::*, CGI, LWP::*, HTTP::*, File::* all the time.  They're
more than flexible enough to handle 99% of common tasks.  What are
you wanting to do that's so eccentric?


> >> /b:Are other peoples code.  You are either a programer or not.
> 
> >The power and robustness of many modules on CPAN speak for themselves.
> >It doesn't matter whether they were written by a programmer, a non-
> >programmer, or a dog.  They're good code.
> 
> But not yours.

That's a pretty lame way of avoiding the subject.


> >> /d:Disk spam.  Take libwww for instance:  installing it (guessing)
> >>    2-4 meg of spam for what?  A set of slow running subscripts that
> >>    accomplish very little that you couldn't do faster manually.
> 
> >You clearly have no clue how very many hours people like Gisle Aas
> >have put into their modules to make them useful, robust, and even fast.
> 
> I'm sure it was probably thousands of hours, and when done, what is
> it?  A group of modules that call other modules that in turn call
> other modules.  This of course is all setting on top of a run-time
> compiler built with a compiler running on a compiled operating
> system (oh, least we not forget it takes yet another compiler just
> to install.  Now that is lame code, or what I call "landfill code".
> Granted, mine is not a popular (least here anyway) or mainstream
> opinion in the dye-in-the-wool Unix/C crowd, yet it is still valid.

Hmm, you don't like interpreters or compilers. What's left?
If you think machine coding is the way to go, 
I've got a flint hand axe to sell you.


> >> /e:I don't get how it works, but I'm sure modules are just another
> >>    MLM scam. ;-) $$ Its FREE!! $$  lol.
> 
> >Moron.
> 
> Man, you need to get out more - its called sarcasm, check into it.

I know it's sarcasm.  I'm taking issue with the underlying premise.

John Porter



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

Date: Thu, 07 May 1998 14:51:22 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <pudge-0705981049270001@192.168.0.3>

In article <894548332.192479@thrush.omix.com>, Zenin
<zenin@archive.rhps.org> wrote:

# Chris Nandor <pudge@pobox.com> wrote:

I won't discuss OSes with you, because you don't have a clue on that,
either, and it is a discussion for another group.


# : Did you write that Mail-Sendmail-1.10.tar.gz you posted about?
# 
#         Yep.
# 
# : If so, I
# : know I would not trust it, or anything you have to say about sendmail or
# : SMTP, because you didn't even know the name of the protocol a couple of
# : days ago.
# 
#         Even without a glace at the code...whatever...

I don't trust people who do not understand the subject they are
programming on.  Sue me.


#  First he attacks
#         typos because he has no ground to stand on,

I was not attacking a typo, I was attacking a lack of knowledge.  Repeated
use of SNTP shows that you did not know the proper protocol name.  One use
of SNTP for SMTP is a typo.  A half dozen uses of SNTP in one post, with
no uses of SMTP at all in that post, show a lack of knowledge.  I have
never seen someone who really knows a protocol repeatedly get it wrong
like that, and I don't think I ever will.


# : Why recompile libnet??  Why not just go into the config file and change a
# : few strings?
# 
#         Two reasons.
# 
#         First, you're assuming (danger!) that the sysadmin would even think
#         about this for a nano-second when moving a mail/news/whatever machine.
#         He won't.  It's not his job to.  It's his job to make sure the system
#         mailer knows "the right thing to do".  That's it.  That's all. 
#         That's because it's not your application's job to know this, it's
#         the system mailer and *nothing* else.  You're expecting him/her to
#         not only know about the issues with Net::Config, but know the exact
#         file to modify to affect the change...This is still assuming (danger!)
#         that the admin would care, which is vary unlikely because once again,
#         it's not his job too.  Think about it, when was the last time you
#         saw an admin ponder, "Hmm, I'm moving my mail server, maybe I should
#         make sure all the header files in my copy of gcc don't need to be
#         adjusted to point to it, and tcl, and everything else on my system".
#         You live in a rose tinted world...


Depends on the sysadmin.  Regardless, whoever is the admin of perl on the
system is responsible to know to update Net::Config.  But the main point
is that the only option you gave for fixing perl when the system mailer
changed is to recompile libnet, which is simply wrong.  It is the last
resort for people who don't have a clue how to administrate their modules.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 7 May 1998 14:44:23 GMT
From: ryan@mail.ramresearch.com (Ryan McGuigan)
Subject: Graphing databases, need info
Message-Id: <6ishc7$pa3$1@news.fred.net>

Hi, I have to someway link graphs and charts to a database using any
method possible.  I can use any type of database(I'm think about using
Brent Michalski's "Simple Perl Databases" or designing something similar
myself).  The charts are no problem at all, the problem is the
Graphs.  I'd like to be able to automatically generate GIFs or JPGs of 3D
graphs for out website using Perl, but I don't have the time to try and
write something like that.  Does anyone know where I can get something to
generate the graphs??  Thanks, your help is much appreciated.

If it comes down to it, I can probably write a Java applet to display
simple graphs(but I don't like Java!).

thanks again,
Ryan McGuigan


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

Date: Thu, 07 May 1998 09:05:48 -0500
From: Gary Copeland <gary.copeland@cat.com>
To: aaa@dms2.com
Subject: Re: Help Needed for sorting a delimited text file
Message-Id: <3551BFBC.D46D851A@cat.com>

Alee Ali wrote:
> 
> Hi,
> I am very new to Perl and was wondering if somedoy can help me out.  I
> am trying to sort an Ascii Delimited file.  Each line has 5 values in it
> and I need it sorted by each value.  If anyone can suggest any ideas it
> will be greatly appreciated.  Thank you for your time.
> 
> Alee

Read each line of the ascii file into an array and use the following 
code. Sorry its not a module, like much code it is always evolving. 
Have fun.

Gary Copeland

#  sort_column.pl
#
#  Written by:  Gary Copeland  
#  Date Created: 06Mar1998
#  Modified:
#
#
#  Usage:  These routines sorts an array of strings by
#	   a given column.  The column is a sequential
#          substring separated by the given delimiter
#
# Example:
#
#        @data = ("1:zzzz:bob","2:yyyy:sue","3:aaaa,jeff");
#
#	 # sort the data by column 3 (indice 2, bob,sue,jeff) in
#        # alphabetical order, ascending 
#        @sort_data = &sort_by_column(":",2,0,1,@data);
#
#	@sort_data will contain("1:zzzz:bob","3:aaaa,jeff","2:yyyy:sue");
#
#
#
---------------------------------------------------------------------------
# sort comparison by data keys, case insensitive
sub bydatakeys 
{ 
	# the \U forces the following charcters to upper case
	
	("\U$datakeys[$a]" cmp "\U$datakeys[$b]") || ($a cmp $b);
}
#
---------------------------------------------------------------------------
# sort comparison by data keys numerical value
sub bydatakeys_num
{
        # the \U forces the following charcters to upper case

        ($datakeys[$b]  <=> $datakeys[$a] ) || ($b cmp $a);
}
#
---------------------------------------------------------------------------
# sort the data alphabetically by desired column
#
#		$delimit = character(s) used to delimit columns in strings
#		$column  = indice by which to sort (first column is indice 0)
#		$numeric = if 0 sort alphabetically
# 			   else sort numerically
#               $ascend  = if 0 sort descending
#			   else sort ascending
#		@temp    = array of delimited strings to be sorted
#
#  usage:  @sort_data =
&sort_by_column($delimit,$column,$numeric,$ascend,@temp);
#
sub sort_by_column
{
        local($delimit,$column,$numeric,$ascend,@temp) = @_;
	local(@datakeys);
	local(@sortdata);
	
	foreach (@temp)
		{
		push(@datakeys,(split(/$delimit/))[$column]);
		}
	
	if ($numeric)
		{
		if ($ascend)
			{
        		@sortdata = reverse @temp[sort bydatakeys_num $[..$#temp];
        		}
        	else
        		{
         		@sortdata = @temp[sort bydatakeys_num $[..$#temp];
        		}
        	}
        else
        	{
		if ($ascend)
			{
        		@sortdata = @temp[sort bydatakeys $[..$#temp];
        		}
        	else
        		{
        		@sortdata = reverse @temp[sort bydatakeys $[..$#temp];
        		}
         	}
	
	@sortdata;
}
#
---------------------------------------------------------------------------

1; #return true


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

Date: Thu, 7 May 1998 14:01:44 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: how to run Perl script on remote server not having Perl interpretor
Message-Id: <EsLAyw.Cqv@world.std.com>

scott@softbase.com writes:

>The Perl -> Java translator in the Perl Resource Kit might help
>you, if the remote machine has a Java interpreter but not a
>Perl one.

The JPL in the Resource kit does not turn Perl into Java bytecodes, it
only allows perl code to call Java code and vice versa. It still needs
a perl interpreter.

-- 
Andrew Langmead


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

Date: Thu, 7 May 1998 07:35:20 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: How to truncate a float value?
Message-Id: <6isgsc$aa8@hplntx.hpl.hp.com>

[posted and mailed]

Tony Curtis wrote in message
<7xvhrixze3.fsf@beavis.vcpc.univie.ac.at>...
>Re: How to truncate a float value?, Mike <marz@tamu.edu>
>said:
>
>Mike> I want to truncate a float after the first decimal
>
>Note, if you want this to be a numeric operation, it's not
>really `truncate', it's about precision.
>
>Mike> place, like so:
>Mike> 0.123456789 --> 0.1
>
>$ perldoc -f sprintf


sprintf will round, not truncate!
sprintf '%.1f', 0.987654321 --> 1.0, not 0.9 as requested.

>If you want to treat it as a string instead of a numeric
>value, then it might be easiest to split() on the `.' and
>then use substr() to get the bits you want on the right.
>
>$ perldoc -f split
>$ perldoc -f substr


s/(\.\d)\d+/$1/

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





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

Date: Thu, 07 May 1998 09:04:04 -0600
From: Cathal.G.Meehan@aib.ie
Subject: Julian Dates
Message-Id: <6isf0j$na9$1@nnrp1.dejanews.com>

Hi,
    Is it possible to convert gregorian dates to julian in perl. I just
installed perl for WinNT, but I don`t know if I need to include any Date
manipulation patches or not. Any help would be greatly appreciated.
                                                    TIA
                                                     Cathal.

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


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

Date: Thu, 07 May 1998 09:10:56 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: curtish@gte.net
Subject: Re: Open to suggestions
Message-Id: <3551C0F0.FFC001E3@mail.uca.edu>

[cc'd to ch]

Curtis Hoffmann wrote:
> 
> On Tue, 05 May 1998 20:18:41 GMT, Tom Phoenix <rootbeer@teleport.com>
> wrote:
> 
> >>    What I'm asking for is pointers to a Perl script that can take a
> >> block of text data and store it to a particular subdirectory on the
> >> server.
> >
> >That's easy to do with Perl's file operations, of course.
> 
>    Not from what I can tell.  There's TONS of information files,
> sample programs, books, etc.  And most of this stuff is useless when
> the platform is Win32Perl.  I'm spending more time wading through
> stuff I can't use, than I am in doing my real job (writing
> documentation for plasma etching equipment.)

Get the gecko book (Learning Perl on Win32 Systems, O'Reilly). It deals
with just what you can do in Win32, and what you cannot [NB: Win32
actually refers to WinNT, and there are some things you cannot do in
Win95 that you can in WinNT, see below for your app]. It helps me to
separate the possible from the impossible, and actually there are not
*that many* things that are impossible on Win32, you just have to know
some syntax issues about the file systems, etc. It does help those of us
with another day job.

Also, are you using Sarathy's port? It is much more useful for non-web
things, because he has included a bunch of modules, and the others are
makable using the standard techniques.

> 
> >> The file names should be sequential, (i.e. - File0001.txt, File0002.txt,
> >> File0003.txt, etc.)
> >
> >That's easy to do, although there is a worry about concurrency. You may
> >need to use flock.
> 
>    Concurrency is not that important.  The identifier data is being
> submitted within the forms data.  The sequential names are just to
> prevent the script from overwriting an existing file before it's
> parsed by the PC application.

Actually, I think that is what Tom means by concurrency. If you write
over a file before it is used/parsed/disposed of, then you have lost the
data in the original file. Note, in order to use flock, you will have to
use WinNT, rather than Win95 because of the way the two OS's are built. 

> [remainder of orig. snipped]

Cameron


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

Date: Thu, 07 May 1998 10:29:47 -0700
From: Glenn Davis <gdavis@surveystar.com>
Subject: Re: Perl on Win95?
Message-Id: <3551EF8A.1FF@surveystar.com>

So now that I've got Perl installed (and can run a script), how do I run
Perl as a CGI script?  What I'm trying to do is run a cgi script on a
local (win95) machine (which is not set up as a web server).  I want to
use this system to test scripts before they get uploaded to the server
we use.  Any thoughts?
Thanks,
Glenn


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

Date: Thu, 07 May 1998 10:28:27 -0400
From: "David A. Lyons" <lyonsd@atl.hp.com>
Subject: perl scripts dealing with /etc/passwd
Message-Id: <3551C50B.B6957CB0@atl.hp.com>

Somebody please point me to a resource where I can analyze perl scripts
that do various things to the /etc/passwd file, like add, remove,
change, view, sort entries, check password, etc.  I don't know perl, but
I'm planning to add a database to a web site where users can enter,
change & remove their entries and it'll use a username/password so
others can't affect another's entry.  I figure looking at perl scripts
that work with the /etc/passwd will be a good place to start on the
learning curve, since my will be implemented similarly.

Dave


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

Date: Thu, 7 May 1998 14:21:53 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: require "file.sub": which script called it?
Message-Id: <adelton.894550913@nemesis>

"Frank L. Quednau" <quednauf@nortel.co.uk> writes:

> require "docfiling_.sub";
> 
> How can I figure out within that subroutines file from which
> script it has been called?

Check the perlfunc man page for function caller.

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Thu, 07 May 1998 14:02:18 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Share an array
Message-Id: <MPG.fbb8a5921e19e219896a9@news.min.net>

On Tue, 05 May 1998 12:23:25 +0000,
in article <354F04BC.9F065AFB@cobra.jpl.nasa.gov>,
rxk@cobra.jpl.nasa.gov (Razmik Khachikyan) wrote:
> Does anyone know how to share an array?
> Thanks in advance!

easy:
share(@array);

John Porter


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

Date: Thu, 7 May 1998 07:26:26 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Truncate() not documented correctly?
Message-Id: <6isgbj$a68@hplntx.hpl.hp.com>

Scott Guelich wrote in message <3551BA04.AA7B941E@-asq.org>...
>Hi all. I ran across a problem with truncate and I'd reallly appreciate
>it if someone could validate this for me... or let me know if I'm just
>going insane. This message is a little long, but I know I'll get a
>simple answer based on the docs unless I explain this fully:
 ...

This is a bug in your version of perl (which you didn't specify).  I ran
across it in 5.002, and it is fixed in 5.003 or 5.004.  If you can't
upgrade for some reason, use

{ local $^W = 0; truncate FH, 0 }

>Can anyone verify this?  Thanks in advance... oh, and please remove the
>dashes from the email address to email me (anti-spam).
>
>Scott Guelich
>sguelich-@-asq.org

Thanks, no.  That's considered bad form by many participants here who
are more experienced than I am.

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





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

Date: Thu,  7 May 1998 10:05:12 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: What is wrong with this?
Message-Id: <6isf2o$2d8$1@earth.superlink.net>

Hello -

"Ian Sergeant" <pezhead@cheerful.com> writes:

>I got this from the perl book called Learning Perl.  I am trying to learn
>Perl and i can't get this to work.  What is the problem?


>#!/usr/bin/perl -w
>$secretword = "llama"; # the secret word
>print "What is you name?";

You've misspelled 'your', but I don't think that's the problem.

>$name = <STDIN>;
>chomp $name

That looks more like it - a missing semi-colon.


David Black
dblack@saturn.superlink.net


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

Date: Thu, 07 May 1998 15:00:34 +0100
From: "Frank L. Quednau" <quednauf@nortel.co.uk>
Subject: Re: Win95 Perl scripts DONT WORK on UNIX
Message-Id: <3551BE81.2A7F819A@nortel.co.uk>

edepot wrote:

> Hello.  I found out that perl scripts written to run
> on Windows 95 Perl DOES NOT WORK
> on unix Perl.
>
> The reason is that Windows (or DOS) puts a
> character "^M" after a line, and UNIX perl
> does NOT understand this character.

What really confuses me, though, is the fact that I have copied
many textfiles which subsequently ran as perl scripts from my
Win95 machine to UNIX (no FTP; or maybe internally?), and I never
encountered any problems. But this is the realm of computing
chaos. Like the fact that last time when I copied several files
from PC to UNIX all
FILENAMES SUDDENLY APPEARED IN CAPITAL LETTERS. But not all
actually, a couple remained in small letters. Beat that!



--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________





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

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

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