[12762] in Perl-Users-Digest
Perl-Users Digest, Issue: 172 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 16 21:07:14 1999
Date: Fri, 16 Jul 1999 18:05:09 -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: 172
Today's topics:
Behavior of '?' in strings and pattern-matching <liny@medicine.wustl.edu>
Re: Behavior of '?' in strings and pattern-matching (Abigail)
Re: Behavior of '?' in strings and pattern-matching (Michael Rubenstein)
Re: cgi compiler (Abigail)
confusing locales <thoren@csi.com>
Re: confusing locales (Abigail)
Re: executing commands, command-line vs. browser (Abigail)
Re: Future of Perl <mike.palmer@ssi.com>
Re: Future of Perl (Abigail)
Re: Future of Perl (Jeffrey)
Re: Garbage Collection Performance (Ilya Zakharevich)
Need help with cookie cgi rn7532@my-deja.com
Re: one-file Perl for Win32 <john@dlugosz.com>
Re: Padding numbers with 0's (Abigail)
Re: Padding numbers with 0's (Abigail)
Parsing a Decisive survey w/ REGEX...need help <sunzone@shell14.ba.best.com>
Re: perl ftp module (Abigail)
Re: Problem: how can a CGI read files on another server (Abigail)
Re: Remove leading zeros from a string (Sami Rosenblad)
script for posting text files (Ataraxia)
Re: searching man pages, perldoc's, FAQ's, README's, HO <dchristensen@california.com>
tie SDBM_File on Win95 lhollman@my-deja.com
Re: UPS Rate Calculator? Have you programmed for it? <will@cs.umb.edu>
why write $x= shift||undef; ? <john@dlugosz.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 14 Jul 1999 02:37:59 -0500
From: <liny@medicine.wustl.edu>
Subject: Behavior of '?' in strings and pattern-matching
Message-Id: <Pine.GSO.3.96.990714023620.29323A-100000@medicine>
Hello,
In short, why doesn't this work (ie, print "ok")?
$a = "asdf?jkl;";
$b = "asdf?j";
if ($a =~ m/$b/) {
print "ok\n";
}
Thanks in advance!
-Yiing Lin
------------------------------
Date: 16 Jul 1999 19:37:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Behavior of '?' in strings and pattern-matching
Message-Id: <slrn7ovk15.c9j.abigail@alexandra.delanet.com>
liny@medicine.wustl.edu (liny@medicine.wustl.edu) wrote on MMCXLIII
September MCMXCIII in <URL:news:Pine.GSO.3.96.990714023620.29323A-100000@medicine>:
__
__ $a = "asdf?jkl;";
__ $b = "asdf?j";
__
__ if ($a =~ m/$b/) {
__ print "ok\n";
__ }
Because /$b/ only matches on strings containing either 'asdj' or
'asdfj'. The manual of course explains why.
Abigail
--
perl -weprint\<\<EOT\; -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: Sat, 17 Jul 1999 00:54:14 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: Behavior of '?' in strings and pattern-matching
Message-Id: <379ad291.392123033@nntp.ix.netcom.com>
On Wed, 14 Jul 1999 02:37:59 -0500, <liny@medicine.wustl.edu>
wrote:
>Hello,
>
>In short, why doesn't this work (ie, print "ok")?
>
> $a = "asdf?jkl;";
> $b = "asdf?j";
>
> if ($a =~ m/$b/) {
> print "ok\n";
> }
Check out what ? means in a regular expression. The regular
expression is recompiled after the interpolation so special
characters in the string are significant in the regular
expression. See the documentation for details.
--
Michael M Rubenstein
------------------------------
Date: 16 Jul 1999 19:12:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi compiler
Message-Id: <slrn7ovij8.c9j.abigail@alexandra.delanet.com>
news.ust.hk (babyh@forfree.at) wrote on MMCXLV September MCMXCIII in
<URL:news:7mo41s$1l8@ustsu10.ust.hk>:
;;
;; Where can I find a CGI complier(work under windows)?
You want to compile protocols?
;; As I want to change my program into byte code!
Why?
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: Sat, 17 Jul 1999 01:39:32 +0200
From: "Thoren Johne" <thoren@csi.com>
Subject: confusing locales
Message-Id: <uO45iS#z#GA.142@nih2naaf.prod2.compuserve.com>
as a german i've problems with \w not matching german "umlaute" and special
signs like:
äöüÄÖÜ and ß
perllocale tells me to:
use locale;
use POSIX qw(locale_h);
setlocale(LC_ALL, "german"); # de_DE and others don't effect
then \w meets my desires, but if i give
print +(sort grep /\w/, map { chr() } 0..255), "\n";
a try, i get a bunch of characters including a lot that for sure are not
part of the german characterset.
am i'm doing something wrong?
wouldn't it be much cooler just to define the characters to go with my
desire by doing something like:
use characters q(a-z A_Z ä Ä ö Ö ü Ü ß _):
gruß
thoren
--
8#X
------------------------------
Date: 16 Jul 1999 19:39:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: confusing locales
Message-Id: <slrn7ovk5p.c9j.abigail@alexandra.delanet.com>
Thoren Johne (thoren@csi.com) wrote on MMCXLV September MCMXCIII in
<URL:news:uO45iS#z#GA.142@nih2naaf.prod2.compuserve.com>:
:: as a german i've problems with \w not matching german "umlaute" and special
:: signs like:
:: äöüÄÖÜ and ß
::
:: perllocale tells me to:
::
:: use locale;
:: use POSIX qw(locale_h);
:: setlocale(LC_ALL, "german"); # de_DE and others don't effect
::
:: then \w meets my desires, but if i give
::
:: print +(sort grep /\w/, map { chr() } 0..255), "\n";
::
:: a try, i get a bunch of characters including a lot that for sure are not
:: part of the german characterset.
Are you sure your locale isn't broken? If you write an equivalent C
program, what happens?
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 19:20:16 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: executing commands, command-line vs. browser
Message-Id: <slrn7ovj11.c9j.abigail@alexandra.delanet.com>
mchesler@my-deja.com (mchesler@my-deja.com) wrote on MMCXLV September
MCMXCIII in <URL:news:7mo0s2$oh4$1@nnrp1.deja.com>:
''
'' Here's the problem. When I run the script from the command line (as
'' root, or nobody), it works fine. When I try to run it from a browser,
'' the script(run) part isn't executed correctly. As far as I can tell,
'' the problem is with passing arguments to the script on the command line.
'' When it's run in a browser, the command line doesn't take the
'' arguments. Please help.
What arguments is the browser supposed to send?
Followups set, as your problem has as much to do with Perl as
Java has with penguins.
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== 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 17:03:10 -0700
From: "Mike Palmer" <mike.palmer@ssi.com>
Subject: Re: Future of Perl
Message-Id: <7mogqh$n4n@tu228.tus.ssi1.com>
Abigail <abigail@delanet.com> wrote in message
news:slrn7otcu4.c9j.abigail@alexandra.delanet.com...
> Jeffrey (Jeffrey@ix.netcom.com) wrote on MMCXLIV September MCMXCIII in
> <URL:news:3795bd45.37232960@news.giganews.com>:
> ^^
> ^^ How long is Perl going to be around?
>
> Till May 19, 2001. That's when the license that NASA granted Larry
expires.
> *All* perl binaries have a self destruct function that test the date, and
> erase Perl and any Perl programs from your hard disk if you start Perl
after
> May 19, 2001.
>
Darn. That just happens to be my little brother's 40th birthday. I told him
many years ago: "Cobol will be dead by the time you're 40."
So I guess Perl and Cobol will die on the same day. You don't suppose Larry
Wall wrote Cobol too, do you?
-- Mike --
(with obvious apologies to Larry...)
------------------------------
Date: 16 Jul 1999 19:35:36 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Future of Perl
Message-Id: <slrn7ovjtn.c9j.abigail@alexandra.delanet.com>
Mike Palmer (mike.palmer@ssi.com) wrote on MMCXLVI September MCMXCIII in
<URL:news:7mogqh$n4n@tu228.tus.ssi1.com>:
..
.. Abigail <abigail@delanet.com> wrote in message
.. news:slrn7otcu4.c9j.abigail@alexandra.delanet.com...
.. > Jeffrey (Jeffrey@ix.netcom.com) wrote on MMCXLIV September MCMXCIII in
.. > <URL:news:3795bd45.37232960@news.giganews.com>:
.. > ^^
.. > ^^ How long is Perl going to be around?
.. >
.. > Till May 19, 2001. That's when the license that NASA granted Larry
.. expires.
.. > *All* perl binaries have a self destruct function that test the date, and
.. > erase Perl and any Perl programs from your hard disk if you start Perl
.. after
.. > May 19, 2001.
.. >
..
.. Darn. That just happens to be my little brother's 40th birthday. I told him
.. many years ago: "Cobol will be dead by the time you're 40."
..
.. So I guess Perl and Cobol will die on the same day. You don't suppose Larry
.. Wall wrote Cobol too, do you?
No, but he might have had the same license Admiral Hopper had.
Abigail
--
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
for (s;s;s;s;s;s;s;s;s;s;s;s)
{s;(..)s?;qq qprint chr 0x$1 and \161 ssq;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: Sat, 17 Jul 1999 00:30:31 GMT
From: Jeffrey@ix.netcom.com (Jeffrey)
Subject: Re: Future of Perl
Message-Id: <3797cd5a.172442315@news.giganews.com>
On 15 Jul 1999 23:24:02 -0500, abigail@delanet.com (Abigail) wrote:
>Don't judge programming languages on their usefullness, judge them on
>their marketable value! That'll increase the quality of code and will
>bring us closer to world peace.
Listen bitch, I learned a lot about how to program the Amiga computer
and then it died in the marketplace. I don't want something like that
to happen ever again. A language isn't fucking useful if you can't get
a job programming in it.
As for my original question, it was spurred by a comment in a CGI book
that Java would take over and Perl would become a legacy language.
Someone said the same thing in a message when I did a search on Deja
News. So don't act like my question was so fucking stupid, bitch.
------------------------------
Date: 16 Jul 1999 23:54:43 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Garbage Collection Performance
Message-Id: <7mogo3$2fr$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Jeremy Purdy
<jerbyr@my-deja.com>],
who wrote in article <7mn98q$e3v$1@nnrp1.deja.com>:
> I have never encountered anything like this either, which is why I
> posted my question here, to see if anyone had. Obviously no one has, so
> thank you for at least responding to my posting.
I have seen things like this before, with Net::FTP.pm and CPAN.pm.
I think these modules do some expensive cleanup in destructors.
Run you program in Perl debugger, set 'b'reakpoint at the last line of
execution, 'c'ontinue, then enable 'f'rame 'O'ption, or switch on
't'race.
Then 'c'ontinue again. You may want to redirect the output to file
via 'L'ineInfo 'O'ption.
Hope this helps,
Ilya
------------------------------
Date: Sat, 17 Jul 1999 00:44:20 GMT
From: rn7532@my-deja.com
Subject: Need help with cookie cgi
Message-Id: <7mojl2$vf7$1@nnrp1.deja.com>
I would like to figure out a way of remembering a
person's details (name, address, etc) from a form
so that when they return to the form at a later
date the it remembers them. Thus saving them the
tedious task of filling in all their personal info
again. Is there a Java Script that would better
handle this? I am fairly new to back end
programming. Any help is greatly appreciated!
Ron
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 19:16:00 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: one-file Perl for Win32
Message-Id: <CB98619F4B2F1246.6C7EB9BC62F74EF7.0368AADD76C82792@lp.airnews.net>
The DLL is searched for in the same directory as the EXE, so it doesn't need
to be on the %PATH. It's not for me.
The PERL.EXE file doesn't require anything other than perlcore.dll and
perlcrt.dll which are in the same directory, and a bunch of stuff which is
in the system32 directory--the same stuff that any program needs, and should
be on the PATH already.
--John
Jeff Robertson <jeff@idir.net> wrote in message
news:xKMh3.563$U6.4195@newsfeed.slurp.net...
> I need to either build or find an installation of Perl for Windows NT and
> Windows 95 that consists of nothing but the interpreter, PERL.EXE. No
.DLLs,
> no modules. The reason I want to do this is because I want to call Perl
from
> batch files that are going to run on a lot of 95 and NT machines that have
> no Perl installed. I want the batch file to be able to call PERL.EXE from
a
> network share, like this:
>
> \\MY_NT_SERVER\MY_SHARE\PERL.EXE -e "print qq(Hello world\n)"
>
> I have found that the normal Perl distributions for Win32 require certain
> .DLLs in order for the interpreter to work, and thus I have had to put the
> DLLs on the network and add the shared directory into the %PATH% variable.
> This is a problem under Win95 where the DOS prompt (and thus the batch
file)
> has limited space for environment variables.
>
> So what I want is a PERL.EXE that will run all by itself, with no other
> files required. I assume that the best way to do this is to build it from
> the sources, but I have little experience compiling anything under NT or
95.
> Any advice or help would be appreciated, especially if someone has already
> done what I want to do.
>
>
>
------------------------------
Date: 16 Jul 1999 19:06:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Padding numbers with 0's
Message-Id: <slrn7ovi7g.c9j.abigail@alexandra.delanet.com>
Jason Stapels (jmstapel_n0spam@mtu.edu) wrote on MMCXLV September
MCMXCIII in <URL:news: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 specific
## example I'm using if for in the following...
##
## $year = ( $_ = (localtime)[5] > 75 ) ? "19$_" : "20$_";
##
## but if the year is 2001, it comes back as 201.
Really? Did you try it out?
You are making 2 mistakes here. The first one is totally inexcusable,
and you should seriously consider packing up your computer, returning
it to the shop, and start up a carreer in straigthning nails.
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
*LOCALTIME DOES NOT RETURN 2 DIGIT YEARS*
The second one is precedence. You're assigning $_ to the outcome of
the question whether the 6th return value of localtime is greater
than 75. Which is 1. So, for the last 23.5 years, this code has
been assigning '191' to $year.
How on earth you think this code will ever produce '201' is beyond
me. You certainly didn't test it.
## Another place where I need this is for displaying the day of
## the month.
##
## printf "%4d%2d%2d\n", $year, $month, $day;
##
## Any help is appreciated.
And your question here is?
Perhaps you should ask your mother to read you the documentation.
It's unlikely you are able to.
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: 16 Jul 1999 19:08:49 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Padding numbers with 0's
Message-Id: <slrn7ovibi.c9j.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCXLV September MCMXCIII in
<URL:news:MPG.11f934fa80da4a6a989ce6@nntp.hpl.hp.com>:
!! In article <7mo0cr$l5p$1@campus1.mtu.edu> on 16 Jul 1999 19:15:39 GMT,
!! Jason Stapels <jmstapel_n0spam@mtu.edu> says...
!! >
!! > $year = ( $_ = (localtime)[5] > 75 ) ? "19$_" : "20$_";
!! >
!! > but if the year is 2001, it comes back as 201.
!!
!! That's because assignment has lower precedence than comparison. Your $_
!! is getting the Boolean value of the result of the comparison, which is 0
!! or 1.
!!
!! Now, if you correct the precedences by moving the right parenthesis,
!! your result will be '20101'. Not that that's any better than '201', is
!! it?
Only if you overload > or ?:. In normal Perl, the truth value of 101 > 75
is "true", yielding "19101" in the above code fragment.
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 23:07:55 GMT
From: "Mark R. Cervarich" <sunzone@shell14.ba.best.com>
Subject: Parsing a Decisive survey w/ REGEX...need help
Message-Id: <378fbb4b$0$204@nntp1.ba.best.com>
I have a tab-delimited file that contains a decisive survey. The software
makers are un(able|willing) to help me, so I have turned to perl and have
gotten a little bit stuck.
I am able to read the file line by line into an array.
Split the lines on the tabs into another array this creates an array of
answers from 1..40.
Where I am having problems is writing a regexp to work with the each answer.
Data can be either: (I will use {} braces to show where the data actually is)
1) an empty string: {}
2) a string of text: ie: {You rarely offer me assigments in my specialty.}
3) a string that begins with a letter from A..T.
ie: { D- Trade magazine ad (national publications)}
4) a string that contains answers to multiple questions A..T
ie: {" C- Newspaper ad, D- Trade magazine ad (national publications), F- Recruiting web site (Monster.com, Hotjobs.com, etc.)"}
The string gets surrounded by quotes if there happens to be a period "." inside the string.
What i need to output is:
If we are in case 2:
The question # followed by a period. A newline.
Then the string inside of brackets.
if we are in case 3 or 4:
The question # followed by a period. A newline.
Brackets with an x inside of it. ie: [ x ]
followed by the question letter, then a right parenthesis ie: D)
So what does that mean? Well consider this input:
---begin input---
" A- First name: - Helen M., B- Last name: - Giese, D- email address: - hele@xxxxx.com"###TAB###" A- Street address, first line: - 1758 W. Olive Ave., C- City: - XXXXXXX, D - State: - IL, E- Zip code: - 99999"###TAB###" L- Other, please specify... - Medical writer/editor"###TAB### C- 3-5 years###TAB### A- Laid off or down-sized and started freelancing at that point###TAB### ###TAB###" C- No, I'd rather work for a company"
---end input---
(here's an easier way to look at it)
---begin input---
1. {" A- First name: - Helen M., B- Last name: - Giese, D- email address: - hele@xxxxx.com"}
2. {" A- Street address, first line: - 1758 W. Olive Ave., C- City: - XXXXXXX, D
- State: - IL, E- Zip code: - 99999"}
3. {" L- Other, please specify... - Medical writer/editor"}
4. { C- 3-5 years}
5. { A- Laid off or down-sized and started freelancing at that point }
6. {}
7. {" C- No, I'd rather work for a company"}
---end input---
would produce this output:
---begin output---
1.
[ x ] A) First name: - Helen M.
[ x ] B) Last name: - Giese
[ x ] D) email address: - hele@xxxx.com
2.
[ x ] A) Street address, first line: - 1758 W. Olive Ave.
[ x ] C) City: - XXXXXX
[ x ] D) State: - IL
[ x ] E) Zip Code: - 99999
3.
[ x ] L) Other, please specify... - Medical writer/edior
4.
[ x ] C) 3-5 years
5.
[ x ] A) Laid off or down-sized and started freelancing at that point
6.
7.
[ x ] C) No, I'd rather work for a company
---end output---
---here's my attempt----
#!/usr/local/bin/perl
@all = <>;
foreach (@all) {
$line = $_;
chomp($line);
(@questions) = split /\t/, $line;
$counter = 1;
foreach $quest (@questions) {
print "$counter.\n";
{ local $x;
$quest =~ /"?( A- .*?)?( B- .*)?( C- .*)?( D- .*)?( E- .*)?( F- .*)?( G- .*)?"?/gs;
# i am only checking from A--G, but I really need to check A..T,
# I thought I'd try a simple case first.
$A = $1; $B=$2; $C=$3; $D=$4; $E=$5; $F=$6;
$G = $7;
if ($A ne "") { print "[ x ] a) $A\n"; }
if ($B ne "") { print "[ x ] b) $B\n"; }
if ($C ne "") { print "[ x ] c) $C\n"; }
if ($D ne "") { print "[ x ] d) $D\n"; }
if ($E ne "") { print "[ x ] e) $E\n"; }
if ($F ne "") { print "[ x ] f) $F\n"; }
if ($G ne "") { print "[ x ] g) $G\n"; }
}
$counter++;
}
print "\n";
}
What do you guys/gals think? Please help me.
------------------------------
Date: 16 Jul 1999 19:25:29 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl ftp module
Message-Id: <slrn7ovjaq.c9j.abigail@alexandra.delanet.com>
Darrin H (dthusma@home.com) wrote on MMCXLV September MCMXCIII in
<URL:news:378FA091.B5B417E9@home.com>:
[] I cannot seem to get the put or the append to work on this module.
[] Does anyone have the same problems, or a working example?
You don't describe the problem. You don't show us code. You don't
show is an error message. You don't show us what you tried. You
don't show us what you expect, and what happened.
Yet you are asking whether anyone had the same problems? Doesn't
that strike you as totally weird, silly and stupid?
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -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 19:30:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Problem: how can a CGI read files on another server?
Message-Id: <slrn7ovjk7.c9j.abigail@alexandra.delanet.com>
Scientia (scientia@XXXtechnologist.com) wrote on MMCXLV September
MCMXCIII in <URL:news:378FB1C0.4058@XXXtechnologist.com>:
?? Problem: how can a CGI read files on another server?
With FTP. With HTTP. With NFS. With Gopher. With SMTP. With UUCP.
With a sneakernet. With NNTP. With WAIS. With IRC. With LDAP.
And some more protocols.
I suggest mounting the remote disks using NFS. If that's not feasible,
I suggest picking a protocol for which there's a module on CPAN.
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -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: Sat, 17 Jul 1999 03:48:26 +0300
From: blade@leela.janton.fi (Sami Rosenblad)
Subject: Re: Remove leading zeros from a string
Message-Id: <blade-1707990348260001@durandal.janton.fi>
In article <37909924.792402@news.skynet.be>, bart.lateur@skynet.be (Bart
Lateur) wrote:
<regexes to remove leading zeroes snipped>
> $n =~ s/^0+(?=\d)//;
>
> There. Leave at least one leading digit.
How about ditching the regex altogether?
my $n = "00000123";
print $n+0; # prints 123
--
Sami Rosenblad -- blade@leela.janton.fi -- running linux since 1999
------------------------------
Date: Fri, 16 Jul 1999 23:14:20 GMT
From: ataraxia@nospam.excite.com (Ataraxia)
Subject: script for posting text files
Message-Id: <378cd36f.68358975@news.mindspring.com>
Can anyone suggest a CGI script (.e.g PERL) that will enable _trusted_
authors to paste text files (e.g. stories) into a form on my web site
and then generate preformated pages for each and a "Table of Contents"
for all of them?
(Assume Linux/Apache/Perl 5 environment)
Criteria:
1. Authors have passworded access to add/delete their own files.
"Modify" is not necessary. I issue a different password to each
author. Master admin password can access any account to add/delete any
file.
2. Fields: title (short title)
decription (1-2 lines max)
text (full story--pasted in. No html allowed)
3. All filed data inserted into a pre-formatted page utilizing tables
(to control left & rioght margins) and SSI calls to insert header &
footer files.
4. All Titles, Decriptions & Author names automatically indexed to a
"Master" Table of Contents HTML page with most recent first and
hyperlinked to each respective story file.
5. Nice but not required:
--- send me email when any author adds or deletes a file from his
"library"
-- "Hit counter"_summary_ report for all story pages.
Thanks
Reply to ataraxia @ excite.com (remove spaces)
------------------------------
Date: Fri, 16 Jul 1999 17:03:21 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: searching man pages, perldoc's, FAQ's, README's, HOWTO's, etc.
Message-Id: <378fc712@news5.newsfeeds.com>
Tom:
>:Is there a way to search man pages, perldoc's, FAQ's, README's,
>:HOWTO's, etc.?
> grep ye first the wisdom of pod,
> and its obviousness.
> then all these things
> shall be answered unto you
> hallelu hallelujah.
Thanks! :-)
Translation (UNIX/bash) for fellow newbies:
1. You will be using the search utility 'grep'.
For help on grep:
$ grep -?
Or:
$ grep --help
Or:
$ man grep
2. Change to the directory containing the documentation files you
want to search.
For example, on my Win98/GNU system it happens to be:
/david$ cd /fsf/lib/perl5/pod
(determining which directory contains the documentation you want to
search is left as an exercise to the reader. :-(
3. Search the documentation files using grep.
For example, using grep, case insensitive '-i', to search for the
word 'serial', in the Perl documentation files '*.pod':
/fsf/lib/perl5/pod$ grep -i serial *.pod
perlfaq5.pod:are often buffered with a buffer size between 1/2
and 2k. Serial devices
perlfaq8.pod:=head2 How do I read and write the serial port?
perlfaq8.pod:the case of Unix, the serial ports will be
accessible through files in
perltoc.pod:=item How do I read and write the serial port?
4. Depending upon what you are searching for in step (3), the
answers may be so numerous as to scroll off the screen.
You can redirect the search program's output via the '>' shell
metacharacter into a file 'foo.txt' for later viewing/ editing:
/fsf/lib/perl5/pod$ grep -i serial *.pod >foo.txt
Or, you can pipe the results via the '|' shell metacharacter into a
screen pager utility such as 'less':
/fsf/lib/perl5/pod$ grep -i serial *.pod | less
--
David Christensen
dchristensen@california.com
-----------== 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: Sat, 17 Jul 1999 00:06:24 GMT
From: lhollman@my-deja.com
Subject: tie SDBM_File on Win95
Message-Id: <7mohdq$ur1$1@nnrp1.deja.com>
Using perl v. 5004_02 (standard dist.) and v. 5.005_03 (Active State)on
Win95 I get '277' as the output from the following test script:
#/usr/bin/perl -wuse Fcntl;
use SDBM_File;
$| = 1;
$i = 1;
tie (%h,
"SDBM_File", 'db', O_RDWR|O_CREAT, 0640) or die "db: $!\n";
open (F,
"file.dat") or die "file.dat: $!\n";while (defined($line=<F>)) {
chomp
$line; $h{$i++} = $line;
}
close (F);
print scalar(keys %h), "\n";
untie
%h;
where file.dat is a test file of 1 record per line, of the basic format:
V1014:S1075:7/30/1998:655.05
Using the debugger, I see all goes well until
$i = 218 at which pointscalar(keys %h) suddenly evaluates to 208. But
nothing seems out ofthe ordinary for this record in file.dat.
I also tried
$h{$i++} = $i which gave me the expected 500, whichmakes me think something
is weird with the data. But I can't seeanything.
Can anyone point me in
the right direction?
Thanks, Lance
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 20:05:25 -0400
From: Will Hannigan <will@cs.umb.edu>
Subject: Re: UPS Rate Calculator? Have you programmed for it?
Message-Id: <378FC8C4.4EDFEF4E@cs.umb.edu>
it works. silly me.
Will Hannigan wrote:
> Brian,
> Thanks For your response. All help is greatly appreciated since I have been
> working on this for three days. ( With less than when I started! )
>
> Did the code provided by UPS in the "UPS Internet Tolls Release Noted and Product
> Docs" work for you? That Code did nothing on this end.
>
> What it seems to be retuning is the length of the string I pass to it.
>
> Was this a trivial project for you? Perhaps it is my Inexperience in Perl that
> has caused the problem...not to say I havent been scouring my books and resources..
>
> Anyways...thanks again...
>
> brian d foy wrote:
>
> > In article <378f6230@discussions>, "will Hannigan" <willidog@hotmail.com> wrote:
> >
> > >If anyone has had any success writing the cgi code to interface
> > >with the UPS Quick Cost Calculator, please let me know.
> >
> > i have.
> >
> > >..I can
> > >connect to and open the scoket no problem, but the datareturned
> > >is not what is expected...
> >
> > make sure you are sending the data that it expects.
> >
> > --
> > brian d foy
> > CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
> > Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Fri, 16 Jul 1999 19:08:30 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: why write $x= shift||undef; ?
Message-Id: <1BD02F6D5F9F19BA.37ED17147D6B1E8C.41FCDEF4D47AAFC0@lp.airnews.net>
Looking at:
package Tie::StdScalar;
@ISA = (Tie::Scalar);
sub TIESCALAR {
my $class = shift;
my $instance = shift || undef; # why?
return bless \$instance => $class;
}
I wonder what the point of the indicated line may be. If there is no second
argument, the shift will produce undef anyway! If the argument (which
appears to be an initial value for the new object) is any kind of false
value including a numeric zero or an empty string, it's taken as undef
anyway, which changes the detailed semantics of the "assignment".
Can anybody shed some light on this? And for those whose answer to any
intelligent question is "RTFM" (and we all know who you are <g>), this =is=
from the manual.
--John
------------------------------
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 172
*************************************