[12844] in Perl-Users-Digest
Perl-Users Digest, Issue: 254 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 25 21:07:16 1999
Date: Sun, 25 Jul 1999 18:05:08 -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, 25 Jul 1999 Volume: 9 Number: 254
Today's topics:
Re: ****Perl tutorials!!!!**** (elephant)
Re: Adding to and deleting from list boxes, text areas (Marcel Grunauer)
connection reset by server <hunt@avana.net>
Re: Extracting plain text from email (Michael Rubenstein)
Re: Extracting plain text from email <tchrist@mox.perl.com>
Re: Extracting plain text from email <flavell@mail.cern.ch>
Re: Geekspeak Programming Contest (Sam Holden)
Re: Geekspeak Programming Contest <tchrist@mox.perl.com>
Guru question: Regular Expression <kin@0011.com>
Re: Guru question: Regular Expression (Abigail)
Re: How to give Passwords on STDIN (elephant)
Re: need to understand do { block } (Michael Rubenstein)
newlines et al, was Re: remove records from database <flavell@mail.cern.ch>
Opening Sockets <flexit@flexit.eurobell.co.uk>
Re: output to screen and log file simultaneously? (Abigail)
Re: Perl CGI vs VB ASP (elephant)
Re: pgp sign mail (elephant)
Re: reg expression <qwerty@post.utfors.se>
Re: reg expression (Marcel Grunauer)
Re: reg expression <jbc@shell2.la.best.com>
Re: remove records from database (Abigail)
Re: Removing characters (Jimtaylor5)
Re: system() (Marcel Grunauer)
Re: system() <brad@americanisp.net>
Variables in hash name <robert.welch@transamerica.com>
Re: Variables in hash name <tchrist@mox.perl.com>
Re: Variables in hash name <tchrist@mox.perl.com>
Re: Variables in hash name (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Jul 1999 09:19:07 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: ****Perl tutorials!!!!****
Message-Id: <MPG.1206467440c65186989b74@news-server>
toby writes ..
>Egads! Now would you test with IE or Navigator given that 'it always tries to
>do something.'
as a developer - I always test with both (and a couple others) .. as a
user I go with the one that shows me something when it can
some might say that I am contributing to the downfall of standardised
HTML ? .. as a user I don't care .. as a developer - certainly not
>...Would you want Perl to
>just go through code and give you something irregardless or would you want to
>have fail with a nice error or warning to debug from?.
ok .. so - yes - as a developer I'd like there to be a '-w' and 'use
strict' option for IE - you're right .. Navigator currently is my 'use
strict' option *8^) .. view source is my '-w' .. there aint no 'use
diagnostics' equivalent
>According to
>BrowserWatch(by no means authoritative), about 40% of people use Netscape.
annoyingly - yes .. I now design two completely different pages for IE
and Navigator .. it takes me less time designing two pages from scratch
.. than one that will work with both
when I get around to it I'll find/write a small Apache module that auto-
handles the detection/redirection
>Toby 'where's -w for my browser' Applegate
*8^)
--
jason - remove all hyphens for email reply -
------------------------------
Date: Sun, 25 Jul 1999 23:35:11 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Adding to and deleting from list boxes, text areas
Message-Id: <379c9d7f.4174722@enews.newsguy.com>
On 25 Jul 1999 21:57:13 GMT, bhsu@lightsaber.ncsa.uiuc.edu (William H.
Hsu) wrote:
> Has anyone written a CGI/Perl-based application that fills in
>text areas or list boxes based on selections made from a multiple option list?
[snip examples]
Sounds like you want to do some stuff on the client-side. For this
you'll need JavaScript. Perl (at least in the CGI-scenario) is for
processing on the server. Ask in a JavaScript group, or read a
JavaScript tutorial (plenty available online).
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: Sun, 25 Jul 1999 20:21:05 -0400
From: Jon <hunt@avana.net>
Subject: connection reset by server
Message-Id: <379BA9F1.56ED991B@avana.net>
connection reset by server
i use a perl upload.pl program and with large files
1-meg or more i get this error message
connection reset by server
i think it is timing out
how do i stop this error message with large files
is there some perl code to stop it from timing out
please help
please respond
thank you
jon spedding
hunt@avana.net
------------------------------
Date: Mon, 26 Jul 1999 00:14:36 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Extracting plain text from email
Message-Id: <37aaa809.104749211@nntp.ix.netcom.com>
On 25 Jul 1999 22:00:59 GMT, sjs@yorku.ca (Steven Smolinski)
wrote:
>Michael Rubenstein <miker3@ix.netcom.com> wrote:
>=(Tad McClellan) wrote:
>=
>=> Read news.announce.newusers if you are a new user of news
>=> and want so see tha announcements so that you look like you
>=> know what you are doing.
>=
>=Perhaps it would help if you'd give a citation to the article in
>=news.announce.newusers that says to place replies after the
>=quoted text. It is quite difficult to find.
>
>I don't know about that custom, but many articles in that group tell you
>to read a newsgroup for a while and abide by the customs. Placing
>replies after quotes is a custom all over usenet -- it is very difficult
>to miss if one is paying attention.
It's also difficult to miss that some posters do otherwise and,
except on this newsgroup, are not insulted for it.
------------------------------
Date: 25 Jul 1999 18:21:37 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Extracting plain text from email
Message-Id: <379baa11@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
miker3@ix.netcom.com (Michael Rubenstein) writes:
:It's also difficult to miss that some posters do otherwise and,
:except on this newsgroup, are not insulted for it.
Immigrants need to learn the ways of their adopted land, not force their
foreign ways on the their new neighbors. And when someone points out
that they're driving on the wrong side of the street, they should be
happy to learn the custom the easy way.
--tom
--
I am returning this otherwise good typing paper to you because
someone has printed gibberish all over it and put your name at
the top.
-- English Professor, Ohio University
------------------------------
Date: Mon, 26 Jul 1999 02:27:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Extracting plain text from email
Message-Id: <Pine.HPP.3.95a.990726022236.10249D-100000@hpplus03.cern.ch>
On Mon, 26 Jul 1999, Michael Rubenstein wrote:
> >I don't know about that custom, but many articles in that group tell you
> >to read a newsgroup for a while and abide by the customs. Placing
> >replies after quotes is a custom all over usenet -- it is very difficult
> >to miss if one is paying attention.
>
> It's also difficult to miss that some posters do otherwise and,
> except on this newsgroup, are not insulted for it.
You seem to have a remarkably sheltered experience of usenet, and
an over-sensitive standard of "insult".
If there's any "insult" going on here, it's people striding into a forum
they haven't bothered to understand, and immediately stating their
intention of setting their own rules. No wonder the existing
participants occasionally get crabby.
--
"I'm not quite sure what you are trying to do
but you certainly dont need to do it"
- Jonathan Stowe on clpm
------------------------------
Date: 26 Jul 1999 00:27:42 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Geekspeak Programming Contest
Message-Id: <slrn7pnas9.qvu.sholden@pgrad.cs.usyd.edu.au>
On 25 Jul 1999 02:03:32 -0400, Chocolate Moose <relzing@redeemer.on.ca> wrote:
>
>Matt Curtin wrote in message ...
>>>>>> On Fri, 23 Jul 1999 14:33:29 -0700, lr@hpl.hp.com (Larry Rosler) said:
>
>>> Jan 1, 2001 = Jan 1, 2000
>
>Larry> I don't get that.
>
>I believe it is a reference to the millennium, which The Masses seem
>to think begins with 2000 despite the fact that it won't begin until
>2000 has come to an end.
>
>
>This is something I don't get. Isn't this analogous to saying that our life
>doesn't begin until we are one? Or is it meant to imply(or implied by the
>fact), that when, if AD or ACE was a living being, it was one at its birth.
The second solution is correct. Since whoever came up with this AD, BC calender
thing (a monk I suspect) wasn't a computer programmer he counted from 1 not 0.
Hence the year 1 BC is followed by the year 1 AD, there is no year 0. Of course
this is a perl newsgroup that has very little to do with calenders, so I'm
probably wrong.
------------------------------
Date: 25 Jul 1999 18:53:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Geekspeak Programming Contest
Message-Id: <379bb17c@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Chocolate Moose" <relzing@redeemer.on.ca> writes:
:This is something I don't get. Isn't this analogous to saying that our life
:doesn't begin until we are one?
A child who has just passed their first birthday is in their second year
of life. An ancient who has just passed their ninety-ninth birthday is
in their hundredth year of life, the final year of their first century.
An ancient who has just passed their hundredth birthday is in their
hundredth-and-first year of life, the first year of their second century.
:Or is it meant to imply(or implied by the
:fact), that when, if AD or ACE was a living being, it was one at its birth.
:Anyways, a new millenium begins, and a new millenium begins for every
:infinitessimal ammount of time that passes.
NB: "millenium" looks like a thousand asses (well, or just one :-),
whereas "millennium" is a thousand years. Be careful on that double
L and especially the double N, lest one place oneself in anus group,
not the annum one. Oh, and "infinitesimal" caries only one S.
Anyway...
Here's one way I found effective in explaining this so people understand
better, which you're welcome to share with others if you also find
it helpful.
Suppose you're trying to put together a whole bunch of twelve-person
juries. You send out mail to your registered voters telling them that
it's jury time and that they should trot on down the courthouse to do
their civic duty. As soon as a full dozen folks show up, you've got
one more complete jury. The question to put to folks is then, "Which
jury does the thirty-sixth person to show up serve upon, the third or
the fourth jury?"
When explained that way, pretty much everyone gets the right answer:
it's only the third jury, which that 36th arrival has just completed,
not a new fourth one just begun. That's because there is no "zeroth"
arrival, so 1-12 are the first jury, 13-24 the second, 24-36 the third,
etc. We don't number people from 0-11, because the first person to show
up is person #1, not person #0.
It's a simple matter then, once you point out (if people don't know) that
years also start counting at 1 and not 0, for folks to realize why years
1-100 make up the first century, 101-200 the second, etc, and that also
years 1-1000 make up the first millennium, years 1001-2000 the second.
That's why the 1800s (minus the year 1800 and plus the year 1900) are
deemed the 19th century instead of the eighteenth, and why the 1900s
(minus the year 1900 and plus the year 2000) are deemed the twentieth
century, not the nineteenth.
The year 2001, not the year 2000, will therefore be the first year of
the twentieth century and of the third millennium. That doesn't change
any part of the computer-related Y2K issues, sadly enough; we don't get
a bonus year to prepare. The 00 place is where a lot of the programming
mistakes (the real name for "bugs") show up. But that's the final year
of the 20th century.
--tom
--
echo "Congratulations. You aren't running Eunice."
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Sun, 25 Jul 1999 16:42:28 -0700
From: Kin Lum <kin@0011.com>
Subject: Guru question: Regular Expression
Message-Id: <379BA0E4.6A7A5127@0011.com>
can you easily kill all tags except the ones you want to keep:
<b> <i> <font > <a >
essentially, something like
s/<^(b|i|font|a)\s.*?>//gi;
but the "^" negating only works in [^ ]
so something like the code below will work, but not very elegant:
s/<b>/___bold___/gi;
s/<i>/___italic___/gi;
s/<font(\s.*?)>/___font$1___/gi;
s/<a(\s.*?)>/___link$1___/gi;
# now kill all tags
s/<.*?>//g;
# now change them all back
s/___bold___/<b>/g;
# etc
------------------------------
Date: 25 Jul 1999 19:43:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Guru question: Regular Expression
Message-Id: <slrn7pnbp4.f12.abigail@alexandra.delanet.com>
Kin Lum (kin@0011.com) wrote on MMCLIV September MCMXCIII in
<URL:news:379BA0E4.6A7A5127@0011.com>:
{} can you easily kill all tags except the ones you want to keep:
{} <b> <i> <font > <a >
If you have simplistic HTML (the kind most browser can understand)
you can use the horribly misnamed 'HTML::Parser' module.
{} # now kill all tags
{} s/<.*?>//g;
This is too stupid to take seriously. Please read the FAQ.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== 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: Mon, 26 Jul 1999 09:22:07 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: How to give Passwords on STDIN
Message-Id: <MPG.12064728b0085125989b75@news-server>
[ item posted to comp.lang.perl.misc and CCed to Martien Verbruggen ]
Martien Verbruggen writes ..
>And if you read the answer to this question in the FAQ you would see
>that it suggests other ways than using ReadKey. In fact, it starts
>with giving the generic answer, and remakrs after that that the
>ReadKey module is a specific way of doing all this.
profuse and public apologies .. you are completely right - previously
unseen by me was the first paragraph of that FAQ which talks about non-
ReadKey methods .. thank you for the slap - I deserved it
--
jason - remove all hyphens for email reply -
------------------------------
Date: Mon, 26 Jul 1999 00:21:24 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: need to understand do { block }
Message-Id: <37aba8d4.104953054@nntp.ix.netcom.com>
On 25 Jul 1999 15:51:26 -0700, Tom Christiansen
<tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, miker3@ix.netcom.com (Michael Rubenstein) writes:
>:In scalar context [the range operator] returns a boolean value.
>
>Only for degenerate values of "boolean". The documentation is misleading.
>It should say "scalar". Read past the first sentence.
[quote from manual elided]
A good point. Of course I'd seen that before but somehow missed
the significance. I guess I just never saw much value to the
sequence number. I'm sure, however, that I've written programs
which would have been simpler had I noticed the E0 to indicate
the final sequence number.
------------------------------
Date: Mon, 26 Jul 1999 02:03:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: newlines et al, was Re: remove records from database
Message-Id: <Pine.HPP.3.95a.990726015452.10249B-100000@hpplus03.cern.ch>
On 25 Jul 1999, Abigail wrote:
> '' Your newsclient is broken: it should be sending \n not \r\n to deliminate
> '' lines.
>
> Nice try, but if you read RFC 822 (which forms the bases for RFC 850,
> format of Usenet messages) then you will see that his newclient is
> *CORRECT*.
However, we seem to have a notation problem here, since (if I've learned
my cross-platform lessons correctly) \r and \n do not denote unambiguous
characters to send on a network connection. Instead, they denote
internal representations of control functions, whose representations
differ from platform to platform.
If you want to refer to \012 and \015, then could I respectfully suggest
there would be less confusion if you would say so directly.
(I have this awful feeling that I'm due for a typical Abigail response,
but if it helps to clarify the situation, so be it.)
------------------------------
Date: Mon, 26 Jul 1999 01:09:32 +0100
From: "Troy Knight" <flexit@flexit.eurobell.co.uk>
Subject: Opening Sockets
Message-Id: <7ng8sd$2a9j$1@slrn.eurobell.net>
Hi,
I have been trying to get my head round this for hours, and I even tried the
FAQ's this time! but I still can't work it out, so I came here....
I want to be able to open a socket and use the filehandle just like any
other normal filehandle. I am on win98 and using Apache but I just can't
work out how to do it.
I want to be able to use the variables $port and $address for the port and
address to connect to, could anyone please spend a little time to give me
the correct code. Thanks, it's very much appreciated.
ps. Sorry if this question has been asked before but I can't find the post
anywhere :)
------------------------------
Date: 25 Jul 1999 20:02:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: output to screen and log file simultaneously?
Message-Id: <slrn7pncsn.f12.abigail@alexandra.delanet.com>
GEMINI (dennis@info4.csie.nctu.edu.tw) wrote on MMCLIV September MCMXCIII
in <URL:news:7nef8v$ck$1@netnews.csie.NCTU.edu.tw>:
&& I use print,warn, and die to output message to
&& screen in my program. I wish to save these message (including that
&& generated by warn and die)
&& to a log file at the same time. Is there any way to do so
&& by not changing the structure of program. Don't suggest me to
&& use a subroutine that print to stdout, and print to file, then call
&& subroutine to output message.
If it was just for warn and die, I'd suggest using $SIG {__WARN__}
and $SIG {__DIE__}, but you want print as well. One way to do it
is using 'tee' from outside the program, but if you want to do it
from inside, open (STDOUT, "|-") and read from STDIN in the child.
Details in 'man perlipc' and recipe 16.5 in the Perl Cookbook.
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: Mon, 26 Jul 1999 09:27:19 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Perl CGI vs VB ASP
Message-Id: <MPG.120648666c8c8d65989b76@news-server>
Ronald J Kimball writes ..
>Even more so, the original poster is familiar with Perl, but not with VB
>or ASP. Are we suppose to explain VB or ASP to the poster? This is not
>the correct newsgroup for that.
this is a very good point .. and probably explains a lot
--
jason - remove all hyphens for email reply -
------------------------------
Date: Mon, 26 Jul 1999 10:36:32 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: pgp sign mail
Message-Id: <MPG.120658983c2b9095989b77@news-server>
Tony Greenwood writes ..
>open (PGP, "|$pgpprog -sta -u \"mykeyname\" > $pgptmp");
>
>However the above produces a blank email. Because everything works
>with encrypt then we know all the paths are set right and the key is
>valid..can anyone throw any light onto what I should do to sign rather
>than encrypt.
you're not doing anything incorrectly in your perl code .. so I'd suggest
consulting your PGP documentation and getting it working out in the shell
first .. then if you're still having trouble - one of the FAQs from one
of the comp.security.pgp.* groups would be your best bet
--
jason - remove all hyphens for email reply -
------------------------------
Date: Sun, 25 Jul 1999 01:39:52 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: Re: reg expression
Message-Id: <379A4EC7.9E447E05@post.utfors.se>
$fff=~s/<img.*>//gi;
llornkcor wrote:
> Is there any wild card expressions ? I would like to delete all <img
> src="blah blah blah"> tags. Not knowing what the actual url of the
> image is. How could I match all the characters from < to >?
> LP
------------------------------
Date: Sun, 25 Jul 1999 23:35:10 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: reg expression
Message-Id: <379b9d0a.4057694@enews.newsguy.com>
On 25 Jul 1999 16:09:28 -0600, llornkcor <llornkcor@llornkcor.com>
wrote:
>Is there any wild card expressions ? I would like to delete all <img
>src="blah blah blah"> tags. Not knowing what the actual url of the
>image is. How could I match all the characters from < to >?
>LP
There is a lot of documentation on regular expressions. Right there on
your system as well. Try
perldoc perlre
Or get a book like "Learning Perl" or "Programming Perl".
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: 26 Jul 1999 00:22:24 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: reg expression
Message-Id: <379baa40$0$217@nntp1.ba.best.com>
llornkcor <llornkcor@llornkcor.com> wrote:
> Is there any wild card expressions ? I would like to delete all <img
> src="blah blah blah"> tags. Not knowing what the actual url of the
> image is. How could I match all the characters from < to >?
Well, those are actually three different questions.
Yes, there are wildcards in regular expression syntax. The period (.)
is a wildcard character matching "any one character (except a newline,
and including a newline if the /s modifier is in effect)". Sticking a
quantifier after the period (like an asterisk - * ) makes it match as
many times in a row as possible, such that .* means "match as many of anything
as possible", more or less, which is sort of a wildcard-ish sort of
thing.
Deleting all <IMG ...> tags via a regular expression has various
solutions ranging from fairly naive (but easy to write) to more
reliable (but harder to write). At the naive/easy end of the spectrum
would be something like:
$string =~ s/<\s*img\s[^>]+>//gi;
which you could read as saying: "within $string, delete all occurrences
of substrings that begin with '<', then have zero or more whitespace
characters, then 'img', then have a whitespace character, then have one
or more characters that are anything but '>', then have a '>'."
The reason this is naive is that it will fail in various situations,
such as an IMG tag that looks like this:
<IMG SRC="something.gif" ALT=">>>Click Here<<<">
The Perl Cookbook addresses these issues in recipe 20.6, where it
recommends using LWP's HTML::Parse module (among others) to build
non-naive solutions.
Your third question (how to match - and, I assume, delete - all
characters from < to >) would seem to be answered with something like:
$string =~ s/<[^>]*>//g;
though that has the problems mentioned above, and deletes all tags, not
just IMG tags.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: 25 Jul 1999 18:36:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: remove records from database
Message-Id: <slrn7pn7qu.b7i.abigail@alexandra.delanet.com>
Mike Bristow (mike@fat.dotat.at) wrote on MMCLIV September MCMXCIII in
<URL:news:slrn7pmu8v.a01.mike@lindt.fat.dotat.at>:
'' On Sun, 25 Jul 1999 10:57:28 -0800, Chad Horton <sandc@sprynet.com> wrote:
'' >Here is my dilema:
''
'' Your newsclient is broken: it should be sending \n not \r\n to deliminate
'' lines.
Nice try, but if you read RFC 822 (which forms the bases for RFC 850,
format of Usenet messages) then you will see that his newclient is
*CORRECT*.
If yours shows the \r, you might consider your newsreader broken. Note that
sending a lone \n isn't incorrect, but that's just part of the text, while
"\r\n" is the line terminator. Just like in any other Internet protocol...
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: 25 Jul 1999 23:57:00 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: Re: Removing characters
Message-Id: <19990725195700.24136.00001862@ng-fw1.aol.com>
>
>You can use substr to extract the substring from the second character onward.
>
>$var = substr($var, 1);
>
>Garth
>
That's a great way to do it. Thanks a million!
------------------------------
Date: Sun, 25 Jul 1999 23:35:12 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: system()
Message-Id: <379d9df5.4292291@enews.newsguy.com>
On Sun, 25 Jul 1999 14:30:13 -0600, Brad Baker <brad@americanisp.net>
wrote:
>The syntax for the system() function is:
>
>system("/bin/command var1 var2 etc");
>
>But what would I put in the system function if the command to run
>requires quotes?
qq()
perldoc perlop
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: Sun, 25 Jul 1999 18:26:43 -0600
From: Brad Baker <brad@americanisp.net>
Subject: Re: system()
Message-Id: <379BAB43.D6C7613A@americanisp.net>
Marcel Grunauer wrote:
>
> On Sun, 25 Jul 1999 14:30:13 -0600, Brad Baker <brad@americanisp.net>
> wrote:
>
> >The syntax for the system() function is:
> >
> >system("/bin/command var1 var2 etc");
> >
> >But what would I put in the system function if the command to run
> >requires quotes?
>
> qq()
>
> perldoc perlop
Marcel,
Thanks for the input, I am new to this group and perl, and are still
reading that email I got sent for posting here. Your feedback helped me
to find the answer I was looking for, and decided to go with a \42
control code instead :)
Thanks!
Brad
>
> Marcel
> --
> perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
--
+---------------+--------------------+-----------------+
|Brad Baker |Dialup 56k 19.95/mo |Website 19.95/mo |
|Americanisp |ISDN 128k 39.95/mo |T3 -call- |
|brad@amisp.net |ISDN 64k 29.95/mo | |
|303-984-5700 |T1 600/mo | |
+---------------+--------------------+-----------------+
|FTP/Shell/cgi-local/PHP3/SSH/Apache Server/FrontPage |
|Extensions/50 EMail boxes/50 Aliases/50 Autoresponers |
|50 Mailing lists/tech support and 50Mb storage with |
|the website hosting package at 19.95/mo. Prices do not|
|include telco charges. Call for more details and info|
+------------------------------------------------------+
------------------------------
Date: Sun, 25 Jul 1999 16:38:29 -0700
From: "Robert Welch" <robert.welch@transamerica.com>
Subject: Variables in hash name
Message-Id: <7ng78p$buq$1@oak.prod.itd.earthlink.net>
Does anyone know how to use a variable in a hash name. In the following
example, I would like to name the hash "userfred", and be able to print the
hash %userfred but I can't figure out the correct syntax.
$name = "fred";
%user{$name} = lookupFunction($name);
Secondly, if I want to copy the hash. Does the following syntax copy the
hash contents or just the pointer to the hash?
%hash1 = %hash2;
Regards,
sgonzalives@earthlink.net
------------------------------
Date: 25 Jul 1999 18:04:25 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Variables in hash name
Message-Id: <379ba609@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Robert Welch" <robert.welch@transamerica.com> writes:
:Does anyone know how to use a variable in a hash name.
HOW MANY TIMES A DAY MUST I POST THIS?
=head2 How can I use a variable as a variable name?
Beginners often think they want to have a variable contain the name
of a variable.
$fred = 23;
$varname = "fred";
++$$varname; # $fred now 24
This works I<sometimes>, but it is a very bad idea for two reasons.
The first reason is that they I<only work on global variables>.
That means above that if $fred is a lexical variable created with my(),
that the code won't work at all: you'll accidentally access the global
and skip right over the private lexical altogether. Global variables
are bad because they can easily collide accidentally and in general make
for non-scalable and confusing code.
Symbolic references are forbidden under the C<use strict> pragma.
They are not true references and consequently are not reference counted
or garbage collected.
The other reason why using a variable to hold the name of another
variable a bad idea is that the question often stems from a lack of
understanding of Perl data structures, particularly hashes. By using
symbolic references, you are just using the package's symbol-table hash
(like C<%main::>) instead of a user-defined hash. The solution is to
use your own hash or a real reference instead.
$fred = 23;
$varname = "fred";
$USER_VARS{$varname}++; # not $$varname++
There we're using the %USER_VARS hash instead of symbolic references.
Sometimes this comes up in reading strings from the user with variable
references and wanting to expand them to the values of your perl
program's variables. This is also a bad idea because it conflates the
program-addressable namespace and the user-addressable one. Instead of
reading a string and expanding it to the actual contents of your program's
own variables:
$str = 'this has a $fred and $barney in it';
$str =~ s/(\$\w+)/$1/eeg; # need double eval
Instead, it would be better to keep a hash around like %USER_VARS and have
variable references actually refer to entries in that hash:
$str =~ s/\$(\w+)/$USER_VARS{$1}/g; # no /e here at all
That's faster, cleaner, and safer than the previous approach. Of course,
you don't need to use a dollar sign. You could use your own scheme to
make it less confusing, like bracketed percent symbols, etc.
$str = 'this has a %fred% and %barney% in it';
$str =~ s/%(\w+)%/$USER_VARS{$1}/g; # no /e here at all
Another reason that folks sometimes think they want a variable to contain
the name of a variable is because they don't know how to build proper
data structures using hashes. For example, let's say they wanted two
hashes in their program: %fred and %barney, and to use another scalar
variable to refer to those by name.
$name = "fred";
$$name{WIFE} = "wilma"; # set %fred
$name = "barney";
$$name{WIFE} = "betty"; # set %barney
This is still a symbolic reference, and is still saddled with the
problems enumerated above. It would be far better to write:
$folks{"fred"}{WIFE} = "wilma";
$folks{"barney"}{WIFE} = "betty";
And just use a multilevel hash to start with.
The only times that you absolutely I<must> use symbolic references are
when you really must refer to the symbol table. This may be because it's
something that can't take a real reference to, such as a format name.
Doing so may also be important for method calls, since these always go
through the symbol table for resolution.
In those cases, you would turn off C<strict 'refs'> temporarily so you
can play around with the symbol table. For example:
@colors = qw(red blue green yellow orange purple violet);
for my $name (@colors) {
no strict 'refs'; # renege for the block
*$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
}
All those functions (red(), blue(), green(), etc.) appear to be separate,
but the real code in the closure actually was compiled only once.
So, sometimes you might want to use symbolic references to directly
manipulate the symbol table. This doesn't matter for formats, handles, and
subroutines, because they are always global -- you can't use my() on them.
But for scalars, arrays, and hashes -- and usually for subroutines --
you probably want to use hard references only.
--
There are probably better ways to do that, but it would make the parser
more complex. I do, occasionally, struggle feebly against complexity... :-)
--Larry Wall in <7886@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 25 Jul 1999 18:05:53 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Variables in hash name
Message-Id: <379ba661@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Robert Welch" <robert.welch@transamerica.com> writes:
:Does anyone know how to use a variable in a hash name.
I double-dare you to go to a comp.lang.c and ask them how to
use a variable to store the name of another variable.
--tom
--
"A momentary lapse of stupidity" -- Dean Roehrich
------------------------------
Date: 25 Jul 1999 19:21:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Variables in hash name
Message-Id: <slrn7pnafj.f12.abigail@alexandra.delanet.com>
Robert Welch (robert.welch@transamerica.com) wrote on MMCLIV September
MCMXCIII in <URL:news:7ng78p$buq$1@oak.prod.itd.earthlink.net>:
,, Does anyone know how to use a variable in a hash name. In the following
,, example, I would like to name the hash "userfred", and be able to print the
,, hash %userfred but I can't figure out the correct syntax.
,,
,, $name = "fred";
,, %user{$name} = lookupFunction($name);
You really do not want that. There are a few cases where symbolic references
are useful, but by the time you are ready to use those cases, you wouldn't
be asking questions like that. What you want is
%{$user {$name}} = lookupFunction ($name);
Assuming that lookupFunction returns a hash.
See the FAQ for more details.
,, Secondly, if I want to copy the hash. Does the following syntax copy the
,, hash contents or just the pointer to the hash?
,,
,, %hash1 = %hash2;
Well, instead of giving you the answer, try this:
%hash2 = (foo => 1, bar => 2, quz => 3);
%hash1 = %hash2;
delete $hash2 {bar};
print exists $hash1 {bar} ? "Copied content\n" : "Copied pointer\n";
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: 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 254
*************************************