[9315] in Perl-Users-Digest
Perl-Users Digest, Issue: 2910 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 19 10:13:28 1998
Date: Fri, 19 Jun 98 07:01:13 -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 Fri, 19 Jun 1998 Volume: 8 Number: 2910
Today's topics:
Re: $a: numeric or NOT ? <bowlin@sirius.com>
Re: 2 questions about lists (Michael J Gebis)
Re: 2 questions about lists (Michael J Gebis)
Re: Beginner <sdlmeire@mediaport.org>
Re: Excel - Perl conversion dougr13@hotmail.com
Re: How do you pre-append using "open" (Tad McClellan)
How to sort a 2-D array based on the first index? pugs5@my-dejanews.com
Re: if (something eq "somethingfgjhf") (Jeffrey R. Drumm)
Re: if (something eq "somethingfgjhf") (Larry Rosler)
Re: if (something eq "somethingfgjhf") <sdlmeire@mediaport.org>
javascript and perl <soetensi@se.bel.alcatel.be>
Re: Matching Question (Steve Linberg)
Re: mkdir MODE problem (Tom Grydeland)
modperl on NT rwvtveer@my-dejanews.com
modperl on NT rwvtveer@my-dejanews.com
modperl on NT rwvtveer@my-dejanews.com
modperl on NT rwvtveer@my-dejanews.com
Re: Newbie Question (Jeffrey R. Drumm)
Novell Perl <vansevenantd@faxon.ca>
Re: perl command line options <norman.bunn@mci.com>
Re: PERL IDE?? Is that it? <quednauf@nortel.co.uk>
Re: Pod::Text -- Unix only? (Chris Nandor)
Re: Pod::Text -- Unix only? (Chris Nandor)
Re: Problem using rsh within PERL <joe@colsys.com>
Re: Problem with references (Real)
Running perl scripts on NT as a Service <dojo@mail.matav.hu>
Re: Sorting IP's - Help! (Rahul Dhesi)
Subtracting Number of seconds from a date <mat.r@ukonline.co.uk>
Re: the ?PATTERN? match syntax (Josh Kortbein)
Re: Using PERL to do a remote TELNET <psattler@bestweb.net>
Re: what would be the best strategy for a port scanner? (Michael J Gebis)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 Jun 1998 06:53:39 -0700
From: Jim Bowlin <bowlin@sirius.com>
Subject: Re: $a: numeric or NOT ?
Message-Id: <358A6D63.E24D864B@sirius.com>
Ronald J Kimball wrote:
>
>
> You're splitting hairs. No where in the standard documentation does it
> say that , *is* allowed in numbers. On the other hand, it *does* say in
> the standard documentation that _ is allowed in numeric literals. What
> is missing is the statement that _ is not allowed in strings or input.
My earlier response to the orginal question answered this: The Camel
Book says that numeric conversion of strings is done with the C
atof() function. I looked up atof() and provided a regular expression
that returns true if a string will get converted by atof() successfully.
IMHO this entire thread is splitting hairs.
-- Jim Bowlin
------------------------------
Date: 19 Jun 1998 07:24:07 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: 2 questions about lists
Message-Id: <6md3mn$95q@mozo.cc.purdue.edu>
eedalf@eed.ericsson.se (Alexander Farber) writes:
}"Oh man"... Though i usually never do it, i would like to note
}smth this time: i am sick of people like Mike, who don't help
}but just annoy. Mike, i have Llama and Camel books, the Perl
}FAQ is in my home dir (ok, i missed it this time) and i know
}how to use Dejanews.
Yeah, I'm pretty sick of those people too. So...
I _did_ refernce a thread entitled "Why is there no 'in' operator in
perl". I wasn't sure of the title, but I did just look it up now.
Guess what it really was?
Re: Why is there no "in" operator in Perl?
Pretty damn sweet memory. I think I might have a phonographic one.
Sure, it's not as spelled out as a full URL, but you're not even
going to give me ANY credit for helping you?
If you read the thread (and I really hope you do, no saracsm or ill
will or nothing like that at all!) you'll see that there are (as
always) several ways to do it, and this issues aren't as simple as you
think. I didn't want to post a quick re-hash, since it wouldn't do
the topic full justice, but since the thread was covered recently, it
didn't make sense to cover it in depth, either. After all, the
regulars had just seen it.
}And Mike, can you imagine, there are people who don't have time to
}read all your previous brilliant posts, because c.l.p.m is pretty big ?
Read the thread. Especially the part where three or four people point
out the flaws in my answer, and I've got egg on my face. Ask yourself,
"Maybe, maybe, is that asshole Mike _joking_ when he calls himself
brilliant?"
Seriously, take another look. I'm the best friend you've got here.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 19 Jun 1998 07:32:15 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: 2 questions about lists
Message-Id: <6md45v$96v@mozo.cc.purdue.edu>
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
}Alexander Farber <eedalf@eed.ericsson.se> wrote:
}> I am aware of Cperl-mode for emacs and i do have it, i am just
}> looking for other indentation modes, since i don't like the one,
}> that is included in Cperl and i don't know LISP myself to do my own.
}Then why didn't you say so when you asked the question?
I'm going to stand by my original answer on this one--cperl mode is
pretty sweet. Alexander, if you don't like it, I suggest you give it
a chance to grow on you. It took me a while to learn to like it, but
now I think it's the best thing since free beer.
(And just in case: I don't know of any other perl indentation modes
for emacs, so I'm not refusing to answer you, I'm just ignorant!
Thank god that comes with bliss.)
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Fri, 19 Jun 1998 15:20:15 +0200
From: "Sven Delmeiren" <sdlmeire@mediaport.org>
Subject: Re: Beginner
Message-Id: <6mdote$sgi$1@inf6serv.rug.ac.be>
Hiya,
>I'm in the process of trying to teach myself Perl. If anyone has any
>suggestions on where to start such as literature, etc. I'd appreciate
>it.
>
>thanks,
>Chris Miller
Well, I taught myself Perl by getting myself a book called "Perl by Example"
written by David Medinets... I think it's pretty good, and I know a lot
about cgi programming and Perl now :-)
Regards,
Sven
------------------------------
Date: Fri, 19 Jun 1998 13:28:01 GMT
From: dougr13@hotmail.com
Subject: Re: Excel - Perl conversion
Message-Id: <6mdp10$vk3$1@nnrp1.dejanews.com>
well id lovo to have a copy of that utility
regards
In article <19980619.010727.2Y2.rnr.w164w@locutus.ofB.ORG>,
Russell Schulz <Russell_Schulz@locutus.ofB.ORG> wrote:
>
> >> I am looking for a script that will convert excel into perl.
> >
> > Euhm.. How do you imagine that? Excel is a spreadsheet program, and
> > Perl is a programming language.
>
> I assume the desire is to convert something like this:
> A B C
> 1 3
> 2 =1+A1
> 3 =1/B2
>
> into:
>
> array[1][1]=3;
> array[2][2]=1+array[1][1];
> array[3][3]=1/array[2][2];
>
> > It's like asking for a tire that will convert your chair into a
> > banana.
>
> well, I have written two such translators for work (neither converts
> the calculations into perl, though).
> --
> Russell_Schulz@locutus.ofB.ORG Shad 86c
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 21:56:41 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How do you pre-append using "open"
Message-Id: <91kcm6.vns.ln@localhost>
Nick Forte (webmaster@triologic.com) wrote:
: I'm trying to pre-append a record to a flat file. I want the record to
: be inserted on the first line everytime instead of appending it to the
: end. Can someone help me?
You can help yourself (and get the answer MUCH faster too) by taking
180 seconds out of your busy day to see if your question has already
been answered countless times before.
I guess you must have missed it somehow when you searched for your
Frequently Asked Question before posting...
from the Perl FAQ, part 5:
"How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?"
: Thanks!
Yeah, right.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 19 Jun 1998 12:01:18 GMT
From: pugs5@my-dejanews.com
Subject: How to sort a 2-D array based on the first index?
Message-Id: <6mdjue$p5c$1@nnrp1.dejanews.com>
Hello...
I am trying to sort a 2-D array or maybe a array inside a array. I am having
trouble using perl sort function and it is powerful because it uses quick
sort, but since I can not figure it out, I wrote a code that use selection
sort but it is too slow since I am using an array of entries of 5000.
Let me give you an example.
Let's say that I have
$bytestohost{$i,$j} = value..
$i is the port number and $j is the index.
I want to sort the inner array(value) in ascending order.
I hope that makes sense.
I want to be able to sort the array of a given $i that $i contains.
Thanks for your help.
Jason Pugsley
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 19 Jun 1998 11:42:23 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <358b4c43.71364216@news.mmc.org>
[posted and mailed to the interested parties]
On Fri, 19 Jun 1998 09:35:03 GMT, sowmaster@juicepigs.com (Bob Trieger) wrote:
>[ posted and mailed ]
>
>ptimmins@netserv.unmc.edu (Patrick Timmins) wrote:
>
>-> use Benchmark;
>-> $foo = "something wicked this way comes.";
>-> $bar = "something";
>->
>-> timethese 1000000, {
>-> regex => sub {
>-> die if ($foo !~ /$bar/);
Changing this to:
die if ($foo !~ /^$bar/);
I get:
Benchmark: timing 1000000 iterations of equal, regex...
equal: 7 secs ( 6.83 usr 0.00 sys = 6.83 cpu)
regex: 10 secs ( 8.82 usr 0.00 sys = 8.82 cpu)
Seems reasonable, yes? But change it to:
die if ($foo !~ /^$bar/o);
Benchmark: timing 1000000 iterations of equal, regex...
equal: 8 secs ( 6.86 usr 0.00 sys = 6.86 cpu)
regex: 5 secs ( 5.01 usr 0.00 sys = 5.01 cpu)
Woohoo!
This, of course, assumes that $bar won't change over the life of the script.
>-> },
>-> equal => sub {
>-> die if (substr($foo,0,9) ne substr($bar,0,9));
>-> }
>-> };
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Fri, 19 Jun 1998 05:22:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <MPG.ff3f7f0c6b60b569896d1@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6mdbfk$6je$1@ligarius.ultra.net>, Bob Trieger
<sowmaster@juicepigs.com> says...
> [ posted and mailed ]
>
> ptimmins@netserv.unmc.edu (Patrick Timmins) wrote:
>
> -> use Benchmark;
> -> $foo = "something wicked this way comes.";
> -> $bar = "something";
> ->
> -> timethese 1000000, {
> -> regex => sub {
> -> die if ($foo !~ /$bar/);
> -> },
> -> equal => sub {
> -> die if (substr($foo,0,9) ne substr($bar,0,9));
> -> }
> -> };
> ->
> -> On my system, this outputs:
> ->
> -> Benchmark: timing 1000000 iterations of equal, regex...
> -> equal: 12 secs (11.43 usr 0.00 sys = 11.43 cpu)
> -> regex: 12 secs (11.90 usr 0.00 sys = 11.90 cpu)
> ->
> -> So over the course of a million iterations, you've saved me less than half a
> -> second. Plus your option isn't very adabtable. Whenever $bar changes you've
> -> got to putz around with your substr length parameters for substr $foo and
> -> substr $bar. You can have your half a second! :)
>
> Your regex isn't correct for what the original poster was looking for. He
> specificall said the first 8 characters. Anchor your match to the beginning
> and retry the timing.
You also have to substr the comparand ($bar in this example). Look
again at the problem statement:
::I need the following statement to be true as long as the first 9
::characters are the same. I don't care about what follows the 9
::characters.
::if (something eq "somethingetdsfg.....................")
I believe this is a correct comparison:
#!/usr/local/bin/perl -w
use Benchmark;
$foo = "something wicked this way comes.";
$bar = "somethingx";
timethese (1 << 18, {
regex => sub { $foo =~ /^${\substr($bar, 0, 9)}/ },
regexo => sub { $foo =~ /^${\substr($bar, 0, 9)}/o },
equal => sub { substr($foo, 0, 9) eq substr($bar, 0, 9) },
cntrl => sub { 1 },
} );
__END__
Benchmark: timing 262144 iterations of cntrl, equal, regex, regexo...
cntrl: 13 secs ( 3.48 usr 0.05 sys = 3.53 cpu)
equal: 21 secs ( 6.48 usr 0.11 sys = 6.59 cpu)
regex: 25 secs (10.46 usr 0.04 sys = 10.50 cpu)
regexo: 11 secs ( 5.29 usr 0.01 sys = 5.30 cpu)
If one of the strings being compared is unchanging, the optimized regex
is the winner. If both of the strings may change, the compare-substrings
is the winner.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 19 Jun 1998 15:21:54 +0200
From: "Sven Delmeiren" <sdlmeire@mediaport.org>
Subject: Re: if (something eq "somethingfgjhf")
Message-Id: <6mdotg$sgi$2@inf6serv.rug.ac.be>
Hi,
>Is it possible to only test the first 8 characters/digits to see if a
>statement is true?
>
>I need the following statement to be true as long as the first 9
>characters are the same. I don't care about what follows the 9
>characters.
>
>if (something eq "somethingetdsfg.....................")
>
>then....
Yeppers... use substr()...
Sven
------------------------------
Date: Fri, 19 Jun 1998 15:48:11 +0200
From: Inge Soetens <soetensi@se.bel.alcatel.be>
Subject: javascript and perl
Message-Id: <358A6C1B.3CB99EC1@se.bel.alcatel.be>
Hi,
Can anyone tell me....
Is it possible to call a perl procedure from a javascript function ?
Thanks
------------------------------
Date: Fri, 19 Jun 1998 09:41:06 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Matching Question
Message-Id: <linberg-1906980941060001@projdirc.literacy.upenn.edu>
In article <3589a71c.91383515@news.smart1.net>, barnhart@freewwweb.com
(Ron Barnhart) wrote:
> Your assesment of the situation was right on target. I didn't stick
> with it long enough. I hadn't even finished the first chapter. I
> wondered if I might find the answer later in the book. However, I'm
> glad I posted the question. I received a couple of emails and your
> response as well. I had no perception of the usefulness of regular
> execptions while I was reading the book. But from the comments I've
> recieved, I can tell that they are fairly important. Thanks for your
> help.
My pleasure! I have "regular exceptions" all the time. :D And once
you've got a handle on them, be sure to kick some serious booty with
them! They've completely spoiled me at this point.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: 19 Jun 1998 12:02:21 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: mkdir MODE problem
Message-Id: <slrn6okkqd.vlh.Tom.Grydeland@mitra.phys.uit.no>
On Thu, 18 Jun 1998 18:42:38 GMT,
marius77@my-dejanews.com <marius77@my-dejanews.com> wrote:
> I have a script that creates several new directories, but I'm having trouble
> with the permissions. I need them to be either
>
> drwxrwxrwx or drwxr_xrwx and I currently have a umask of 002.
If you have an umask of 002, you cannot get those permissions.
Why not change the umask first? You can do it from within the script,
you know.
umask 0;
foreach $dir (@dirs) {
mkdir $dir, 0777 or die "Couldn't create $dir: $!\n";
}
> Marius
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
- Do radioactive cats have 18 half-lives? -
------------------------------
Date: Fri, 19 Jun 1998 11:20:49 GMT
From: rwvtveer@my-dejanews.com
Subject: modperl on NT
Message-Id: <6mdhii$md1$1@nnrp1.dejanews.com>
Hi,
Is any of you running CGI's with modperl on NT? If so, is it
possible to setup a server without rebuilding any of the required
software from the source? I have found modperl binaries at
<http://www.perl.org/CPAN/modules/by-module/Apache>
but the README's says these require perl-5.004_04 and the latest
binary release for Win32 I can find is 5.004_02..
Can anyone share his/her experience?
Thanks,
Remco
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 19 Jun 1998 11:20:51 GMT
From: rwvtveer@my-dejanews.com
Subject: modperl on NT
Message-Id: <6mdhij$md2$1@nnrp1.dejanews.com>
Hi,
Is any of you running CGI's with modperl on NT? If so, is it
possible to setup a server without rebuilding any of the required
software from the source? I have found modperl binaries at
<http://www.perl.org/CPAN/modules/by-module/Apache>
but the README's says these require perl-5.004_04 and the latest
binary release for Win32 I can find is 5.004_02..
Can anyone share his/her experience?
Thanks,
Remco
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 19 Jun 1998 11:23:10 GMT
From: rwvtveer@my-dejanews.com
Subject: modperl on NT
Message-Id: <6mdhmu$mdf$1@nnrp1.dejanews.com>
Hi,
Is any of you running CGI's with modperl on NT? If so, is it
possible to setup a server without rebuilding any of the required
software from the source? I have found modperl binaries at
<http://www.perl.org/CPAN/modules/by-module/Apache> but the
README's says these require perl-5.00404 and the latest binary
release for Win32 I can find is 5.00402..
Can anyone share his/her experience?
Thanks,
Remco
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 19 Jun 1998 11:20:49 GMT
From: rwvtveer@my-dejanews.com
Subject: modperl on NT
Message-Id: <6mdhig$md0$1@nnrp1.dejanews.com>
Hi,
Is any of you running CGI's with modperl on NT? If so, is it
possible to setup a server without rebuilding any of the required
software from the source? I have found modperl binaries at
<http://www.perl.org/CPAN/modules/by-module/Apache>
but the README's says these require perl-5.004_04 and the latest
binary release for Win32 I can find is 5.004_02..
Can anyone share his/her experience?
Thanks,
Remco
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 19 Jun 1998 12:14:04 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Newbie Question
Message-Id: <358c529c.72988922@news.mmc.org>
[posted and mailed]
On Fri, 19 Jun 1998 08:53:48 GMT, Sifu Hall <webmaster@dragonslist.com> wrote:
>How can I sort a mulit-dimensional array an a specific element? For
>example if I have an array @Schools, how can I sort this array to be
>alphabetic by the third element?
>webmaster@dragonslist.com
Please see perlfaq4, "How do I sort an array by (anything)?"
$ perldoc perlfaq4
C:\> perldoc perlfaq4
The FAQs are included in the documentation for The One True Perl distribution.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Fri, 19 Jun 1998 09:50:00 -0400
From: Dion Vansevenant <vansevenantd@faxon.ca>
Subject: Novell Perl
Message-Id: <358A6C88.646C5B0F@faxon.ca>
Has anyone out there had experience with Novell's flavour of Perl?
We are trying to modify some scripts to run on a Novell server, but they
don't seem to work. I'm not sure if things just are not configured
properly, or if it's a "flavour" problem.
Any help/hints/suggestions would be appreciated. Thanks!
--
Dion
*************************************************************************
* Dion Vansevenant
*
* System Administrator Tel: (519) 472-1005
*
* Faxon Canada Ltd. Fax: (519) 472-3223
*
* P.O. Box 2382 E-mail: vansevenantd@faxon.ca
*
* London, ON N6A 5A7 Web: www.faxon.ca
*
* Canada
*
* A DAWSON COMPANY
*
*************************************************************************
------------------------------
Date: Fri, 19 Jun 1998 12:04:25 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: Re: perl command line options
Message-Id: <dtsi1.20597$Ro2.1352428@pm01nn>
Excellent!
"perl program.pl null"
worked great!
Larry Rosler wrote in message ...
>In article <nl7i1.421$Ro2.491840@pm01nn>, Norman Bunn
><norman.bunn@mci.com> says...
>> Does NT Server 4.0 have an equivalent?
>>
>> Norman
>>
>> >On Wed, 17 Jun 1998, Norman Bunn wrote:
>> >
>> >> Is there anyway to tell perl from the command line not to look for
input?
>> >
>> >Check your shell's documentation about redirecting input to come from
>> >/dev/null (or your system's equivalent).
>> >
>> >Tom Phoenix Perl Training and Hacking Esperanto
>> >Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>Try the "filename" NUL: which I know works as a bit-bucket for output;
>presumably it is also an end-of-file source for input (like /dev/null).
>
>--
>Larry Rosler
>Hewlett-Packard Laboratories
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com
------------------------------
Date: Fri, 19 Jun 1998 13:51:32 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: PERL IDE?? Is that it?
Message-Id: <358A5ED4.89CC3F27@nortel.co.uk>
Dario Andrade wrote:
>
> I read at Developers that there was a PERL IDE for developing perl scripts.
^--|
|
|
Didn't they say the name of the company? Solutionsoft.
http://www.solutionsoft.com/DL_PerlBuilder.htm
Evaluation Version for an 'IDE' for Win32 systems. Have fun...
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Fri, 19 Jun 1998 11:37:39 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Pod::Text -- Unix only?
Message-Id: <pudge-1906980734530001@dynamic162.ply.adelphia.net>
In article <3589CCAD.C9D65096@aquila.com>, "Michael D. Schleif"
<mike.schleif@aquila.com> wrote:
# I don't presume to speak for Tom -- we have had our share of words
# between us -- but, anybody care to ship Tom a Mac?
#
# It sure would deprive him of another excuse, although I don't know where
# he'll find room to plug it in . . .
That assumes Tom would want to use a Mac. You can ship me a VAX, but that
is no guarantee I will use it. No one should begrudge Tom's dislike of
Mac OS. As long as he lets me use the Mac without significant flamage,
which is probably dependent on my not trying to evangelize the Mac to him,
then all is well in Happytown.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Fri, 19 Jun 1998 11:37:42 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Pod::Text -- Unix only?
Message-Id: <pudge-1906980734560001@dynamic162.ply.adelphia.net>
In article <6mbhvu$vcl$1@nnrp1.dejanews.com>, pehanna@my-dejanews.com wrote:
# If cross-platform means "Linux, BSD, SunOS, *and* Solaris -- and probably any
# other professional/open/POSIX/Unix-like system" then why bother to use readdir
# instead of `ls`? Perl provides a number of constructs that abstract most
# operating system differences. (OK, "runs on a Mac" is pushing it, I'll agree.)
Seems to me you don't know much about the Mac ... for most things in my
experience, it is probably as or more likely it runs under MacPerl than
Perl for Win32.
But back to your main question: no, there is no fully portable way to
determine screen width. And if I wanted Pod::Text to determine screen
width on my Mac, I would patch it myself using the $^O special variable,
because I cannot expect non-Mac users to figure it out for me.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Fri, 19 Jun 1998 09:30:14 -0400
From: "Joe" <joe@colsys.com>
Subject: Re: Problem using rsh within PERL
Message-Id: <358a68bd.0@news>
Hamish,
I think the reason is that even though you put the "&" at the end of the
command, the remote shell daemon keeps the connection opened because the
standard i/o handles are still open (which are sockets inherited from rshd).
Try this instead:
`rsh -n $best_host "$logdir/\.submit\.command </dev/null >/dev/null
2>/dev/null &`;
The above assumes you are using sh or ksh on the host. If using csh, try:
`rsh -n $best_host "$logdir/\.submit\.command </dev/null >&/dev/null &`;
This redirects stdout, stdin, and stderr to /dev/null, forcing them closed.
Joe
Hamish_Eassie <Hamish_Eassie@optilink.dsccc.com> wrote in message
3589B147.4B63F2A8@optilink.dsccc.com...
>Hi,
>
>I am writing a queueing system using PERL (Version 5) to run on solaris
>machines (SunOS 5.5.1) and am having a problem when using 'rsh' to batch
>
>off jobs in the background. I always batch off a csh script, but the
>problem is that if this shell script executes another shell script then
>the PERL script waits for all commands to complete, whereas if the csh
>script executes a compiled binary then the job is executed in the
>background as desired.
>
>The PERL script first of all creates a command file (a csh script called
>
>.submit.command) which contains setenv statements to copy the
>environment from the shell which calls it and has the command to be
>executed at the end of the file. The script then rshells this script in
>
>the background as follows :
>
>`rsh -n $best_host $logdir/\.submit\.command &`;
>
>where $best_host is determined earlier as the best host to batch off to,
>
>and $logdir is the place the command file was created.
>
>So the problem is that if .submit.command calls a compiled binary (in
>our case, the synopsys dc_shell) for example :
>
>
>#!/bin/csh
>setenv AB_CARDCATALOG "/usr/dt/share/answerbooks/C/ab_cardcatalog"
>setenv DISPLAY ":0.0"
> <MORE setenv statements>
> .
>setenv DESIGN_NAME "TEST"
>unalias cd
>cd /home/hw5/synopsys/log/TEST
>dc_shell -f /home/hw5/synopsys/scripts/test.scr >
>/home/hw5/synopsys/log/TEST/TEST_test.log
>
>
>then the PERL script starts the dc_shell job off, then moves on the the
>
>next PERL command, which is what we want. But if the .submit.command
>calls another shell script, eg :
>
>#!/bin/csh
>setenv AB_CARDCATALOG "/usr/dt/share/answerbooks/C/ab_cardcatalog"
>setenv DISPLAY ":0.0"
> <MORE setenv statements>
> .
>setenv dtstart_sessionlogfile "/dev/null"
>unalias cd
>cd /home/hw5/
>/home/hw5/shell_scripts/script.scr > /home/hw5/test/log/shell.log
>
>then the PERL script waits for the commands in script.scr to be
>completed before continuing.
>Any ideas ?
>
>Thanks,
>
>Hamish Eassie.
>
>PS Please mail me direct as well as to the group :
>Hamish_Eassie@optilink.dsccc.com
>
>
>
------------------------------
Date: Fri, 19 Jun 1998 15:47:08 +0200
From: real@earthling.net (Real)
Subject: Re: Problem with references
Message-Id: <MPG.ff48a447ba94a539896ab@news.surfnet.nl>
Nathan Weston wrote;
> I'm a complete newbie to Perl (I started learning about 3 days ago), and
> I've run into a problem using references. Basically, I have a reference to
> an associative array, every element of which contains a reference to another
> associative array. I am able to get data into this array, but I can't figure
> out the syntax to access elements of the inner arrays. Can anyone help with
> this?
>
> Nathan
Hay Natan,
I think you are looking for a "hash of hashes". I got a nice example
which (I hope) explains it all !
Cheers,
Real
#!/usr/bin/perl -w
####################################################
#
# Simple "hash of hashes" example.
#
# By Prof. Golden G. Richard III
# Dept. of Computer Science
# University of New Orleans, March 1998.
# Use for any purpose whatsoever granted.
#
####################################################
use strict; # other examples don't currently play this game!
# probably a good idea, though, because at a minimum
# it encourages you to use "my", which reduces
# mispelled identifier errors.
my $done;
my $cmd;
my $outer;
my $inner;
my $something;
my $in;
my $out;
my %symtable;
sub everything {
# output everything
foreach $out (keys %symtable) {
print "$out :\n";
foreach $in (keys %{$symtable{$out}}) {
print " $in = $symtable{$out}{$in}\n";
}
}
}
$done = 0;
while (! $done) {
print "Enter command (SET or QUERY or ALL or QUIT): ";
chop($cmd = <STDIN>);
if ($cmd =~ /^[aA][lL][lL]$/) { # ALL - dump
everything
everything();
} elsif ($cmd =~ /^[qQ][uU][iI][tT]$/) { # QUIT
$done = 1;
} elsif ($cmd =~ /^[sS][eE][tT]$/) { # SET - change/add a
value
print "Enter outer name: ";
chop($outer = <STDIN>);
print "Enter inner name: ";
chop($inner = <STDIN>);
print "Enter value: ";
chop($something = <STDIN>);
$symtable{$outer}{$inner} = $something;
} elsif ($cmd =~ /^[qQ][uU][eE][rR][yY]$/) { # QUERY - look at one
value
print "Enter outer name: ";
chop($outer = <STDIN>);
print "Enter inner name: ";
chop($inner = <STDIN>);
if (defined($symtable{$outer}{$inner})) {
print "Value = $symtable{$outer}{$inner}\n";
} else {
print "Not defined.\n";
}
} else {
print "Huh?\n"; # whoops
}
}
------------------------------
Date: Fri, 19 Jun 1998 15:02:58 +0200
From: Jozsef Dojcsak <dojo@mail.matav.hu>
Subject: Running perl scripts on NT as a Service
Message-Id: <358A6181.2C510125@mail.matav.hu>
There are perl modules and scripts like NNML which are worth using as a
Service on NT. Does anyone have any experience with it? (And with
Service tools like srvany from Microsoft or RunExecSvc from WinWinSoft)
I went a step further and created a small NT service, which contained an
embedded perl interpreter. I was able to start the service but failed
using it because it consumed 98% CPU. What did I wrong?
Thanks in advance,
Jozsef
------------------------------
Date: 19 Jun 1998 01:46:41 GMT
From: c.c.eiftj@41.usenet.us.com (Rahul Dhesi)
Subject: Re: Sorting IP's - Help!
Message-Id: <6mcfu1$qg$1@samba.rahul.net>
In <3589744E.794B@boeing.com> David Pitts <david.pitts@boeing.com>
writes:
>What I am trying to do is sort this list by ip (there are thousands of
>entries).
The code below will sort lines in an array @lines if the third field is
the IP address. To select a different field see $f1[2] and $f2[2]
below.
-- cut here --
@lines = sort cmp @lines;
print @lines;
sub cmp {
@f1 = split(' ', $a);
@f2 = split(' ', $b);
($a1, $a2, $a3, $a4) = split(/\./, $f1[2]);
($b1, $b2, $b3, $b4) = split(/\./, $f2[2]);
($a1 != $b1) && return $a1 - $b1;
($a2 != $b2) && return $a2 - $b2;
($a3 != $b3) && return $a3 - $b3;
return $a4 - $b4;
}
-- cut here --
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: Fri, 19 Jun 1998 12:17:30 +0100
From: "Matthew Robertson" <mat.r@ukonline.co.uk>
Subject: Subtracting Number of seconds from a date
Message-Id: <6mdhc1$4v8$1@morse.news.easynet.net>
Hi there,
I have a script that needs to subtract a number of seconds from a date and
have another date returned.
e.g.
seconds = 67
Date = 15 06 98 15:24:54
Returned Date = 15 06 98 15:23:47
The problem is that the number of seconds is rather large and as the result
has to be exact, a previous subroutine I had written would reduce the
scripts performance considerable.
Does anyone know of a function that handles this kind of thing.
The machine is running AIX Version 3.2 and perl 5.003
If you need to know any more information please let me know
Thanks in advance
Matthew Robertson
------------------------------
Date: 19 Jun 1998 12:37:01 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: the ?PATTERN? match syntax
Message-Id: <6mdm1d$vhr$2@news.iastate.edu>
Mark-Jason Dominus (mjd@op.net) wrote:
: In article <6mce3p$96f$1@nnrp1.dejanews.com>,
: <topher67@my-dejanews.com> wrote:
: >The match syntax "?PATTERN?" is very useful and should *not* be removed from
: >perl.
: OK. Why?
: I'm not trying to start an argument; I'm really curious. A few months
: ago I tried to make a list of the least-known and littlest-used Perl
: features. I polled some experienced Perl programmers for advice.
: When I mentioned ?PATTERN? to them, most of them didn't know what I
: was referring to.
: When is ?...? useful? What do you do with it?
Not that I'm the bitchass end-all be-all of perl programmers,
but I've never had cause to use it. Too specific for me to have
bothered learning just so I could know when to use it. :)
Josh
NP: Sergei Rachmaninov, _Symphony No. 1_
------------------------------
Date: 19 Jun 1998 12:55:20 GMT
From: "Pete Sattler" <psattler@bestweb.net>
Subject: Re: Using PERL to do a remote TELNET
Message-Id: <01bd9b79$88571b40$30695ed1@voyager>
Gorkem:
I've been through this one already! You cannot just talk to a TELNET
process without talking the TELNET protocol, which can get quite
cumbersome. As Tom Phoenix mentioned, the Net::Telnet module is an
excellent way to do this without getting involved in all the low level
stuff. It work great for me and is available via the CPAN.
Good luck!
Pete Sattler
Chase Manhattan Bank
Kenneth <kenkim@gncom.com> wrote in article
<6mbj85$qgj$1@demon.uunet.ca>...
> I am having some troubles getting perl in UNIX to telnet to a remote host
> and grab necessary information and then exit.. Maybe I am doing something
> wrong, but it won't even get to the LOGIN prompt before it exits.
>
> This is basically what I am doing:
>
> open (TEL,"|telnet somesite.com");
> while (<TEL>)
> {
> $dum = <TEL>;
> if ($dum =~ /login/i)
> {
> print TEL "username";
> }
> if ($dum =~ /pass/i)
> {
> print TEL "password";
> }
> print "$dum";
> }
>
>
> But all I seem to get from this is:
>
> Trying somesite.com..
> Connected to somesite.com...
> Escape Character is '^]'...
> Connection to host has been closed.
>
> Thanks for any info regarding this matter.
>
> Gorkem Yuksel
>
>
>
>
>
------------------------------
Date: 19 Jun 1998 08:22:07 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: what would be the best strategy for a port scanner? any ideas, i thought this would be fun :)
Message-Id: <6md73f$9bu@mozo.cc.purdue.edu>
Adam Lyons <alyons@wolffe.net> writes:
}what would be the best strategy for a port scanner? any ideas, i thought
}this would be fun :)
}i was thinking that in my exploration of perl and sockets programming, a
}good learning project would be a port scanner, if any one is interested
}and would like to help me make this please let me know, especially if it
}has been done.
Hotbot -> "port scanner" turned up some written in perl. (I can't
tell which ones are worthwhile, or even useful, but it looks like
there are some good leads, at least.)
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
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 2910
**************************************