[12704] in Perl-Users-Digest
Perl-Users Digest, Issue: 113 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 11 19:07:12 1999
Date: Sun, 11 Jul 1999 16:05:07 -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 Sun, 11 Jul 1999 Volume: 9 Number: 113
Today's topics:
Re: Changing case local-specifically (Larry Rosler)
Re: Changing case local-specifically (Abigail)
Re: checking Perl offline <tchrist@mox.perl.com>
Re: date format <cassell@mail.cor.epa.gov>
Re: date format (Tad McClellan)
Re: date format (Larry Rosler)
Re: extracting domains from whois query <gellyfish@gellyfish.com>
Re: extracting domains from whois query (Larry Rosler)
Re: FAQ 5.25: How can I read in a file by paragraphs? <cassell@mail.cor.epa.gov>
grep with empty list <janning@vygen.de>
Re: Help! My pingecho to Linux is going pong! (Anno Siegel)
Re: How secure is my Perl code on the web? <gellyfish@gellyfish.com>
Re: How to dereference an array reference? <anonymous@web.remarq.com>
Re: How to dereference an array reference? (Abigail)
Re: How to dereference an array reference? (Abigail)
Re: Idiot requires help <gellyfish@gellyfish.com>
Re: Ignoring the first line of a file <cassell@mail.cor.epa.gov>
Re: input comma(,) between three numbers ? (Abigail)
Re: open+0 (Abigail)
Re: open+0 (Anno Siegel)
Re: regex to eat all html tags (Abigail)
Re: single instance log file (Anno Siegel)
trying to read a variable? <tfiedler@ptd.net>
Re: trying to read a variable? (Saku Ytti)
Re: trying to read a variable? (Ronald J Kimball)
Re: url extraction without HTML::LinkExtor module <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 11 Jul 1999 15:09:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Changing case local-specifically
Message-Id: <MPG.11f2b5d9b0c95bf1989ca2@nntp.hpl.hp.com>
In article <7mal7d$61$1@fcnews.fc.hp.com> on 11 Jul 1999 17:45:17 GMT,
Jack Applin <neutron@fc.hp.com> says...
...
> my @left = grep /\w/, map chr, 0..0xFF;
>
> This assures that @left doesn't contain /, only alphanumerics and _.
Nice call, Jack, letting the locale specification decide what are
alphanumerics, not the ASCII specification (as I did).
At the cost of a few more key-strokes, you can save a trivial amount of
time processing even the digits and _, using '/[^\W\d_]/'; and don't
forget to take out all those pesky spaces that caused me so much grief,
using 'local $" = "";'.
PS to the unwary: Don't take any of that seriously. Optimizing this
initialization won't make a bit of difference in any real program.
> Here's what I'm going with:
>
> use locale;
>
> BEGIN {
> my @left = grep /\w/, map chr, 0..0xFF;
> my @right = map {uc ne $_ ? uc : lc} @left;
> eval "sub flip(\$) { \$_[0] =~ tr/@left/@right/ }";
> die $@ if $@;
> }
So you have come full circle, from "I'd like to do one whopping tr for
the entire string, but constructing the tr and eval'ing it would be
ugly." to embracing it with a neat construction. And I have come full
circle from idiocy to enlightenment (at least in one small area).
Good thread!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 11 Jul 1999 18:04:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Changing case local-specifically
Message-Id: <slrn7oi8ms.h7.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCXL September MCMXCIII in
<URL:news:MPG.11f2b5d9b0c95bf1989ca2@nntp.hpl.hp.com>:
|| In article <7mal7d$61$1@fcnews.fc.hp.com> on 11 Jul 1999 17:45:17 GMT,
|| Jack Applin <neutron@fc.hp.com> says...
|| ...
|| > my @left = grep /\w/, map chr, 0..0xFF;
|| >
|| > This assures that @left doesn't contain /, only alphanumerics and _.
||
|| Nice call, Jack, letting the locale specification decide what are
|| alphanumerics, not the ASCII specification (as I did).
But a locale may use '/' as a character, or not? Otherwise, if we start
making assumptions:
sub flip {
$_ [0] =~ /(\w)/" " ^ $1/ge;
}
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== 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: 11 Jul 1999 15:22:40 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: checking Perl offline
Message-Id: <37890b20@cs.colorado.edu>
In comp.lang.perl.misc,
miker3@ix.netcom.com (Michael Rubenstein) writes:
:<usual Christeansen foaming at the mouth elided>
^^^^^^^^^^^^
That's a curious elision, but I suppose that today being Sunday and all
that it's the day for such things. :-)
Hm... you know, I can't imagine whom you might be referring to up there.
Perhaps you might consult the OED.
Much though it would do to explain your support for flimsy whimsy, I
assume of course that you aren't really so orthographically challenged
as you would have us all believe, and that this defect was in fact a
thinly disguised troll. I do hope you're happy.
:It is an offense when it gets in the way of communication.
:Everyone knew what Stephen meant -- he was talking about being
:offline from a specific computer.
Just because the clever reader or listener might sometimes manage through
a feat of good guesswork to infer what someone really meant when they
mistakenly used imprecise or inaccurate terminology, this does not
thereby imply that the latter individual really said what they meant,
nor does it follow that they should never be informed of their error.
Example 1:
"What a beautiful baby girl! What's her name?"
"He's not a girl, and his name is Floyd."
Example 2:
"However do you manage to grow such beautiful violets?"
"Those aren't violets; they're roses, and my florist visits weekly."
Example 3:
"Pardon me sir, but does your dog bite?"
"Why no, madam, he doesn't."
<PETPET> <SNARL> <CRUNCH> <SCREAM> <BLEED>
"I thought you said that your dog doesn't bite!"
"I did; that's not my dog."
Eureka! I've figured it all out now. You actually work for Sun
Microsystems, which means that as soon as you "logoff" the "internet",
the "computer" is no longer there!
--tom
--
"One planet is all you get."
------------------------------
Date: Sun, 11 Jul 1999 14:18:21 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: date format
Message-Id: <37890A1D.B26BB758@mail.cor.epa.gov>
hoz wrote:
>
> sorry for the multiple posting...its been one of those days....
> how do I in perl get a date format (YYYYMMDD) that resembles this is
> shell `date +%Y%m%d`
> I've tried localtime and system to no luck....seems like a no brainer
> but sometimes....
The POSIX module has strftime() if you don't want to do it
yourself using localtime() in list context with a printf()
to get the formatting...
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 11 Jul 1999 12:29:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: date format
Message-Id: <uogam7.gqa.ln@magna.metronet.com>
hoz (hoz@rocketmail.com) wrote:
: how do I in perl get a date format (YYYYMMDD) that resembles this is
: shell `date +%Y%m%d`
my ($mday,$mon,$year) = (localtime)[3..5];
my $date = sprintf "%d%02d%02d", $year+1900, $mon+1, $mday;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 11 Jul 1999 15:52:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: date format
Message-Id: <MPG.11f2c01243f31755989ca4@nntp.hpl.hp.com>
In article <slrn7ohr0o.qip.saku.eisikanautaa@ytti.net> on 11 Jul 1999
19:10:08 GMT, Saku Ytti <saku.eisikanautaa@ytti.net> says...
> On Mon, 12 Jul 1999 02:47:57 GMT, hoz <hoz@rocketmail.com> wrote:
>
> >how do I in perl get a date format (YYYYMMDD) that resembles this is
> >I've tried localtime and system to no luck....seems like a no brainer
> >but sometimes....
>
> perl -e '($d,$d,$d,$d,$m,$y)=localtime();print$y+1900,$m+1,$d,"\n";'
> hth.
Well, it might be hard to distinguish January 11 from November 1,
though:
1999111
Use printf to zero-pad month and day to two characters.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 11 Jul 1999 10:11:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: extracting domains from whois query
Message-Id: <7m9ql0$3gn$1@gellyfish.btinternet.com>
On Sun, 11 Jul 1999 06:46:35 GMT webmaster@inlandpac.com wrote:
> OK. I am trying to perform a whois '$name.' and extract the domains
> that are output as $results.
>
> I am going to take $results, extract all domains set as @domains
> and perfom a foreach type output.
>
> For example, if I do the query for 'pepsi.', I get this (shortened
> version):
>
> Pepsi-Online.org (PEPSI-ONLINE2-DOM) PEPSI-ONLINE.ORG
>
> I want to extract only the list on the right hand side (the domains).
>
The fields are separated by tabs - you can use split /\t+/ to do this -
you might be left with some leading whitespace on the domains: how to
remove this is covered in the FAQ.
Bear in mind this will probably not work with whois records that use the
RIPE format - or rather will probably only work with INTERNIC format.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 11 Jul 1999 15:34:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: extracting domains from whois query
Message-Id: <MPG.11f2bbdc5bd1e34c989ca3@nntp.hpl.hp.com>
In article <pbv9m7.tga.ln@magna.metronet.com> on Sun, 11 Jul 1999
07:32:09 -0400, Tad McClellan <tadmc@metronet.com> says...
...
> my @domains = grep s/.* //, <DATA>;
> chomp @domains;
> foreach (@domains) {
> print "$_\n";
> }
That chomp, etc. is a singularly longwinded and inefficient way to do:
print @domains;
Maybe we need an award for the Perl-golf losers as well. :-)
I rather like this one-liner, which might win at golf and would work
well from the command line too:
print map /(\S+\n)/, <DATA>;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 11 Jul 1999 14:07:58 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom and Gnat <perlfaq-suggestions@perl.com>
Subject: Re: FAQ 5.25: How can I read in a file by paragraphs?
Message-Id: <378907AE.90AA5632@mail.cor.epa.gov>
[cc mailed to perlfaq-suggestions]
Tom Christiansen wrote:
> [snip of good stuff]
> Note that a blank line must have no blanks in it. Thus `"fred\n
> \nstuff\n\n"' is one paragraph, but `"fred\n\nstuff\n\n"' is two.
Note that a blank line must have no blanks in it. Thus
`"fred\n \nstuff\n\n"' is one paragraph, but
`"fred\n\nstuff\n\n"' is two.
The line break in the text makes it difficult for anyone who
*needs* to read this to be able to grok it. IMHO, of course.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 11 Jul 1999 23:39:21 +0200
From: Janning Vygen <janning@vygen.de>
Subject: grep with empty list
Message-Id: <37890F09.7F14241A@vygen.de>
it seems that i am a little bit confused on how grep works.
look at these examples:
@array = ();
$hits = grep /baz/, @array;
print "1: $hits", "\n";
@array = ('foo', 'bar');
$hits = grep /baz/, @array;
print "2: $hits", "\n";
in the camel book chapter 3 (translated back to english, sorry):
'in scalar context grep returns the amount of hits'
so why does it return 'undef' in part one and '0' in part two??
greetings,
Janning
------------------------------
Date: 11 Jul 1999 21:20:05 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help! My pingecho to Linux is going pong!
Message-Id: <7mb1q5$abu$1@lublin.zrz.tu-berlin.de>
Rusty Williamson <rwilliamson@uno.gers.com> wrote in comp.lang.perl.misc:
>Hi Anno!
>
>Thanks for getting back on this. Well, that's a bummer. However, for this
>particular implementation users will be running as root so what 'newer ping
>objects' were you referring to?
I mailed the following reply, but it bounced.
This would be Version 2.02 of the Net::Ping module. It comes with
perl 5.005_03 but should run from 5.002 upward. Here, the pingecho()
function is only carried for compatibility. This is how I tested:
#!/usr/bin/perl -w
use strict;
use Net::Ping;
my $host = 'lublin.zrz.tu-berlin.de'; # this is a linux box
my $echo = pingecho( $host);
my $p = Net::Ping->new( 'icmp');
my $ping = $p->ping($host);
$p->close();
print "echo $echo, ping: $ping\n";
__END__
Output:
echo 0, ping: 1
Anno
------------------------------
Date: 11 Jul 1999 10:17:16 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How secure is my Perl code on the web?
Message-Id: <7m9qvc$3gq$1@gellyfish.btinternet.com>
On Sat, 10 Jul 1999 20:38:48 -0400 Brian Wagener wrote:
> I understand what you mean, but in this case it everything to do with using
> a scripting language like Perl. So can you or not see the cgi code that is
> being used on the web.
>
I think you have failed to understand - the answer would be the same if
the program was in some compiled language - if the *server* is configured
properly then the actual program file is not available.
Anyhow there was a long thread on this very subject recently - I would look
it up on Dejanews <http://www.deja.com>
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 11 Jul 1999 13:34:38 -0800
From: theoddone33 <anonymous@web.remarq.com>
Subject: Re: How to dereference an array reference?
Message-Id: <931728880.15993@www.remarq.com>
>>I've never heard of anyone taking offense to spam-
>>proofing.
>
>It isn't clear just what form that would take in most
>newsgroups. In a lot of them, if you ask a question with
>a spam-blocked address they just won't
>reply to you...
A good point. Restatement: "This is the first newsgroup
I've been in where people actively post against the
practice of spam-proofing one's email address"
Still, before yesterday, I had never heard of this
attitude. If a newsgroup is against spam-proofing, it
should at least be stated in the newsgroup's FAQ, and not
exist only as some unwritten rule whose violators are
ignored or banished.
>> ...seems to me that it's a
>> widespread thing across Usenet.
>
>It is. A testament to varying skills and sensibilities.
>Actually filtering spam "locally" [that is, in your mail
>client] isn't all that hard, but there are a lot of folk
>who shrink in horror at the very thought of getting
>_even_one_ unsolicited message, and so violate the RFCs and
>"spamblock".
Very interesting stuff. I was unaware that the RFCs
would advise against spam-proofing. Another RFC I saw also
brought up the fact that the law might view spam-proofing
as forging email. That's a pretty big "might" though.
Still, RFCs are not laws and have no punishments attached
to them. The average Usenet poster, if they even know of
the existence of RFCs, will most likely not read them, and
will still be unaware that there are people who dislike
spam-proofing.
RFCs aside, I still maintain that if a newsgroup dislikes
the practice, they should state it in their FAQ, due to the
fact that the practice is so common.
>IMO, it generally betrays the "blocker" as either an
>incompetent [who can't figure out how to
>filter/sort/folderize their incoming email, a skill
>everyone needs to learn and use sooner or later, even if
>there were no spam] or a lot farther out on the
>sensitivity scale than I am...
Everyone who spam-proofs has a different reason, be it
bandwagon, practicality, laziness, convenience, or as you
suggest, incompetence. Many of these reasons may be
perfectly valid. Filtering software is not omniscient and
may filter out non-spam. Receiving a large amount of spam
may take a long time to download for those of us cursed
with a 28.8 modem. By spam-proofing, both of the above
scenarios can be avoided.
As to spam-proofing throwing off humans who wish to help,
the practice is designed to fool a bot, not a human. It
may indeed be a way of saying "You must be *this*
intelligent to send me email." You never know.
theoddone33
PS - Put it in the FAQ!!!
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
------------------------------
Date: 11 Jul 1999 17:04:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to dereference an array reference?
Message-Id: <slrn7oi574.h7.abigail@alexandra.delanet.com>
theoddone33 (anonymous@web.remarq.com) wrote on MMCXL September MCMXCIII
in <URL:news:931728880.15993@www.remarq.com>:
"" >>I've never heard of anyone taking offense to spam-
"" >>proofing.
"" >
"" >It isn't clear just what form that would take in most
"" >newsgroups. In a lot of them, if you ask a question with
"" >a spam-blocked address they just won't
"" >reply to you...
"" A good point. Restatement: "This is the first newsgroup
"" I've been in where people actively post against the
"" practice of spam-proofing one's email address"
But didn't you also recently say you had checked out a whopping 4 other
newsgroups? I don't think that entitles you to draw any conclusions about
Usenet in general. Tell me, did you read any of the groups in news.*?
"" Still, before yesterday, I had never heard of this
"" attitude. If a newsgroup is against spam-proofing, it
"" should at least be stated in the newsgroup's FAQ, and not
"" exist only as some unwritten rule whose violators are
"" ignored or banished.
Huh? Address munging is the special case. Groups allowing address
munging will tell that in the FAQ. Normal case behaviour doesn't have
to be repeated.
"" Everyone who spam-proofs has a different reason, be it
"" bandwagon, practicality, laziness, convenience, or as you
"" suggest, incompetence. Many of these reasons may be
"" perfectly valid. Filtering software is not omniscient and
"" may filter out non-spam. Receiving a large amount of spam
"" may take a long time to download for those of us cursed
"" with a 28.8 modem. By spam-proofing, both of the above
"" scenarios can be avoided.
Get out of here. I've been reading Usenet for more than a decade. I am
currently reading and posting on Usenet using different email addresses,
and I still get spam on email addresses I haven't used for posting in over
3 years. But I've never gotten so much spam that it becomes a significant
part of the traffic. A weeks worth of postings in this group *dwarves*
the spam I get in a year. Go to your average website and the size of the
inline images takes more traffic than a month of spam.
Spam is a problem. Address-munging isn't the answer.
"" As to spam-proofing throwing off humans who wish to help,
"" the practice is designed to fool a bot, not a human. It
"" may indeed be a way of saying "You must be *this*
"" intelligent to send me email." You never know.
My newsreader isn't as smart as a bot.
"" PS - Put it in the FAQ!!!
No. Just killfile the address-mungers.
Abigail
--
perl -wlne '}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: 11 Jul 1999 17:07:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to dereference an array reference?
Message-Id: <slrn7oi5ca.h7.abigail@alexandra.delanet.com>
Calvin (citidancer@hongkong.com) wrote on MMCXL September MCMXCIII in
<URL:news:7m9o3i$56u$1@hfc.pacific.net.hk>:
!! Hi,
!! This is the first newsgroup that people don't like spam proofed e-mail.
!! I see nothing wrong with it. Am i hurt anyone by using spam proofed e-mail
!! address? I am just protecting myself from spammers. I even don't know the
!! FAQ will arrive in my mail box if i use a real address (before u told me).
So, doesn't that give you a big hint on who you might be hurting?
Could it be ...... *yourself*?
!! Finally, please don't reply to this message on the news server. If you
!! have something want let me know, just send it to my mail box
!! (citidancer@hongkong.com) .
That's why there's a 'Reply-To' header.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== 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: 11 Jul 1999 10:21:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Idiot requires help
Message-Id: <7m9r7v$3h0$1@gellyfish.btinternet.com>
On Sat, 10 Jul 1999 19:03:23 +0100 Tony wrote:
> OK- maybe not such an idiot, at least I know where to ask for help !
>
Let us be the judge of that ...
> This is it - I am a designer - not a programmer.
> I'm working for a small company and we don not have a perl genius handy
> when wee need one - like now...
> I have a task which I "think" is very simple to accomplish assuming you
> know
> where to start, how to proceed, and when you'er finished.
> Like if you know how...
> And we don't.
> So, if there is a kindly soul, who would like to offer some very
> basic advice on a very simple topic to some idots,
Sorry what was it that you wanted ?
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 11 Jul 1999 14:39:19 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Ignoring the first line of a file
Message-Id: <37890F07.B6B7473E@mail.cor.epa.gov>
David Cassell wrote:
> [snip of usual drivel]
>
> > next if $.=1;
^^^^ <----------!!!!!
> > tr/\cM//d;
>
> These look good, subject to my comments above.
D'OH! What a loser. Thanks, Uri.
Just what I get for programming in another language on Slowlaris
while answering questions in this ng on a win32 box. I guess
my multi-tasking operating system wasn't up to running this
many threads simultaneously. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 11 Jul 1999 17:10:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: input comma(,) between three numbers ?
Message-Id: <slrn7oi5h7.h7.abigail@alexandra.delanet.com>
Yeong Mo/Director Hana co. (factory@factory.co.kr) wrote on MMCXL
September MCMXCIII in <URL:news:7mautu$i2$1@news1.kornet.net>:
|| Hi,
||
|| Anyone know how to input comma(,) between three numbers ?
||
|| For example;
||
|| If there is 1542000000, change to 1,542,000,000
if ($number == 1542000000) {
print "1,542,000,000")
}
else {
read "The FAQ";
}
Abigail
--
sub A::TIESCALAR{bless\my$x=>A};package B;@q=qw/Hacker Another
Perl Just/;use overload'""'=>sub{pop @q};sub A::FETCH{bless\my
$y=>B}; tie my $shoe => 'A';print "$shoe $shoe $shoe $shoe\n";
-----------== 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: 11 Jul 1999 17:53:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: open+0
Message-Id: <slrn7oi821.h7.abigail@alexandra.delanet.com>
Kai Henningsen (kaih=7Kg9-uhHw-B@khms.westfalen.de) wrote on MMCXL
September MCMXCIII in <URL:news:7Kg9-uhHw-B@khms.westfalen.de>:
%% abigail@delanet.com (Abigail) wrote on 08.07.99 in <slrn7oav7l.5k.abigail@alexandra.delanet.com>:
%%
%% > Hah! Except me. I always start my programs with $[ = 7.
%% >
%% >
%% >
%% > Abigail
%% > --
%% > package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
%% > print } sub __PACKAGE__ { &
%% > print ( __PACKAGE__)} &
%% > __PACKAGE__
%% > ( )
%%
%% Hmm. Hmmhmm. Why does this work with $[=7?
Magic.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== 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: 11 Jul 1999 23:04:38 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: open+0
Message-Id: <7mb7u6$al2$1@lublin.zrz.tu-berlin.de>
Kai Henningsen <kaih=7Kg9-uhHw-B@khms.westfalen.de> wrote in comp.lang.perl.misc:
>abigail@delanet.com (Abigail) wrote on 08.07.99 in <slrn7oav7l.5k.abigail@alexandra.delanet.com>:
>
>> Hah! Except me. I always start my programs with $[ = 7.
>>
>>
>>
>> Abigail
>> --
>> package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
>> print } sub __PACKAGE__ { &
>> print ( __PACKAGE__)} &
>> __PACKAGE__
>> ( )
>
>Hmm. Hmmhmm. Why does this work with $[=7?
A picture of a lobster is a picture of a lobster, no matter what $[. Duh.
Anno
Or is it a tank?
------------------------------
Date: 11 Jul 1999 17:57:44 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: regex to eat all html tags
Message-Id: <slrn7oi8ag.h7.abigail@alexandra.delanet.com>
Kai Henningsen (kaih=7KgA0-5Hw-B@khms.westfalen.de) wrote on MMCXL
September MCMXCIII in <URL:news:7KgA0-5Hw-B@khms.westfalen.de>:
;; abigail@delanet.com (Abigail) wrote on 06.07.99 in <slrn7o59qa.tch.abigail@alexandra.delanet.com>:
;;
;; > Here are a few things where your simplistic approach fails utterly:
;; >
;; > <IMG SRC = "a_greater_b.gif" ALT = "a > b">
;; > <!-- <IMG SRC = "foo.gif"> -->
;; > We break a line using <[CDATA [ <br> ]]>
;; > <# This is text, not a tag #>
;; > <SCRIPT>document.write ("<BR>")</SCRIPT>
;;
;; Hmmm ... what would be needed to make that legal?
Needed to make what legal? You mean the above 5 lines and how to turn
that into legal HTML? For starters, you need to provide a DTD. And
then you have to put in the required elements as well.
Followups set.
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== 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: 11 Jul 1999 22:19:33 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: single instance log file
Message-Id: <7mb59l$afh$1@lublin.zrz.tu-berlin.de>
Scott Skinner <sskinner@cloud9.net> wrote in comp.lang.perl.misc:
>In article <37863F65.F4421E16@mail.cor.epa.gov>, David Cassell
><cassell@mail.cor.epa.gov> wrote:
[...]
>To be honest, I really just assumed Anno was some kind of Perl bot that
>automatically kicks in with smug comments whenever someone posts. Am I
>wrong?
>
>I am not a Perl Jedi, but neither is Anno--particularly since he doesn't
>know the difference between the various flags of the open function.
I know Perl's various open modes quite well, thanks. If you intend
to read a file to the end, and then potentially append to it, your
open mode is "+<". No need for a seek. Here's what you might have
done:
#!/usr/bin/perl -w
$file = '/tmp/xxx';
$this_agent = 'rst';
open ( F, "+<$file") or die "Can't open $file r/w: $!\n";
@items = <F>;
chomp @items;
if ( not grep $_ eq $this_agent, @items ) {
print F "$this_agent\n";
print "appended '$this_agent'\n";
} else {
print "'$this_agent' already on file\n";
}
As for being unfriendly, you ain't seen nothing yet.
Anno aka Perl Bot
------------------------------
Date: Sun, 11 Jul 1999 21:10:44 GMT
From: "ted fiedler" <tfiedler@ptd.net>
Subject: trying to read a variable?
Message-Id: <oL7i3.1670$uA5.138845@nnrp1.ptd.net>
open (RNA, "< tmp/workfile");
open (DNA, "> tmp/workfile2");
while (<RNA>) {
if (/015\s+(\w+\s\w*\s*\w+)/) {
s/^015\s+//;
select DNA;
print $1;
}
}
if i have multiple lines in file 'workfile' that llok like this
015 JOHN Q PUBLIC
015 SALLY ROSENGARDEN
015 JOHN Q PUBLIC
015 MAVIS BEACON
etc...
i cant get just the names into a variable -- $1???
thanks in advance
Ted Fiedler
------------------------------
Date: 11 Jul 1999 22:26:27 GMT
From: saku.eisikanautaa@ytti.net (Saku Ytti)
Subject: Re: trying to read a variable?
Message-Id: <slrn7oi6gq.rih.saku.eisikanautaa@ytti.net>
On Sun, 11 Jul 1999 21:10:44 GMT, ted fiedler <tfiedler@ptd.net> wrote:
>while (<RNA>) {
> if (/015\s+(\w+\s\w*\s*\w+)/) {
> s/^015\s+//;
> select DNA;
> print $1;
> }
>}
>if i have multiple lines in file 'workfile' that llok like this
>
>015 JOHN Q PUBLIC
>015 SALLY ROSENGARDEN
>etc...
>
>i cant get just the names into a variable -- $1???
while(<RNA>){ s/[^A-Z]+//; print; }
hth.
--
--ytti - ::3585:0512:1378
------------------------------
Date: Sun, 11 Jul 1999 18:35:30 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: trying to read a variable?
Message-Id: <1dusji5.1c4zep83gytbwN@p90.block2.tc1.state.ma.tiac.com>
ted fiedler <tfiedler@ptd.net> wrote:
> if (/015\s+(\w+\s\w*\s*\w+)/) {
> s/^015\s+//;
This regular expression match wiped out the value of $1 from the regular
expression match in the previous line. Save the value of $1 in another
variable before doing the substitution, or print $1 first if that's all
you need to do.
> select DNA;
> print $1;
> }
> i cant get just the names into a variable -- $1???
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 11 Jul 1999 10:19:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: url extraction without HTML::LinkExtor module
Message-Id: <7m9r4c$3gt$1@gellyfish.btinternet.com>
On Sat, 10 Jul 1999 20:57:45 GMT webmaster@inlandpac.com wrote:
> I am trying to write a script that will extract all domains (i.e.
> ME.COM, PEPSI.COM, etc.) from $results and out put those domains as
> $domains.
>
What is $results ? What is $domains ?
> I don't want to use HTML::LinkExtor and cannot find any documentation
> on how to do this.
>
What have you tried so far that hasnt worked ? If you dont know where to
start I would recommend that you use the module.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
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 113
*************************************