[12761] in Perl-Users-Digest
Perl-Users Digest, Issue: 171 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 16 19:07:28 1999
Date: Fri, 16 Jul 1999 16:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 16 Jul 1999 Volume: 9 Number: 171
Today's topics:
Re: "cutting" part of a file <emschwar@rmi.net>
Re: cgi compiler <smiles@wfubmc.edu>
Re: cgi compiler <jcreed@cyclone.jprc.com>
Re: checking if variable is already a memeber of an arr (Abigail)
Re: checking if variable is already a memeber of an arr (Abigail)
Re: DNS question then sorting by values (Kevin Johnson)
Re: Garbage Collection Performance (Abigail)
Re: Hex dump (Larry Rosler)
Re: How do I find the current line-number while the scr (Abigail)
Re: How do you get rid of a remainder in a number (Abigail)
Re: How do you get rid of a remainder in a number (John Stanley)
Re: how to extract gzipped file into a list (Abigail)
IO::Socket Problem (Ryan Ngi)
Re: Linux - Apache - Perl (Tad McClellan)
Re: loop problems ?? (Abigail)
Re: My Foot Hurts (Tad McClellan)
Re: Padding numbers with 0's (Jason Stapels)
Re: Padding numbers with 0's <travis.cox@itron.com>
postscript postprocessor for simple search-and-replace? <d.memory@afpi.com>
Re: Printing to array (Abigail)
Re: Tiny error in perlfaq5 (I R A Aggie)
Re: Tiny error in perlfaq5 (Abigail)
Re: Tiny error in perlfaq5 (John Stanley)
Re: Tiny error in perlfaq5 (John Stanley)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Jul 1999 15:25:57 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: "cutting" part of a file
Message-Id: <xkf3dyojnh6.fsf@valdemar.col.hp.com>
"Dan Adams" <dan@fearsome.net> writes:
> Thanks for the link to ActivePerl. I actually had it briefly, but I had to
> reformat and my machine is on dialup at the moment (in the UK - call
> charges) so I can't really download it again.
Backup, backup, and backup your backups. :) Oh, and please be judicious
in your quoting; if you have to pay connect charges it'll save you.
Also, there's no need to play Jeopardy-- it's easier to read if you put
your responses after the text you're responding to.
> I read your reply, but I can't really see that it helps. I think that the
> WHILE part might be useful, but its what would go in inside that WHILE that
> would matter.
Well, yes. You're reading in one file, and want to print out two. I
assume you can open both files and print to them, so the hardest part
would then be figuring out when to start printing to the second file.
> maybe I didn't explain what I was trying to do. I have a text file that
> looks like this:
>
> "randomtextnonsense babble babble foobar babble foo <start> babble bar
> babble babble etc"
Assuming that's all on one line, you probably want to use a regex to
match the <start> and everything past it. Assuming your data is in $_,
then match it like this:
/^(.*)(<start>.*)$/;
If you don't understand what that does, read perlre until you do. There's
also _Mastering Regular Expressions_-- although Illya will tell you
(correctly) the book is way out-of-date, it'll at least teach you how to
use them, and you can learn the rest easily. There's also a web page
that teaches you how to use 'em, but you can presumably use deja.com to
find it, as it gets posted frequently on this very newsgroup.
If, OTOH, you have all those bits on separate lines, then you can just
compare $_ to "<start>" and write to your second file when that happens.
> What I need to do is essentially split the file in two - to make the
> original file into a file of the same name containing only everything up to
> <start> and then to make a seperate file out of everything including and
> forward of the "<start>". Sorry if I didn't communicate this very well. I
> just can't figure out how to do this. Is that same perldoc page still
> relevant, or should I be looking at a different section?
You're not thinking about the problem correctly. You're thinking about
it in terms of what a person using a word processor would do. Think
about how the computer would have to do it instead.
For instance: You can't just "make a file out of the rest". You have to
open a file, and write some data to it. You see the difference? That
particular FAQ still could help you, as it shows you how to alter a file,
in general. The difference is that instead of deleting the text after a
certain point, you want to write it to a different file. That should be
well within your abilities. :)
-=Eric
------------------------------
Date: Fri, 16 Jul 1999 17:36:42 -0400
From: Steve Miles <smiles@wfubmc.edu>
Subject: Re: cgi compiler
Message-Id: <378FA5EA.8F0F71B7@wfubmc.edu>
Climb under your covers, fall into a deep sleep, and dream - that's the only
way to compile Perl.
It's a scripting language that doesn't need to be compiled like C++. Perl
just needs an interpreter, which you
can download for Unix at any CPAN site or get for Windows at
www.activestate.com.
Steve
------------------------------
Date: 16 Jul 1999 18:22:34 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: cgi compiler
Message-Id: <a1k8s0grpx.fsf@cyclone.jprc.com>
Steve Miles <smiles@wfubmc.edu> writes:
> Climb under your covers, fall into a deep sleep, and dream - that's the only
> way to compile Perl.
Yes, it's not as if perl actually has a compilation phase or anything.
And B.pm is total fiction.
---Jason
------------------------------
Date: 16 Jul 1999 17:31:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: checking if variable is already a memeber of an array?
Message-Id: <slrn7ovckq.c9j.abigail@alexandra.delanet.com>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMCXLV September
MCMXCIII in <URL:news:378f62d1@cs.colorado.edu>:
## In comp.lang.perl.misc, Flash@pobox.com writes:
## :But in such cases, good programming practice
## :(unless there's a good reason to do otherwise) would be to use a language
## :primitive for array membership.
##
## C doesn't have this either, and for the same reason. "Array membership"
## makes little sense. Are you sure you know what an array is? Why do you
## want to encourage linear searches?
C doesn't have regexes, hashes or grep either. Does that mean we shouldn't
have had them in Perl?
I don't think the absense of a feature in some random other language makes
any difference on whether or not such a feature should be present in Perl.
After all, Perl is Perl, not some other language.
This of course doesn't mean that I think Flash has a case.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 17:38:29 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: checking if variable is already a memeber of an array?
Message-Id: <slrn7ovd26.c9j.abigail@alexandra.delanet.com>
Flash Sheridan (flash@pobox.com) wrote on MMCXLV September MCMXCIII in
<URL:news:7mnn2k$m16$1@samba.rahul.net>:
?? In article <slrn7ongtm.h7.abigail@alexandra.delanet.com>,
?? Abigail <abigail@delanet.com> wrote:
?? >Flash Sheridan (flash@pobox.com) wrote on MMCXLII September MCMXCIII in
?? ><URL:news:7mfoh2$sqv$1@samba.rahul.net>:
?? ><> In article <slrn7omg2s.h7.abigail@alexandra.delanet.com>,
?? ><> Abigail <abigail@delanet.com> wrote:
?? ><> >Artoo (r2-d2@REMOVEbigfoot.com) wrote on MMCXLII September MCMXCIII in
?? ><> ><URL:news:378b14d7.0@london.netkonect.net>:
?? ><> >**
?? ><> >** How can you check whether a variable is already a member of an array with
?? ><> >** out using any form of loop?
?? ><> >...
?? ><> >The answer is 'of course not'. What do you have against
?? ><> >loops anyway?
?? ><>
?? ><> They're unnecessarily complicated, and prone to programmer error,
?? ><> when used for what ought to be a language primitive. Or do you also
?? ><> eschew multiplication, in favor of addition in a loop?
?? >
?? >Silly analogon.
??
?? You're free to call it silly, of course, but do you have any actual evidence
?? that it doesn't apply?
Multiplication doesn't have to loop that often, does it? What more evidence
do you need? Or didn't you know that?
?? >You can call things a primitive all you want, fact is, you still need
?? >to loop.
??
?? No, the machine code may need to loop, _I_ don't. I was discussing Perl,
?? not machine code. In a high-level language, unless there's a good reason
?? to the contrary, I shouldn't have to worry about how multiplication or
?? membership is implemented.
So, if you just don't want to see an explicit loop, why not use map {}
or grep {}, or an eval? Or just close your eyes.
If I see map {}, I know it's a loop. If you create a new operator flash()
of which *you* claim doesn't loop, but behind the scenes, it still does,
it *is* a loop for me. Not calling it a loop, while it does loop, doesn't
make it not loop.
Abigail
--
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
for (??;(??)x??;??)
{??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 21:43:45 GMT
From: kevin@prism.ig.utexas.edu (Kevin Johnson)
Subject: Re: DNS question then sorting by values
Message-Id: <7mo92h$mll$1@geraldo.cc.utexas.edu>
Kevin Johnson (kevin@prism.ig.utexas.edu) wrote:
: Hi.
: I downloaded the Net::DNS package and can get some basic things
: to work. What I would like to do though, is search by IP address
: and pick up the reverse name lookup (ip.in-addr.arpa) When I
: try this, though I get
Hi again. I seem to be the only person interested in this, so I'll
keep replying to myself. :-)
I spent a day or so this week trying to do fast name lookups over
DNS. A little history. I have a log file (IIS format) with about
200K lines each with an IP address. I would like to find the domain
associated with that address and generate some statistics. I tried
various methods including gethostbyaddr and Net::DNS. I never did
get the method outlined by Michael Fuhr of doing multiple parallel
lookups to work, though admittedly I didn't spend a lot of time on
it. I did find that doing a system nslookup (on an NT system in this
case, though I found this to be true on Solaris also) was about 4
times faster than using the lookup provided by Net::DNS or
gethostbyaddr. Based on my limited research, there doesn't seem to
be a very efficient way to do lots of name lookups... so I wrote
the following code. This uses assoc. arrays to minimize redundant
lookups, though with this kind of data there is a large subset from
which to match. This is still pretty slow in my opinion (about 20
lookups per second on my configuration). If anyone has any advice
on what would be a better way to do this (or if you have advice on
how to improve the code) I would love to hear it. You can also
see the merits of my work at http://www.ig.utexas.edu/about/stats.htm
Thanks for any help.
Kevin
sub doNameLookup {
local($ClientHost)=@_;
if (! defined($ipToName{$ClientHost})) {
$ret=`nslookup $ClientHost`;
@lines=split(/^/,$ret);
@ent=split(/ /,$lines[3]);
if (defined($ent[1])) {
$ent[1] =~ y/A-Z/a-z/;
$ipToName{$ClientHost}=$ent[1];
# print $ipToName{$ClientHost},"\n";
}
else {
$ipToName{$ClientHost}="Non-existent domain";
}
}
if (defined($ipToName{$ClientHost})) {
if ($ipToName{$ClientHost} eq "Non-existent domain") {
$domainSums{$nomap}++;
}
else {
@parts=split(/\./,$ipToName{$ClientHost});
$last=$parts[$#parts];
$stl=$parts[$#parts-1];
chop($last);chop($sub);
$sub=join('.',$last,$stl);
$domainSums{$last}++;
$subdomainSums{$sub}++;
}
}
}
--
Kevin Johnson University of Texas
Systems Analyst Institute for Geophysics
------------------------------
Date: 16 Jul 1999 16:39:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Garbage Collection Performance
Message-Id: <slrn7ov9it.c9j.abigail@alexandra.delanet.com>
Jeremy Purdy (jerbyr@my-deja.com) wrote on MMCXLV September MCMXCIII in
<URL:news:7mn98q$e3v$1@nnrp1.deja.com>:
<>
<> The application uses the latest version of PERL available from CPAN,
<> 5.xxx with sybperl installed. It is running on a HP-UX system version
<> 10.20, and I believe that PERL uses its own malloc. I cannot post any
<> of the code here for security reasons, so if no one has encountered a
<> similar problem I guess I will be on my own again.
I don't remember the original question (perhaps I just missed it), but
I have memory problems with a Perl program that uses sybperl as well.
I've a monitoring program, that every minute connects to 20 SQL servers
and 10 backup servers to check their connectivity, and for the SQL
servers, query the server for number of user connections, cpu usage,
disk activity, free space in tempdb and number of processes in 'LOG
SUSPEND' state.
Initially, the program uses 5, 6 Mb. After 2 weeks or so, its memory usage
is up to 150 - 200 Mb, all but a few Mb swapped out. I've no idea where
the memory is leaking. It might be an error in my code (but I checked,
double checked, and triple checked), something in perl, a bug in sybperl
or in the Sybase libraries (I'm using libsybdb).
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 16 Jul 1999 14:11:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Hex dump
Message-Id: <MPG.11f93fd26fa8ea3989ce7@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7mnqrk$lt0$1@nnrp1.deja.com> on Fri, 16 Jul 1999 17:41:10
GMT, xdiv@hotmail.com <xdiv@hotmail.com> says...
> Is there a way in perl to get a hex dump of a binary string?
>
> For example, suppose I did:
>
> $s = pack("cci", 0x9, 0xff, 399);
>
> I want a routine that would take $s and return "09ff0000018f".
The routine is different for a big-endian or a little-endian machine.
The following tests the environment and then chooses one or the other.
I'd love to see a cleaner solution than this ugly business.
#!/usr/local/etc/perl -w
use strict;
my $s = pack("cci", 0x9, 0xff, 399);
print retrieve($s), "\n";
BEGIN {
my $big_endian = pack('N', 1) eq pack('L', 1);
sub retrieve {
join "" => $big_endian ? unpack 'H2 H2 H8', shift :
map { scalar reverse } unpack 'h2 h2 h8', shift
}
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 16 Jul 1999 16:42:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How do I find the current line-number while the script is running?
Message-Id: <slrn7ov9o9.c9j.abigail@alexandra.delanet.com>
Trond Michelsen (mike@crusaders.no) wrote on MMCXLV September MCMXCIII in
<URL:news:q3Dj3.101$nz6.349@news1.online.no>:
##
## Trond Michelsen <mike@crusaders.no> wrote in message
## news:NdCj3.67$nz6.124@news1.online.no...
## > I have a small problem. I have to make a small wrapper for the die()
## > function, so that instead of just dying, the program closes a database,
## > writes to a logfile, then removes a lockfile and finally just dies.
##
## Just typical isn't it... I've obviously looked through all the wring parts
## of the docs. Anyway - the first thing I read after posting my question is
## chapter 10.4 of the Perl Cookbook.
##
## Well, well - at least I know how to use the caller() function now :-)
You mean, the Cookbook didn't mention $SIG {__DIE__}?
Abigail
--
perl -wlne '}for($.){print' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 17:47:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How do you get rid of a remainder in a number
Message-Id: <slrn7ovdip.c9j.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCXLV September MCMXCIII in
<URL:news:MPG.11f903138d8c2911989ce3@nntp.hpl.hp.com>:
;; In article <7mnmrn$2ql5$1@news2.vas-net.net> on Fri, 16 Jul 1999
;; 17:29:43 +0100, Chris Denman <chris@inta.net.uk> says...
;; > My mistake, $number should have been in brackets.
;; >
;; > You are wrong about INT though, it rounds the number up or down.
;;
;; You are wrong about int() though. It truncates the number toward zero.
Isn't that about as often up as down?
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 23:01:49 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: How do you get rid of a remainder in a number
Message-Id: <7modkt$iqm$1@news.NERO.NET>
In article <slrn7ovdip.c9j.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Larry Rosler (lr@hpl.hp.com) wrote on MMCXLV September MCMXCIII in
>;; You are wrong about int() though. It truncates the number toward zero.
>
>Isn't that about as often up as down?
Only if you are dealing with negative numbers as often as you are
positive ones. Contrast "round" with "truncate".
------------------------------
Date: 16 Jul 1999 16:45:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: how to extract gzipped file into a list
Message-Id: <slrn7ov9u4.c9j.abigail@alexandra.delanet.com>
MS (mika.stahlberg@dlc.fi) wrote on MMCXLV September MCMXCIII in
<URL:news:7mnbdb$53d@idefix.eunet.fi>:
|| The subject says it about all. File is gzipped text file. Didn't find any
|| examples about this and being newbie in perl...
man gzip.
Of course, this has little to do with Perl.
Followups set.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 16 Jul 1999 21:11:55 GMT
From: ryanngi@hotmail.com (Ryan Ngi)
Subject: IO::Socket Problem
Message-Id: <378f9dad.9197321@news.inet.co.th>
$sock = new IO::Socket::INET(PeerAddr => "hanumarn.stanford.edu",
PeerPort => 80, Timeout => 15) or return "ERROR";
i use this part script to call for an other server cgi...
when the server(hanumarn.stanford.edu) went down...
my script must took very long time to say that it's fail to connect..
i've used "Timeout => 15".. but the real Timeout isn't 15 it's longer
longer....
how can i fix this!?
------------------------------
Date: Fri, 16 Jul 1999 12:02:37 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Linux - Apache - Perl
Message-Id: <t2lnm7.ilo.ln@magna.metronet.com>
JT (jett1not@homedot.com) wrote:
: On Thu, 15 Jul 1999 13:11:43 -0400, tadmc@metronet.com (Tad McClellan)
: wrote:
: >JT (jett1not@homedot.com) wrote:
: >
: >: I realize it's off-topic, but it's a simple question -
: >: what's the big deal?
: >
: >
: > Well if we are not going to respect topics, lets have a
: > single newsgroup with hundreds of thousands of articles
: > each day.
: >
: > Then everybody would know where to go, but
: > they couldn't find anything when they got there.
: >
: > You are not alone. There are thousands of people available for
: > making off-topic postings. Let's not encourage them to jump in.
: I agree with you, but if it's a question that can be easily answered
: in a one-liner, what's the huge deal?
Then "people" will see that asking an off-topic one-liner
in clpmisc will *get them their answer*.
There is, unfortunately, plenty of folks here that don't give
a rat's ass about what is proper, correct, or well-mannered.
They just want the answer to their question damn it.
We don't want them thinking that dumping their off-topic
question here will be effective.
You don't give a dog a biscuit when they bite the neighbor
(unless you don't like the neighbor). You reward them
when they Do Right not when they Do Wrong.
: The question was answered and
: the guy apologied and let it die. It's the same amount of "wasted"
: bandwidth as a "RTFM" reply takes anyhow.
As I already said, the issue is not this particular single
off-topic question.
The issue is that Idiots will do it if they see that it "works".
If they see that they never get an off-topic answer here, then
they won't be encouraged to ask off-topic questions here.
: If anyone's gonna bother
: replying, why not throw in the answer along with "Read the FAQ, or
: RTFM". That way the poster would learn 2 things.
No, that way the poster will read the quoted part of the FAQ,
and forget about it.
If they look it up themselves, then they can find the FAQs
the next time they have a question. And the next. And the next...
You can be a "give them a fish" proponent if you want, but most
of The Regulars are more of the "teach them how to fish" school.
It is better for the newsgroup in the long run.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Jul 1999 16:48:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: loop problems ??
Message-Id: <slrn7ova4q.c9j.abigail@alexandra.delanet.com>
Tad McClellan (tadmc@metronet.com) wrote on MMCXLV September MCMXCIII in
<URL:news:84omm7.i2n.ln@magna.metronet.com>:
== stu7@usa.net wrote:
==
== : but inside an if loop,
==
==
== What is an "if loop"?
If: print "."; goto If;
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 16 Jul 1999 12:05:49 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: My Foot Hurts
Message-Id: <t8lnm7.ilo.ln@magna.metronet.com>
Michel Dalle (michel.dalle@usa.net) wrote:
: In article <hUVx3CAFWdj3QwBO@shambolica.freeserve.co.uk>, Don Coyote <Coyote@shambolica.freeserve.co.uk> wrote:
: (BTW, Perl is also supposed to run on horses, but I haven't seen it yet.)
^^^^^^^^^
I thought it was dogs, not horses.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Jul 1999 21:13:16 GMT
From: jmstapel_n0spam@mtu.edu (Jason Stapels)
Subject: Re: Padding numbers with 0's
Message-Id: <7mo79c$tj$1@campus1.mtu.edu>
: Did you bother to read the documentation for the localtime function
: before posting this question? It will tell you what to do. Hint: It's
: a lot simpler than the stuff you posted.
Wow, where did that -1900 come from... I must have dozed off for a second.
:) Thanks a bunch.
: The format '%.2d' forces at least two digits, with a leading zero to pad
: to two digits if necessary. This is discussied in the documentation for
: the sprintf function.
I thought that was just for the decimals... hehe, thanks for not flaming me
on that one.
Jason
------------------------------
Date: Fri, 16 Jul 1999 15:09:31 -0700
From: "TravisC" <travis.cox@itron.com>
Subject: Re: Padding numbers with 0's
Message-Id: <7moa8j$oc9$1@bayer.itron.com>
Jason Stapels wrote in message <7mo0cr$l5p$1@campus1.mtu.edu>...
>
>Forgive me for what seems like such a simple question, but whats
>an easy way to pad 0 (zero)'s infront of a number.
The simplest way to create a fixed length number with leading zeros
would be to do something like.
printf "%04d%02d%02d\n",$year,$month,$day;
------------------------------
Date: Fri, 16 Jul 1999 17:45:06 -0500
From: Dave Memory <d.memory@afpi.com>
Subject: postscript postprocessor for simple search-and-replace?
Message-Id: <378FB5F2.F16D0057@afpi.com>
I'm trying to get HTML documents to print from MSIE with inserted page
breaks instead of the "fill the page" technique that most browsers use.
I am limited to strict HTML 3.2 code and therefore can't use CSS.
I was wondering if my best bet would be to find the "%%Page" and
"showpage" elements in the .ps file and remove them, and place them at
my horizontal rule that I use to separate pages...
If that's a good idea, I need help with the coding of the postprocessor
to perform these functions. I only know a little PERL and no other
languages, so a little help would be lovely.
Any ideas?
--Dave
d.memory@afpi.com
------------------------------
Date: 16 Jul 1999 17:01:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Printing to array
Message-Id: <slrn7ovatm.c9j.abigail@alexandra.delanet.com>
Eoan Kerr (eoan.kerr@gssec.bt.co.uk) wrote on MMCXLV September MCMXCIII
in <URL:news:7mmul1$3ne@cheetah.gssec.bt.co.uk>:
== Hello,
==
== Can anyone advise how to change this:
==
== print table ({-border=>undef,-width=>'80%'},
== caption(b('Search Results!')),
== Tr(\@rows)
== );
==
== So that it prints to an array @html.
Easy.
local *ARRAY;
open ARRAY, '> /dev/array/@html' or die "Failed to open device: $!";
flock ARRAY, 2 or die "Failed to flock device: $!";
print ARRAY table ( ... );
close ARRAY;
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 21:15:50 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Tiny error in perlfaq5
Message-Id: <slrn7ov8cf.m7c.fl_aggie@thepentagon.com>
On Fri, 16 Jul 1999 20:21:05 GMT, John Borwick <John.Borwick@sas.com>, in
<379d93f2.115901667@newshost.unx.sas.com> wrote:
+ I like your solution. I would fix it myself, except it's in the FAQ.
% perlbug
This program provides an easy way to create a message reporting
a bug in perl...It is *ONLY* a means of reporting verifiable
problems with the core perl distribution, and any solutions to
such problems, to the people who maintain perl.
<snip>
I believe the FAQs fall under this...
James
------------------------------
Date: 16 Jul 1999 17:23:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Tiny error in perlfaq5
Message-Id: <slrn7ovc5t.c9j.abigail@alexandra.delanet.com>
John Borwick (John.Borwick@sas.com) wrote on MMCXLV September MCMXCIII in
<URL:news:379a24d7.87456635@newshost.unx.sas.com>:
^^
^^ It would be nice to somehow iterate as needed until rand is not zero.
Well, that's trivial, isn't?
do {my $r; "Abigail" until $r = rand 1000; $r};
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Jul 1999 22:53:04 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Tiny error in perlfaq5
Message-Id: <7mod4g$ifs$1@news.NERO.NET>
In article <379c9395.115808313@newshost.unx.sas.com>,
John Borwick <jobosw@unx.sas.com> wrote:
>On 16 Jul 1999 16:51:16 GMT, stanley@skyking.OCE.ORST.EDU (John
>Stanley) wrote:
>>funtion is 0, 1 is used instead. I suppose that is because "rand(0)"
>>would otherwise always return 0 and that isn't a very random sequence at
>>all.
>
>Doesn't replacing the occurrence x=0 with x=1 make the value less
>random?
Well, let's think about this for a minute. The result of rand(x) is a
number greater than or equal to zero and less than x. So, for rand(1),
with a 15 bit rand, there will be a possible 32000 different numbers from
0 to one.
Now, if you actually performed rand(0), your result would be a number
greater than or equal to 0 and less than 0. There is no number that
meets that criterion, not even zero. You get the same answer every time.
How random is that?
>Also the range is supposed to be from the CLOSED interval 0 upwards,
>so 0 is *supposed* to be a possibility, as I understand.
The range of WHAT is 0 upwards? Why, the RESULT of the rand call. I'm
talking about what the code does with the PARAMETER passed to the rand
function, not the result you get back.
------------------------------
Date: 16 Jul 1999 22:59:34 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Tiny error in perlfaq5
Message-Id: <7modgm$ipt$1@news.NERO.NET>
In article <378f97e5.473453@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>I understood what you said as "if it returns 0, now it will return 1".
The 'x' in rand(x) is not what rand returns, it is the parameter you
pass to rand.
>Which *would* have been related to the thread. You seem to be jumping to
>another subject, which confused me. I'm still not sure why you brought
>it up.
I didn't bring it up. Mike Guy did by talking about what rand(x) returns
unless x is something silly.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 V9 Issue 171
*************************************