[12735] in Perl-Users-Digest
Perl-Users Digest, Issue: 145 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 14 18:07:16 1999
Date: Wed, 14 Jul 1999 15:05:19 -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 Wed, 14 Jul 1999 Volume: 9 Number: 145
Today's topics:
Re: # of days between 2 dates (again) <thoren@csi.com>
Re: # of days between 2 dates (again) <mdz4c@node10.unix.Virginia.EDU>
Re: ** Working With Strings (Tad McClellan)
Re: <<eof in `` (Tad McClellan)
Re: <<eof in `` (Tad McClellan)
Accessing Oracle through Perl, win32 mmixon@primacis.com
Re: Anybody know how to to this? (Tad McClellan)
Re: Anybody know how to to this? (Sitaram Chamarty)
Re: cgi timeout <ramin@pop.net>
Re: Cgiemail or Perl script processing form submissions <scottl-SPAM@SPAM-extendsys.com>
Re: connecting to a phone number <ramin@pop.net>
Re: crypt returns different values since ISP upgrade. <aperrin@mcmahon.qal.berkeley.edu>
Re: crypt returns different values since ISP upgrade. <shades__@mitec.net>
Re: Getting very irregular single 'name' field into fir (Tad McClellan)
Re: Getting very irregular single 'name' field into fir (Tad McClellan)
Re: Getting very irregular single 'name' field into fir (Tad McClellan)
Re: Getting very irregular single 'name' field into fir (Tad McClellan)
Re: hash assignments <mdz4c@node10.unix.Virginia.EDU>
Re: help with perl (Tad McClellan)
Re: knowing it's own name? (Tad McClellan)
Re: newbie question: how put files from dir in array (Tad McClellan)
Re: Not able to write to file (Tad McClellan)
Re: Not able to write to file <lv_josh@my-deja.com>
Re: pattern matching with variables (Tad McClellan)
Re: perl 5.005_3 on hp/ux 10.20 (H. Merijn Brand)
Re: perl's edge -- a beginner's question <keithmur@mindspring.com>
Re: perl's edge -- a beginner's question <shades__@mitec.net>
question on mail attachments tommylebrun@my-deja.com
Re: Rebol and Perl (Charles DeRykus)
regex help needed <prlawrence@lehigh.edu>
Re: regex help needed <prlawrence@lehigh.edu>
Re: Search array <emschwar@rmi.net>
Re: Statistics for comp.lang.perl.misc (Tad McClellan)
Re: Test if a File Exists? (Tad McClellan)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 14 Jul 1999 23:02:26 +0200
From: "Thoren Johne" <thoren@csi.com>
Subject: Re: # of days between 2 dates (again)
Message-Id: <7mitvg$4pj$1@ssauraaa-i-1.production.compuserve.com>
<skyfaye@my-deja.com> wrote in message
news:7mir39$r1a$1@nnrp1.deja.com...
> $old_mon = 6; $old_day = 22; $old_year = 1994; #June 22, 1994
> $new_mon = 7; $new_day = 14; $new_year = 1999; #July 14, 1999
>
> How do I find out the number of days between the 2 dates ?
that seems to be a popular problem today... supposing you also don't
like or can't use modules like Date::Calc, you could convert the dates
into julian days and then do your calculations:
$old_mon = 6; $old_day = 22; $old_year = 1994; #June 22, 1994
$new_mon = 7; $new_day = 14; $new_year = 1999; #July 14, 1999
$old_jd = $old_day - 32075
+ 1461 * ( $old_year + 4800 - ( 14 - $old_mon ) / 12 )/4
+ 367 * ( $old_mon - 2 + ( ( 14 - $old_mon ) / 12 ) * 12 ) / 12
- 3 * ( ( $old_year + 4900 - ( 14 - $old_mon ) / 12 ) / 100 ) / 4
;
$new_jd = $new_day - 32075
+ 1461 * ( $new_year + 4800 - ( 14 - $new_mon ) / 12 )/4
+ 367 * ( $new_mon - 2 + ( ( 14 - $new_mon ) / 12 ) * 12 ) / 12
- 3 * ( ( $new_year + 4900 - ( 14 - $new_mon ) / 12 ) / 100 ) / 4
;
print "days between $old_mon/$old_day/$old_year and
$new_mon/$new_day/$new_year: ", int $new_jd - $old_jd;
gruß
thoren
--
8#X
------------------------------
Date: Wed, 14 Jul 1999 17:10:52 -0400
From: Matthew Zimmerman <mdz4c@node10.unix.Virginia.EDU>
Subject: Re: # of days between 2 dates (again)
Message-Id: <Pine.A41.4.05.9907141709020.78120-100000@node10.unix.Virginia.EDU>
On Wed, 14 Jul 1999 skyfaye@my-deja.com wrote:
> I'm new to this list. I've been unsuccessful at posting. Why does it
> log me out every time I click on the button to post my message? I
> apologize in advance if my previous post got through. Here's my
> question:
>
> $old_mon = 6; $old_day = 22; $old_year = 1994; #June 22, 1994
> $new_mon = 7; $new_day = 14; $new_year = 1999; #July 14, 1999
>
> How do I find out the number of days between the 2 dates ?
That's a FAQ.
perldoc perlfaq4
http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq4.html
HTH Matt
--
Matthew Zimmerman http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program University of Virginia
------------------------------------------------------------------
"You got to be very careful if you don't know where you're going,
because you might not get there." -- Yogi Berra
------------------------------
Date: Wed, 14 Jul 1999 11:46:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: ** Working With Strings
Message-Id: <0cbim7.2kj.ln@magna.metronet.com>
Andreas Fehr (backwards.saerdna@srm.hc) wrote:
: On Wed, 14 Jul 1999 03:33:26 -0400, tadmc@metronet.com (Tad McClellan)
: wrote:
: >Abigail (abigail@delanet.com) wrote:
: >: Larry Rosler (lr@hpl.hp.com) wrote on MMCXLII September MCMXCIII in
: >: <URL:news:MPG.11f510c4a29b3bbc989cb8@nntp.hpl.hp.com>:
: >: @@
: >: @@ Things like this are tipping me further to the Abigail side of The
: >: @@ Force.
: >
: >: You like mauve too?
: >
: > Is mauve male or female?
: This should be clear now...
eh?
Now I'm confused.
So is it clear, or is it mauve?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 12:44:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: <<eof in ``
Message-Id: <7peim7.srj.ln@magna.metronet.com>
Stanislav Benda (si_bendovi@hotmail.com) wrote:
: In article <a17dm7.vue.ln@magna.metronet.com>,
: tadmc@metronet.com (Tad McClellan) wrote:
: > Stanislav Benda (si_bendovi@hotmail.com) wrote:
: > : How can I do on PC this? :
^^
^^
[ snip code ]
: It could work in unix like I wrote, but in PC NT DOS shell there is
I do that kind of thing all of the time on my PC.
You did not tell us that you are forced to use a Microsoft "OS"
on _your_ PC.
Your spec was unclear, resulting in an answer that you could not use.
Make a better spec, get a better answer.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 12:47:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: <<eof in ``
Message-Id: <tueim7.srj.ln@magna.metronet.com>
Stanislav Benda (si_bendovi@hotmail.com) wrote:
: In article <a17dm7.vue.ln@magna.metronet.com>,
: tadmc@metronet.com (Tad McClellan) wrote:
: > Stanislav Benda (si_bendovi@hotmail.com) wrote:
[snip code]
: Not, this does not work. It starts sqldba ( command line SQL utility
: for Oracle database) and waiting for keyboard input. When sqldba
: finish, result is stored in $var. I need to start sqldba and send to it
: this text: connect . . .
: It could work in unix like I wrote, but in PC NT DOS shell there is
^^
^^
: nothing like <<eof. There is no fork as well. Is it any chance to solve
^^^^^^^
^^^^^^^
I thought Win95/98 had no fork, and NT did have it?
I dunno (or even care).
Have you at least tried it as described in the Perl FAQ, part 8:
"How can I open a pipe both to and from a command?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 21:32:04 GMT
From: mmixon@primacis.com
Subject: Accessing Oracle through Perl, win32
Message-Id: <7mivkj$sud$1@nnrp1.deja.com>
I'm having trouble accessing Oracle running the
simplest of scripts on a fresh installation. I'm
using win32.
I'm using:
ActiveState Perl, build 518.
DBD::ORACLE (DBD-Oracle.zip, ppm module)
To make things simple, I started with a fresh machine
and installed Perl first followed by DBD::ORACLE. The
installation went smoothly.
Then I ran this short script:
use DBI;
$dbh = DBI->connect('dbi:Oracle:MYTNS','TUCAN','SAM');
$dbh = DBI->prepare('SELECT lastname FROM PERSON');
$dbh = DBI->execute();
while ( @row = $dbh->fetchrow_array ) {
print "@row\n";
}
These are the errors I got:
Variable "%CreateKey_Opts" is not imported at
C:/Perl/site/lib/Win32/TieRegistry.pm line 1482.
Global symbol "%CreateKey_Opts" requires explicit
package name at
C:/Perl/site/lib/Win32/TieRegistry.pm line 1482.
:
<Snipped several Global symbol errors as above>
:
Can't locate auto/DBI/prepare.al in @INC
(@INC contains: C:/Perl/lib C:/Perl/site/lib .)
at ora7.pl line 3
So, in spite of the 'Variable' and 'Global symbol'
errors, it looks like it connected to the database
only to fail on the prepare statement.
Any ideas?
TIA
Marlin Mixon
Everything that can be counted doesn't necessarily count;
everything that counts can't necessarily be counted. (Einstein)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 14 Jul 1999 12:33:26 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Anybody know how to to this?
Message-Id: <m4eim7.srj.ln@magna.metronet.com>
Kris (kdom@mail.mobistar.be) wrote:
: I am newcomer to Perl, so if you're don't wish to answer to same stupid
: questions again and again, don't read any furhter.
You have a profound and _limiting_ understanding of what is
expected in Usenet postings.
Understand what the issue really is, and get all of the benefits
of free consulting help available on Usenet!
Stupid questions are OK.
Being a newcomer to Perl is OK.
Post away!
Asking questions that are easily answered in the documents
that came with your perl are NOT OK however.
This is *not the same* as being a newbie or asking a stupid question.
: So what I want to do is to replace all the separator (newline, carriage
: return or whatever) in the variable by <BR> using regular expressions.
If you _replace_ them, your entire HTML file will be a single line.
That will work, but is pretty hard on human eyes.
So I'll assume that instead you want to _add_ a <BR> before
every newline.
: If you have any other suggestions how I could do this, any help is much
: appreciated!
$multi_line_string =~ s/\n/<BR>\n/g;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 22:00:53 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Anybody know how to to this?
Message-Id: <slrn7opi4e.rck.sitaram@diac.com>
On Wed, 14 Jul 1999 17:39:15 +0200, Kris <kdom@mail.mobistar.be> wrote:
>Hi,
>
>I am newcomer to Perl, so if you're don't wish to answer to same stupid
>questions again and again, don't read any furhter.
Ahh - the smell of fear ;-)
If you're so sure it's been asked before ("same ... again and
again") and it's stupid, why ask? Use dejanews to search for old
answers.
In other words - to paraphrase you: if you wish to ask the same
stupid question again and again, don't post any further!
Anyway - I'm glad to see that someone else has already posted
replies to your actual query.
------------------------------
Date: Wed, 14 Jul 1999 17:35:07 -0400
From: RaminA <ramin@pop.net>
Subject: Re: cgi timeout
Message-Id: <378D028B.995BD263@pop.net>
In such cases, have your cgi simply email the result to you.
Ramin
Nicola wrote:
> I'd want to run a perl script that need 30 minutes to execute,
> but this is killed by the cgi-timeout limit of the server.
> Is there a method to avoid the timeout limit?
>
> Thank you.
> Nicola
------------------------------
Date: 14 Jul 1999 21:46:09 GMT
From: "Scott Lundberg" <scottl-SPAM@SPAM-extendsys.com>
Subject: Re: Cgiemail or Perl script processing form submissions
Message-Id: <7mj0f1$2pt$0@198.60.252.230>
Why not just email to a local user... then you could just grap their email
file. You of course would have headers in it, but you could filter.
Scott
Kerry J. Cox wrote in message <378A5067.25A4BB75@vii.com>...
>This may be a bit off topic, but I'm hoping someone here is familiar
>enough with cgiemail and/or perl to assist. I'm needing to have a form
>submit information not as email but rather have a small Perl script take
>over and then append the text to a file.
>For example, I have a form that after you submit it sends a line comma
>delimited text with each field surrounded by quotes as a email.
>"Mr.","Kerry","Cox","1234 Anywhere Street", etc........ What I want to
>have it do instead is have a Perl script write this form to a text
>file. And then have each succeeding submission append to the next line
>of that file. That weay each submission takes a line.
>If anyone is familiar enough with something like this and could please
>assist me, I would very much appreciate it.
>Thanks.
>KJ
>
>--
>.-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
>| Kerry J. Cox Vyzynz International Inc. |
>| kjcox@vii.com Systems Administrator |
>| (801) 596-7795 http://www.vii.com |
>| ICQ# 37681165 http://quasi.vii.com/linux/ |
>`-------------------------------------------------------'
>
>
>
------------------------------
Date: Wed, 14 Jul 1999 17:29:16 -0400
From: RaminA <ramin@pop.net>
Subject: Re: connecting to a phone number
Message-Id: <378D012C.D581BC3B@pop.net>
If this is a UNIX box you can install 'mserver' and have your
perl script talk with the mserver (even remotely) via TCP/IP.
There you can bring up a dialup connection and do whatever
you want.
Hope it helps,
Ramin
In off the Post wrote:
> Is it possible to connect to a phone line using a Perl server-side
> script?
>
> If so, how? If not, why not?
>
> For example, on submission of a form a Perl script would connect with a
> phone line and transmit the form data using X.25 protocol. I want to be
> able to do this from an independently hosted website.
>
> Any help appreciated, thanks,
> --
> In off the Post, PO Box 302, HALSTEAD, CO9 2LA. ENGLAND
> Phone: +44 (0) 1787 478 468 Fax: +44 (0) 1787 477 635
> e-mail: pbm@iotp.co.uk http://www.iotp.co.uk
> http://www.iotp-online.co.uk http://www.soccerweb.co.uk
------------------------------
Date: Wed, 14 Jul 1999 14:08:43 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: crypt returns different values since ISP upgrade.
Message-Id: <378CFC5B.42DA35CF@mcmahon.qal.berkeley.edu>
You're not using crypt() right, for two distinct reasons.
First, the salt is supposed to be a two-character string; you've given it
one character. I tested this between NT and solaris running a couple
different versions of perl; NT and solaris returned different strings for
crypt('4runner',7) (although, interestingly, several different solaris
machines, and different versions of perl under solaris, returned the same
string). However, if you use a 2-character salt, the strings returned are
all the same; for example, on both NT and Solaris:
perl -e "print crypt('4runner','ee');"
eebws7QYy.gjw
Second, by always setting the salt to any given value (in this case, '7'),
you're disabling part of the routine. If you check out some of the password
programs floating around (notably the one in the old camel book), you'll
note that the salt is generated out of some dynamic routine, often tied to
the time the program is run. The crypt() routine puts the salt in the first
two characters of the hash, which is why crypt('foo','xx') will always
return a string starting with xx.
Assume $user contains the password the user typed in, and $passwd contains
the crypt()ed password from the file. The following code will work
regardless of the crypt() command that created the hash:
if (crypt($user, substr($passwd, 0, 2)) eq $passwd) {
# The password given was correct.
} else {
# The password given was incorrect.
}
robyoung wrote:
> Upon investigation, I found that the encrypted password values in the
> members log file was not the same as what Perl was now generating . The
>
> encryption algorythm has not changed. As you know, an encrypted
> password routine must reproduce the same values every time to be
> effective.
--
-------------------------------------------------------------
Andrew Perrin - NT/Unix/Access Consulting - aperrin@mcmahon.qal.berkeley.edu
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Tue, 13 Jul 1999 16:51:13 -0500
From: "Daniel Ulrich" <shades__@mitec.net>
Subject: Re: crypt returns different values since ISP upgrade.
Message-Id: <378d06fd@news5.newsfeeds.com>
I have had the same problem. It seems that in my linx system it uses some
type of ID number off of the CPU to generate it's encryption. I tested this
several times. I even went out and got another CPU same brand and same type
and it still did not recognize the passwords right. But when I swaped my
original chip back in it worked just fine. My question is WHY?
Have Fun
Shades__
Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu> wrote in message
news:378CFC5B.42DA35CF@mcmahon.qal.berkeley.edu...
> You're not using crypt() right, for two distinct reasons.
>
> First, the salt is supposed to be a two-character string; you've given it
> one character. I tested this between NT and solaris running a couple
> different versions of perl; NT and solaris returned different strings for
> crypt('4runner',7) (although, interestingly, several different solaris
> machines, and different versions of perl under solaris, returned the same
> string). However, if you use a 2-character salt, the strings returned are
> all the same; for example, on both NT and Solaris:
>
> perl -e "print crypt('4runner','ee');"
> eebws7QYy.gjw
>
> Second, by always setting the salt to any given value (in this case, '7'),
> you're disabling part of the routine. If you check out some of the
password
> programs floating around (notably the one in the old camel book), you'll
> note that the salt is generated out of some dynamic routine, often tied to
> the time the program is run. The crypt() routine puts the salt in the
first
> two characters of the hash, which is why crypt('foo','xx') will always
> return a string starting with xx.
>
> Assume $user contains the password the user typed in, and $passwd contains
> the crypt()ed password from the file. The following code will work
> regardless of the crypt() command that created the hash:
>
> if (crypt($user, substr($passwd, 0, 2)) eq $passwd) {
> # The password given was correct.
> } else {
> # The password given was incorrect.
> }
>
>
> robyoung wrote:
>
> > Upon investigation, I found that the encrypted password values in the
> > members log file was not the same as what Perl was now generating . The
> >
> > encryption algorythm has not changed. As you know, an encrypted
> > password routine must reproduce the same values every time to be
> > effective.
>
>
>
> --
> -------------------------------------------------------------
> Andrew Perrin - NT/Unix/Access Consulting -
aperrin@mcmahon.qal.berkeley.edu
>
> http://www.geocities.com/SiliconValley/Grid/7544/
> -------------------------------------------------------------
>
>
-----------== 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: Wed, 14 Jul 1999 11:35:17 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <lnaim7.2kj.ln@magna.metronet.com>
Brad Long (bjl@uq.net.au) wrote:
: Basically, I agree that Abigail is a problem!
: After making a couple
: visits to this newsgroup, I have seen how Abigail not only says "...not a
: Perl question..."
Oh!
Are you saying that it is OK to make off-topic postings?
The problem is the people making off-topic and FAQ postings.
Not people who try to point out the error of their ways.
Abigail is simply a symptom (easily treated).
The disease is off-topic and FAQ postings.
: There does seem to be a merry band of minstrels that support Abigail's
: postings. Poor souls!
Whenever you notice someone acting minstrelish, make a killfile entry.
Problem solved!
: ..... maybe ".misc" stands for "misconception"... or "miscreant" ....
^^^^^^^^^
Yep. That would be right on.
But the miscreants are the posters of off-topic and FAQ articles,
not Abigail.
[ snip 40 lines of context when 3 would have established context.
also quoted Jeopardy style!
]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:44:34 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <29bim7.2kj.ln@magna.metronet.com>
Brad Long (bjl@uq.net.au) wrote:
: Basically, I agree that Abigail is a problem!
Basically, I agree that off-topic FAQ posters are a problem!
: If Abigail didn't respond to questions that she didn't want to answer, most
: threads in this newsgroup would be much smaller.
If there were no off-topic/FAQ posts then Abigail would not
be responding to them.
: There does seem to be a merry band of minstrels that support Abigail's
: postings. Poor souls!
There does seem to be a merry band of minstrels that support off-topic/FAQ
postings. Poor souls!
: ..... maybe ".misc" stands for "misconception"... or "miscreant" ....
It most certainly does not stand for "ask it here before looking
in the files installed on your own hard disk".
[snip 40 lines again...]
-----------------------------------------------------------------
In article <1995Nov9.193745.13694@netlabs.com>, lwall@netlabs.com (Larry
Wall) wrote: ...
<Larry> [snip] I view a programming language as a place to be
<Larry> explored, like Disneyland. You don't need to have a lot of preparation
<Larry> to explore a theme park. You do have to go along with the crowd
<Larry> control measures, though. In a sense, each ride has its own
<Larry> prerequisites--if you cut in line, you risk getting tossed out of the
<Larry> park.
<Larry>
<Larry> What we have here in this newsgroup is a failure in crowd control.
<Larry> Reading the FAQ is like staying in line--it's something you should
<Larry> learn in kindergarten. Usenet needs a better kindergarten.
-----------------------------------------------------------------
Abigail is the teacher for those unfortunate enough to not
have attended Usenet kindergarten (i.e. news.announce.newusers)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:38:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <guaim7.2kj.ln@magna.metronet.com>
Brad Long (bjl@uq.net.au) wrote:
: Basically, I agree that Abigail is a problem!
: I find this to be a very poor
: newsgroup,
Participation is voluntary.
You may elect to unvolunteer at any time.
: mainly due to the high email traffic that is generated by Abigail
^^^^^^^^^^^^^
We are not privy to the email that you have been receiving from Abigail.
We can only see Usenet postings from Abigail.
email is a private thing.
[snip the same 40 line Jeopardy style foolishness ]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:26:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <17aim7.2kj.ln@magna.metronet.com>
Brad Long (bjl@uq.net.au) wrote:
: Basically, I agree that Abigail is a problem!
Make a killfile entry.
Takes 10 seconds.
No more problem!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 17:03:56 -0400
From: Matthew Zimmerman <mdz4c@node10.unix.Virginia.EDU>
Subject: Re: hash assignments
Message-Id: <Pine.A41.4.05.9907141653570.78120-100000@node10.unix.Virginia.EDU>
On 14 Jul 1999, Nick Downey wrote:
> ok, here we have a loop. This loop basically does some processing and
> constructs a hash. The hash "%printlist" is assigned value "$lineone[0]" by
> key of "$state".
>
> 1: foreach $state (sort @files) {
> 2: <snip>
> 3: if( $lineone[1] != 0 ) {
> 4: $state =~ s/.dat//;
> 5: $printlist{$state} = $lineone[0];
> 6: }
> 7: }
>
> If I were to modify line 5 to look like
>
> 5: $printlist{ ($state =~ s/.dat//) } = $lineone[0];
>
> Then when the loop finishes, I would only have one (key-value) pair. The
> last one that the loop processed.
>
> I don't mind doing it the way that works, but I was wondering if anyone
> knew why that was ?
Because the key isn't what you think it is...
try replacing line 5 with
print ($state =~ s/.dat//);
and see what happens.
The reason why you get '1' instead of what you expected is because
($state =~ s/.dat//) gives the return value of the substitution rather
than the value of $state. So each time through the for loop, you're
assigning $lineone[0] to the same key, '1', and knocking the previous
value assigned to that key out of the hash. As a newbie myself, I usually
just do substitutions on separate lines and don't usually try to
incorporate them into bigger expressions, for precisely this reason.
HTH! Matt
--
Matthew Zimmerman http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program University of Virginia
------------------------------------------------------------------
"You got to be very careful if you don't know where you're going,
because you might not get there." -- Yogi Berra
------------------------------
Date: Wed, 14 Jul 1999 12:17:24 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: help with perl
Message-Id: <k6dim7.srj.ln@magna.metronet.com>
GreenDay1a (greenday1a@aol.com) wrote:
: I downloaded the stable_tar.gz from www.perl.com and I don't know what to do
^
^ s/_/./; # ???
: with it.
1) unzip it with the GNU 'gunzip' utility
gunzip stable.tar.gz
2) untar it with the Unix 'tar' utility
tar xf stable.tar
3) read the README and INSTALL files
more README
more INSTALL
[ run 'make' etc to run the source code through your C compiler
to create the executable, as described in INSTALL.
]
: When I open it in Winzip, it asks what I should change the extension
^^^^^^
Oh.
Can we then assume that you want to install perl in a M$ Windoze
"operating system"?
: to. What extension should i use? I am completely clueless and any help would be
: appreciated.
Get a pre-built Win32 binary from:
http://www.activestate.com
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:48:24 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: knowing it's own name?
Message-Id: <8gbim7.2kj.ln@magna.metronet.com>
Vice Admiral Acker (KamiBot@rotfl.com) wrote:
: I kinda guess you sorta mean:
: $script = $ENV{'SCRIPT_FILENAME'};
: print "$script\n";
: This will print the full pathname of the file you're using, if I'm correct.
^^^^^^^^^^^^^^
^^^^^^^^^^^^^^
You are not.
I don't have a SCRIPT_FILENAME environment variable defined.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:54:10 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: newbie question: how put files from dir in array
Message-Id: <2rbim7.2kj.ln@magna.metronet.com>
iLs (iLs@cyberdude.com) wrote:
: Hi, I'm just learning perl and wondering how I could put all the file names
: of a certain dir. in an array ?
: Can somebody show me an example ?
type
perldoc -f readdir
on a properly installed perl, and see the example given there.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:53:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Not able to write to file
Message-Id: <bpbim7.2kj.ln@magna.metronet.com>
LV Josh (lv_josh@my-deja.com) wrote:
: i am playing with substr and tr to
: alter substrings from a said file, say test.txt. well, i have no
: problem opening the file, making the changes *temporarily*, but once
: the script ends, the file remains unchanged.
Did you write the changes back to the file?
It doesn't happen unless you tell it to happen.
Perl FAQ, part 5:
"How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?"
See also the -i command line switch in perlrun.pod.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 21:52:09 GMT
From: LV Josh <lv_josh@my-deja.com>
Subject: Re: Not able to write to file
Message-Id: <7mj0q4$te8$1@nnrp1.deja.com>
This worked! thanks!!! now maybe you can clear something else up for
me...
here is my script: (there is a file in the same directory named test
that consist of one line that reads "josh was here")
---
#!/usr/bin/perl
open(TEST, "+<test");
while (<TEST>) {
tr/josh/dave;
print TEST;
}
close(TEST);
---
my desired effect is to replace the original line so that it now
reads "dave was here" but instead it just adds it as a new line. this
is the the result of "test" after the script is run:
josh was here
dave was here
thanks for your patience, but know that i am at least looking through
the llama and camel book before asking over usenet.
In article <378CA3BE.3136080F@NO-SPAMamericasm01.nt.com>,
Marshall Culpepper <marshalc@NO-SPAMamericasm01.nt.com> wrote:
> you probably forgot to write the saved changes to the file..
>
> print FILE $changes
> ----------------------------------
> just another guy trying to save the world
> ----------------------------------
>
>
--
Josh
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 14 Jul 1999 11:50:13 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: pattern matching with variables
Message-Id: <ljbim7.2kj.ln@magna.metronet.com>
David Pratt (David_J_Pratt@sbphrd.com) wrote:
: Easiest way to do this is put the variable name in curly brackets.....
: e.g.
: $var = "Hello";
: $string = "sldkfsjdHelloasdsad";
: if ($s =~ /${var}/) { print "Found $var in $string\n"; }
: will work.
*Easiest* way to do this is NOT to put the variable name in curly brackets
if ($s =~ /$var/) { print "Found $var in $string\n"; }
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Jul 1999 21:53:59 GMT
From: h.m.brand@hccnet.nl (H. Merijn Brand)
Subject: Re: perl 5.005_3 on hp/ux 10.20
Message-Id: <7mj0tn$3h3$1@nntp.Stanford.EDU>
jnich@pdd.att.com (Jim Nicholson) wrote in <37710641.9ECBA841@pdd.att.com>:
>I'm trying to build the latest stable perl on a 715 with 10.20 installed
>(using the hp-supplied ANSI compiler, not the k&r one). Make dies in the
>miniperl tests with the following:
>
> cc -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -lnsl_s
>-lndbm -ldld -lm -lc -lndir -lcrypt
> ./miniperl -w -Ilib -MExporter -e 0 || make minitest
> ./miniperl configpm tmp
>*** Termination signal 132
>
>Stop.
>
>Has anyone succeeded in getting a perl more recent than 5.004 to compile
>under HP/UX?
Yes, use '-Ae -O2' for better results :-)
Warning: -Ae is ignored by cpp, use -Aa instead. Contact with HP
learned that this might be an HP bug :-(
This config is on a HP 9000/D390 (hppa-2.0w) for HP-UX 11.0:
# grep -i cc config.sh
Mcc='Mcc'
byacc='byacc'
cc='cc'
cccdlflags='+z'
ccdlflags='-Wl,-E -Wl,-B,deferred '
ccflags='-DDEBUGGING -Ae -D_HPUX_SOURCE -I/pro/local/include'
ccsymbols='_HPUX_SOURCE=1 _PA_RISC2_0=1 __STDC_EXT__=1'
cpprun='cc -E -Aa'
cppstdin='cc -E -Aa'
cppccsymbols='__hp9000s800=1 __hppa=1 __hpux=1 __unix=1'
d_access='define'
d_locconv='define'
gccversion=''
glibpth='/usr/shlib /shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib
/usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib
/usr/ucblib /pro/local/lib '
libpth='/pro/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib'
toke_cflags='ccflags="$ccflags -DARG_ZERO_IS_SCRIPT"'
And this one for a HP 9000/K250 (hppa-2.0) for HP-UX 10.20:
# grep -i cc config.sh
Mcc='Mcc'
byacc='byacc'
cc='cc'
cccdlflags='+z'
ccdlflags='-Wl,-E -Wl,-B,deferred '
ccflags='-DDEBUGGING -Ae +DAportable -D_HPUX_SOURCE -I/pro/local/include'
ccsymbols='_PA_RISC1_1=1 __CLASSIC_C__=1'
cpprun='cc -E -Aa -D__STDC_EXT__'
cppstdin='cc -E -Aa -D__STDC_EXT__'
cppccsymbols='__hp9000s800=1 __hppa=1 __hpux=1 __unix=1'
d_access='define'
d_locconv='define'
gccversion=''
glibpth='/usr/shlib /shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib
/usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib
/usr/ucblib /usr/local/lib '
libpth='/pro/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib'
toke_cflags='ccflags="$ccflags -DARG_ZERO_IS_SCRIPT"'
------------------------------
Date: Wed, 14 Jul 1999 16:03:16 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: perl's edge -- a beginner's question
Message-Id: <378CFB14.FCFAE781@mindspring.com>
Tad McClellan wrote:
>
> Fernando Morais Dasilva (fmd@wam.umd.edu) wrote:
>
> : i'm just getting started on learning perl. i wanted an example of
> : something that perl can do easier that c, c++ would take a lot more
> : effort.
>
> Go write a dos2unix line-ending convertor in C or C++.
> ( I have never heard of the c and c++ languages that
> you refer to...)
>
> Then compare it to Perl:
>
> perl -p -i -e 's/\r//g' filenames...
>
That's hardly fair. perl *is* that dos2unix line-ending converter,
written in C. It just has a lot of other stuff, too... ;-)
--
... if the problem persists ... get a 3.5 ft ... length of sucker rod
and have a chat with the user in question.
-- Linux System Administration,
SYSLOGD (8), page 7
(Dealing with DOS attacks exploiting SYSLOGD)
------------------------------
Date: Tue, 13 Jul 1999 16:44:15 -0500
From: "Daniel Ulrich" <shades__@mitec.net>
Subject: Re: perl's edge -- a beginner's question
Message-Id: <378d055b@news5.newsfeeds.com>
Keith G. Murphy <keithmur@mindspring.com> wrote in message
news:378CFB14.FCFAE781@mindspring.com...
> Tad McClellan wrote:
> >
> > Fernando Morais Dasilva (fmd@wam.umd.edu) wrote:
> >
> > : i'm just getting started on learning perl. i wanted an example of
> > : something that perl can do easier that c, c++ would take a lot more
> > : effort.
> >
> > Go write a dos2unix line-ending convertor in C or C++.
> > ( I have never heard of the c and c++ languages that
> > you refer to...)
> >
> > Then compare it to Perl:
> >
> > perl -p -i -e 's/\r//g' filenames...
> >
> That's hardly fair. perl *is* that dos2unix line-ending converter,
> written in C. It just has a lot of other stuff, too... ;-)
> --
> ... if the problem persists ... get a 3.5 ft ... length of sucker rod
> and have a chat with the user in question.
> -- Linux System Administration,
> SYSLOGD (8), page 7
> (Dealing with DOS attacks exploiting SYSLOGD)
No, you have it all wrong. PERL like its name implies (Practical Extraction
and Report Language) is unlike any other language out there. Instead of
working fast with numbers (like c and c++) it works fast with words. The
only real use for PERL is when you are sifting or shifting huge amounts of
textual data. This makes it ideal for the internet where you need to be able
to parse the environmental variables. So it is not better or worse it just
has a different application.(just don't try to do graphics in it).
Have Fun,
Shades__
-----------== 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: Wed, 14 Jul 1999 21:06:10 GMT
From: tommylebrun@my-deja.com
Subject: question on mail attachments
Message-Id: <7miu3o$sa1$1@nnrp1.deja.com>
Anyone know how to attach a file to an email then send it? Thanks.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 14 Jul 1999 20:58:26 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Rebol and Perl
Message-Id: <FEvoxE.Crn@news.boeing.com>
In article <931970317.13388@www2.remarq.com>,
Ashish Kadakia <anonymous@web.remarq.com> wrote:
>Hi, I just want to know if anyone has studied Rebol
>language and done any programming which enhances the
>programming in Perl?
>
I believe someone's already hard at work on a Rebol.pm.
Here's Larry's take if you're interested:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1998-10/msg01851.html
--
Charles DeRykus
------------------------------
Date: Wed, 14 Jul 1999 16:22:59 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: regex help needed
Message-Id: <7mirk7$1fnm@fidoii.cc.Lehigh.EDU>
DB<1> $r2 = '(?i)^(\s*(M|F|U)\,?\s*)+$'
DB<2> print '!' if ('mu' =~ /$r2/)
!
I want to allow any of the following (I'll be splitting the input string on
whitespace and any commas.):
m
f
u
m u
m, u
m, f u
...
However, I *don't* want to allow:
mu
uf
...
I can't seem to get the regex right. BTW, our sysadmin hasn't gotten to upgrade
us yet, so I am using 5.00404. the qr// isn't avail to me yet, if that would
make a diff.
TIA,
--
Phil R Lawrence
Lehigh University
Enterprise Systems Implementation
Programmer / Analyst
prlawrence@lehigh.edu - work
prlawrence@planetall.com - personal
--
until (!$self->{'plaid pants'}) { bless $self, $class }
------------------------------
Date: Wed, 14 Jul 1999 16:51:39 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: regex help needed
Message-Id: <7mita0$1dt4@fidoii.cc.Lehigh.EDU>
DB<24> $r3 = '(?i)^(\s*(M|F|U)\,?\s*)(((\s*\,\s*)|\s+)(M|F|U))*$'
DB<25> print '!' if ('m, f, u' =~ /$r3/)
!
DB<26> print '!' if ('u, f m' =~ /$r3/)
!
DB<27> print '!' if ('m, f, u, f' =~ /$r3/)
!
DB<28> print '!' if ('mu' =~ /$r3/)
Well, this is better, but I see it allows the repitition of characters. each
should only be available once...
Phil
Phil R Lawrence <prlawrence@lehigh.edu> wrote in message
news:7mirk7$1fnm@fidoii.cc.Lehigh.EDU...
> DB<1> $r2 = '(?i)^(\s*(M|F|U)\,?\s*)+$'
>
> DB<2> print '!' if ('mu' =~ /$r2/)
> !
>
>
> I want to allow any of the following (I'll be splitting the input string on
> whitespace and any commas.):
> m
> f
> u
> m u
> m, u
> m, f u
> ...
>
> However, I *don't* want to allow:
> mu
> uf
> ...
>
> I can't seem to get the regex right. BTW, our sysadmin hasn't gotten to
upgrade
> us yet, so I am using 5.00404. the qr// isn't avail to me yet, if that would
> make a diff.
>
>
> TIA,
> --
> Phil R Lawrence
> Lehigh University
> Enterprise Systems Implementation
> Programmer / Analyst
> prlawrence@lehigh.edu - work
> prlawrence@planetall.com - personal
>
> --
> until (!$self->{'plaid pants'}) { bless $self, $class }
>
>
------------------------------
Date: 14 Jul 1999 15:11:48 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Search array
Message-Id: <xkfbtdfkkbv.fsf@valdemar.col.hp.com>
"Mark Wisniewski" <ski@northwood.edu> writes:
> How do I search the /etc/passwd file for a unique uid and exit the script if
> the user exist or continue on if the user doesn't exist.
>
> I'm trying this right now:
#!/usr/bin/perl -w
use strict;
> # Check to see if user Number exist in user database
> # If not Display message and exit script.
> print "Enter new Student Number or Employee Number: ";
> $newuid = <STDIN>;
my $newuid = <STDIN>; # always use "my" unless you need a global
# read the perlsub manpage to figure out when that
# is
> chop($newuid);
chomp($newuid); # read the documentation in 'perldoc -f chomp' and
# 'perldoc -f chop' to see why you don't want chop.
> (system "cat /etc/passwd | grep $newuid") && die ("Student or Employee
> Number already exists!\n");
die "They're already in the system, dude" if (getpwuid($newuid));
# Your way was backwards, because the return value from a successful
# system call is 0, so the && part would never get called
# In general, it's best to avoid calls to system(), and use built-in Perl
# functions whenever possible. See the docs for the getpwuid() call for
# more info.
> # If not, go ahead and add the user
> system "/usr/sbin/useradd -u $newuid -d /export/home/$newname -s /bin/ksh
> newname";
There's not much better way to do this one, offhand. You don't mention
where $newname comes from, but you should be able to generalize from what
I've given you here.
-=Eric
------------------------------
Date: Wed, 14 Jul 1999 12:36:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <0beim7.srj.ln@magna.metronet.com>
Greg Bacon (gbacon@itsc.uah.edu) wrote:
: In article <slrn7ol8bk.h7.abigail@alexandra.delanet.com>,
: abigail@delanet.com (Abigail) writes:
: : Greg Bacon (gbacon@cs.uah.edu) wrote on MMCXLI September MCMXCIII in
: : <URL:news:7mcuea$19n$1@info2.uah.edu>:
: : ''
: : '' 178 414.2 (201.3/135.0/127.6) abigail@delanet.com
[ snip Abigail's question about the stats posting ]
: From the Notes section of the stats:
[ snip the answer to Abigail's question that was in the stats posting ]
Oh, the awful irony!!!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 11:56:31 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Test if a File Exists?
Message-Id: <fvbim7.2kj.ln@magna.metronet.com>
Vice Admiral Acker (KamiBot@rotfl.com) wrote:
: Subject: Test if a File Exists?
^^^^^^^^^^^
: How would I test if a file existed or not?
You would look for it in the files that came with your perl.
NOT post to Usenet!
perl -ne 'print "$ARGV: $_" if /File Exists/i' *.pod
perlfunc.pod: -e File exists.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 145
*************************************