[7664] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1290 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 8 17:07:21 1997

Date: Sat, 8 Nov 97 14:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 8 Nov 1997     Volume: 8 Number: 1290

Today's topics:
     Re: Better Way in Perl <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Better Way in Perl (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Better Way in Perl (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: CGI tools <leog@cyberenet.net>
     Checking an inbox w/Perl for Win32 (COWBYS)
     Chopping up those variables <TJRiley@btinternetNOSPAM.com>
     Re: Chopping up those variables (Tad McClellan)
     Re: dbm & Perl hash tables <rra@stanford.edu>
     dealing with frames output (Calvin W. S. Wong)
     Re: dealing with frames output <billg@networkapparel.com>
     Formatting Decimals.. <ryanr@poolpros.com>
     Re: Formatting Decimals.. (Tad McClellan)
     Re: Help! with CGI <medcon@euronet.nl>
     PERL & BLAT Experts - COME FORTH !! john@housekeeping.com
     Perl and .htaccess (Jesse I. Vermont)
     PERL MANUAL!!! <opbruno@correio.cc.fc.ul.pt>
     Re: PERL MANUAL!!! <uzs7ci@ibm.rhrz.uni-bonn.de>
     Re: PERL MANUAL!!! <billg@networkapparel.com>
     Re: Perl web page counter troubles <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Print output contains extra characters (James Gryga)
     Running Unix from inside perl script tbergman@tkb.com
     Re: Running Unix from inside perl script (Tad McClellan)
     Re: scalar function weird <rra@stanford.edu>
     Sum of Lines (Abe Davidson)
     Re: Wrapping of Strings/Lines (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 8 Nov 1997 05:28:25 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Better Way in Perl
Message-Id: <641pbk$h38@bgtnsc02.worldnet.att.net>


Abigail wrote in message ...
>Creede Lambard ($_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print) wrote on
>++
>++ I think you'd have to do something like
>++
>++ perl -e"for(<*>){/(\.cin){1}$/&&`mv $_ $\``}"
>
>The {1} is pointless, it still matches foo.cin.cin. If you don't want
>to match that, you'd need something else.


Hm, you're right. {m,n} isn't as exclusive as I thought. :/ Seems like there
ought to be some way to check for a single "b" so "flub" and "blub" (and
"blubber") would match but "flu" and "flubber" would not, but danged if I
can think of it at 5:30 in the morning. :D

At any rate the original post said

>There are files such as  '.cin' '88cin' '4.cinn' '6.cin.cin' also
>in the directory.  There can't be any errors here.

with the implication that those files shouldn't be altered, only the ones
that end in only one .cin. So you would have to do something different. I
got this to work:

perl -e"$x='\.cin';for(<*>){/$x$x/||(/$x$/&&`mv $_ $\``)}"

58 characters (not counting the newline :D) but it renamed:

test1.cin       -> test1
test2.cin       -> test2
test3xcin       -> test3xcin
test4.cin.cin   -> test4.cin.cin

If it's OK for foo.cin.cin to be renamed to foo.cin, Abigail's fine
solutions beat anything I was able to come up with (I topped out at 40).

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl






------------------------------

Date: Sat, 08 Nov 97 15:00:44 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Better Way in Perl
Message-Id: <3464c579$3$ofn$mr2ice@speaker>

In <slrn668ap0.kcu.abigail@betelgeuse.wayne.fnx.com>, on 11/08/97 at 09:02 AM,
   abigail@fnx.com (Abigail) said:
+-----
| Furthermore, you can save chars by using a map:
| perl -e'map{`mv $_ $\``if/\.cin$/}<*>'
+--->8

Gick.  Saving chars at the expense of spawning two subprocesses, collecting
their output, and then throwing it away.  (Even if you optimize out the
collection, you're still using `` in a null context.)

There comes a point at which these kinds of games get ridiculous....

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH



------------------------------

Date: Sat, 08 Nov 97 15:04:15 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Better Way in Perl
Message-Id: <3464c714$4$ofn$mr2ice@speaker>

In <641pbk$h38@bgtnsc02.worldnet.att.net>, on 11/08/97 at 05:28 AM,
   "Creede Lambard" <$_=qq!fearless@NOSPAMio.com!;y/A-Z//d;print> said: +-----
| Hm, you're right. {m,n} isn't as exclusive as I thought.
+--->8

It is, but since you didn't anchor it to anything else nothing stops the regex
from matching a string which has a second copy of the expression *before* it. 
That is, if you do ($a = '6.cin.cin'; $a =~ /(\.cin){1}$/; you'll find that $`
eq '6.cin'.

That doesn't mean it can't be done, it juist means that the naive approach
won't work:  Perl doesn't cater to naivete.  (A point I might echo in another
thread....)

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH



------------------------------

Date: Sat, 08 Nov 1997 10:12:29 -0500
From: Bill Guindon <leog@cyberenet.net>
To: Zenin <zenin@best.com>
Subject: Re: CGI tools
Message-Id: <3464815C.85763933@cyberenet.net>

This is a multi-part message in MIME format.
--------------E7A8A86B023676D26E2793B8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I recently came from the world of Cold Fusion, and now am forced(?) into the world
of perl.  I'm having a ball!

Did CF for about a year.  Built www.southjersey.com with it.  It IS very easy to
learn, and I think it is quite powerful.

Having recently made the transition to perl, I'm still a little weary (much to
learn yet), but I can say that it too, is VERY powerful, seems to be relatively
safe, and is much easier to learn than I expected it would be (at least enough to
function).

Two huge benefits of perl over CF:
    1. Existing Programmers:  We had to train everyone on CF!  That took a lot of
time, was quite expensive, and we had no way of 'predicting' their ability to work
with the language.
        The pool of existing perl programmers is huge, and it seems easy to find
someone with a PROVEN track record.

    2. Existing Code:  There is incredibly little 'free' CF code out there.  When
I left my last job, we were just starting to talk about store fronts.  We were
taking a split path, purchasing a couple, and developing our own.  But those were
our ONLY choices.
        I switched to perl, and thanks to the MANY (over 20 that I know of)
shareware (and FREEware) store fronts, I was able to have one up and (almost?)
running in a couple of weeks.

Check it out at:
http://www.networkapparel.com  (it's not fully functional yet, but will be soon).

Zenin wrote:

> Connie Wang <c0w0461@unix.tamu.edu> wrote:
> > I know all you guy said is correct. The thing is I am doing a project
> > on dynamic database. I prefer to use win32odbc, but my boss  prefer to
> > use cold fusion.
>
>         Sorry to hear that.  I'd just get a new boss if I were you. :-)
>
> > Bcause Cold fusion is labeled as easy to learn and easy to use, and
> > most people thought it is difficult to learn pearl. I don't know how
> > to persuade him.
>
>         Well, NT is labeled as, "easy to learn and easy to use", but I
>         would _never_ recommend running a production server of any kind
>         to anyone off it.  Sure, when you first start using it it's really
>         easy to do the basic stuff, but as soon as you want to do anything
>         even remotely non-basic you're soon in a huge pile of, "this would
>         be a day of work under Unix, but to make NT do it meens 3 weeks of
>         development time and it's still not going to _ever_ be able to do
>         all of what we want...".
>
>         The basic thing to remember is,
>                 Easy != Efficient
>
>         For the projects I do cold fusion and friends would _never_ even be
>         given five minutes of my time.  I'd rather reinvent a better wheel
>         then have to invent a way to make someone else's wheel turn
>         sideways.
>
> --
> -Zenin (zenin@best.com)
>  The Bawdy Caste (San Jose, CA)       http://www.netmagic.net/~dmcgrath/bawdy/
>  Barely Legal   (Berzerkly, CA)                    http://www.barelylegal.org/
>  Zenin's Rocky Archive (Moving soon!)              http://www.best.com/~zenin/



--------------E7A8A86B023676D26E2793B8
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Guindon
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Bill Guindon
n:              Guindon;Bill
email;internet: leog@cyberenet.net
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------E7A8A86B023676D26E2793B8--



------------------------------

Date: 8 Nov 1997 13:59:00 GMT
From: cowbys@aol.com (COWBYS)
Subject: Checking an inbox w/Perl for Win32
Message-Id: <19971108135900.IAA23083@ladder02.news.aol.com>

I am looking for a way to use Perl for Win32, on NT 4.0 with exchange,  to
 check an email inbox.
Like anyone else, I use Perl to send email messages using an SMTP command line
 client, but can I use it to check an inbox, and say, copy incoming messages
 into a directory, or something close to that.

Basically , I want to be able to get any new messages, copy each message to a
 file, and then ftp that file somewhere.

I dont think Perls support for MAPI is very strong, atleast not the
 documentation that I have checked, for the record, I have seen the new
 "Learning Perl for Win32" book from Oreilly, and it had about 2 pages of info
 on MAPI : ^ (

any help greatly appreciated....   DCF


------------------------------

Date: Sat, 08 Nov 1997 19:22:22 +0000
From: "Tom Riley" <TJRiley@btinternetNOSPAM.com>
Subject: Chopping up those variables
Message-Id: <642eb9$20p@neon.btinternet.com>

I need to take a string variable and be able to put the first 40 words of it
into another variable. I have tried to do this is various ways with little
success. Is there a simple way to do this?

Please CC any replies to my email address,
Thanks
Tom Riley


-------------------------------------
To reply, remove NOSPAM from address
-------------------------------------



------------------------------

Date: Sat, 8 Nov 1997 14:04:20 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Chopping up those variables
Message-Id: <4kg246.ta5.ln@localhost>

Tom Riley (TJRiley@btinternetNOSPAM.com) wrote:
: I need to take a string variable and be able to put the first 40 words of it
: into another variable. I have tried to do this is various ways with little
: success. Is there a simple way to do this?


Yes. The simple way is to look it up in the Perl Frequently Asked
Questions list (part 6):

   "How do I process each word on each line?"


: Please CC any replies to my email address,

: -------------------------------------
: To reply, remove NOSPAM from address
: -------------------------------------


To receive replies, remove NOSPAM from address.


You ask a question that is in the FAQ (ie. you are expected to look
those up before posting them for the hundredth time...), and then want 
me to jump through hoops to get the answer to you?


LOL, that's a good one...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: 08 Nov 1997 01:45:33 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: dbm & Perl hash tables
Message-Id: <m3en4r3eiq.fsf@windlord.Stanford.EDU>

Matthew Gallagher <mgallagh@extro.ucc.su.oz.au> writes:

> I'm trying (with alot of problems) to construct a database using Perl
> and the standard function build with in "dbm". I'm sure I have to use
> has table so I can store the data into the "dbm" can anybody help me
> with actually getting the hash table into the "dbm"

Have you already read perldoc GDBM_File (or whatever variety of dbm you're
using)?  What are you having trouble with specifically?

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: Sat, 08 Nov 1997 16:18:23 GMT
From: cwswong@schoolmail.com (Calvin W. S. Wong)
Subject: dealing with frames output
Message-Id: <34648dea.9349895@news.netteens.net>

Hello,

I'm currently writing a message board script. When there's a new
message posted to the script, the script will save the title of the
message into a file called title.html, which is the upper frame to be
shown in the browser, and also a file messageXX.html, for the bottom
frame in the browser. There is a file called index.html to initialize
the two frames.

Suppose the form for filling in the message is at the bottom frame,
after processing by the script, both the upper frame and the lower
frame should be reloaded.

Here's the problem:
If I just use  [  print "Location: index.html"; ] in the script, then
the browser will draw two new frames within the lower frame.
So what should I do in order to do reload the two frames at the same
time?

Thanks.

Calvin Wong.


------------------------------

Date: Sat, 08 Nov 1997 16:11:54 -0500
From: Bill Guindon <billg@networkapparel.com>
Subject: Re: dealing with frames output
Message-Id: <3464D599.D35EE1EB@networkapparel.com>

This is a multi-part message in MIME format.
--------------912CFCDD3CD119640B307CE5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I'm not sure exactly how you can do it, but it looks like you need a:
TARGET="_top"
in there somewhere.

Calvin W. S. Wong wrote:

> Hello,
>
> I'm currently writing a message board script. When there's a new
> message posted to the script, the script will save the title of the
> message into a file called title.html, which is the upper frame to be
> shown in the browser, and also a file messageXX.html, for the bottom
> frame in the browser. There is a file called index.html to initialize
> the two frames.
>
> Suppose the form for filling in the message is at the bottom frame,
> after processing by the script, both the upper frame and the lower
> frame should be reloaded.
>
> Here's the problem:
> If I just use  [  print "Location: index.html"; ] in the script, then
> the browser will draw two new frames within the lower frame.
> So what should I do in order to do reload the two frames at the same
> time?
>
> Thanks.
>
> Calvin Wong.



--------------912CFCDD3CD119640B307CE5
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Guindon
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Bill Guindon
n:              Guindon;Bill
org:            Network Apparel Web Designers
email;internet: billg@networkapparel.com
title:          V.P. Programming
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------912CFCDD3CD119640B307CE5--



------------------------------

Date: Sat, 08 Nov 1997 01:58:35 -0800
From: Ryan Rose <ryanr@poolpros.com>
Subject: Formatting Decimals..
Message-Id: <346437CB.C7C3A8A8@poolpros.com>

Sorry for the simple question.. could not find it in my books..

Can someone tell me how to format decimal values so I can either pad the
front, or require 2 places after the decimal point?

I am trying to format out currency correctly.

ie $4.677 would be $4.68

    Ryan




------------------------------

Date: Sat, 8 Nov 1997 08:40:00 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Formatting Decimals..
Message-Id: <0kt146.ic4.ln@localhost>

Ryan Rose (ryanr@poolpros.com) wrote:
: Sorry for the simple question.. could not find it in my books..
                                                    ^^^^^^^^^^^

It is difficult to find things in some books.

It is easy to find things (ie. do a word search across many files) 
in the documentation that is shipped with every proper perl distribution. 

The information is more accurate too, as books age quickly, and the 
Perl docs are updated to match the perl version that *you have*.

All experienced programmers (well, the clever ones anyway) check the
documentation that came with a program when they have a question
about the program   ;-)

This is a productivity increasing technique. The answer can often be
had in a couple of minutes. Usenet takes too long.


: Can someone tell me how to format decimal values so I can either pad the
      ^^^^^^^^^^^^

The documentation that is shipped with every proper perl 
distribution can.

But you need to look there, of course  ;-)


: front, or require 2 places after the decimal point?
                                       ^^^^^^^^^^^^^
                                       ^^^^^^^^^^^^^

When I search for 'decimal point' I find only eight matches.

One of those says:

   "   .number "precision": digits after decimal point for floating-point,"

Looks promising. When you have a look at the larger context, you see
that this occurs under the description of sprintf() in the 'perlfunc'
man page.

So I would guess that sprintf() does what you're asking for  ;-)


: I am trying to format out currency correctly.

But you don't say what kind of currency.


: ie $4.677 would be $4.68

Looks like U.S. Dollars though (c.l.p.m is international, you know  ;-)


   # pad the front AND require two decimal places.
   $rounded_num = sprintf "%8.2f", $num;


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: 8 Nov 1997 12:18:40 GMT
From: "Alwin Bijvoet" <medcon@euronet.nl>
Subject: Re: Help! with CGI
Message-Id: <01bcec37$f4042500$243f86c2@default>



Toutatis <toutatis@_SPAMTRAP_toutatis.net> wrote in article
<toutatis-ya023180000711971436070001@news.euro.net>...
> Alwin Bijvoet <info@audiovisueel.com> wrote:
> 
> > Hello,
> > 
> > I am using win95
> > I installed perl for Win32 Build 306 (apr 97)
> > I am using frontpage97
> > The problem:
> > When I try tu run a cgi-script I get the error message:
> > 
> >   CGI Error
> >   The specified CGI application misbehaved by not returning a complete
set
> > of HTTP headers. The headers it did return are:
> >   Can't open perl script "_vti_cnf": Permission denied
> > 
> > What to do?
> 
> Jump out of the window.
> 

I won't help. I am working in the basement.
Thanks anyway

> -- 
> Toutatis
> 


------------------------------

Date: Sat, 08 Nov 1997 15:51:17 -0600
From: john@housekeeping.com
Subject: PERL & BLAT Experts - COME FORTH !!
Message-Id: <879025393.13872@dejanews.com>

Trying to get a shopping cart script to run perfectly on my NT. Order
process script files work perfectly - only problem left is getting the
conformation email messages to get sent.  Trying to use Blat v1.5.

Can call BLAT without any trouble from the commandline - email works fine.

My SMTP server is on the same box as the shopping cart script files, Perl
and Blat.

Please visit the following URL and see if you can see where I am going
wrong.	You will be looking at what is checkout.pl - the last in a series
of script files that I needed to change the file extensions on from .cgi
to .pl so it would work with my PERL for NT software.

http://www.housekeeping.com/autocart/checkout.txt

I did -install my SMTP hostname and the default sender address

John Happy III
john@housekeeping.cm
http://www.storehouses.com/htsy/

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Sat, 8 Nov 1997 13:02:41 -0600
From: jiv@webstyles.com (Jesse I. Vermont)
Subject: Perl and .htaccess
Message-Id: <MPG.ece734a59a99e12989683@news.mcs.com>

I'm working on a Perl project in which I need to, via a web browser, 
create a series of subdirectories, with associated usernames and 
passwords for each new sub created. (sub)directory names will be 
collected/created via .html forms and created upon submission of the 
form, as will the usernames and passwords for those new directories. The 
usernames and passwords will be referrenced/validated via .htaccess and 
 .htpasswd. 
Any ideas how I can accomplish this? I've managed to create subs in the 
Admin directory, but none directly from the Client directory, where I 
need them to go. 
btw, the OS is Solaris v2.5.1.
Any help would be greatly appreciated.


------------------------------

Date: Sat, 8 Nov 1997 15:14:19 +0000
From: Bruno Matias - Fcul WebMaster <opbruno@correio.cc.fc.ul.pt>
Subject: PERL MANUAL!!!
Message-Id: <Pine.LNX.3.95.971108151306.20945A-100000@correio.cc.fc.ul.pt>


Does anyone know where i can get a good PERL manual for download iin a
single file? Or else a site with a good PERL manual instead?
I've got some urgence on this...
Thanks

          __________________________________________________________
         |   Bruno Berenguer |URL:                                  |
_________|                   |    correio.cc.fc.ul.pt/~opbruno      |_________
\        |    A.K.A. TheOne  |E-MAIL:                               |        /
 \       |                   |    bebm@fc.ul.pt                     |       /
  \      |----------------------------------------------------------|      /
   \     |"Pelo amor muitos perdem a razao...                       |     /
   /     | Mas pela razao, muitos perdem o amor...                  |     \
  /      |                       <<>>                               |      \
 /       |__________________________________________________________|       \
/____________)                                               (_______________\




------------------------------

Date: 8 Nov 1997 19:19:53 +0100
From: Oliver Much <uzs7ci@ibm.rhrz.uni-bonn.de>
Subject: Re: PERL MANUAL!!!
Message-Id: <642ag9$11r@walras.econ.de>

Bruno Matias - Fcul WebMaster <opbruno@correio.cc.fc.ul.pt> wrote:

BM-FW>Does anyone know where i can get a good PERL manual for download iin a
BM-FW>single file? Or else a site with a good PERL manual instead?

Well, as you're using LinuX you may just enter 'man perl' and you have your 
docs.Also have a look at the FAQ on www.perl.com or in your perl directory.

And after that you should minimize your footer to 2 lines :-)

[ very huge footer ]

-- 
Oliver Much                                - UZS7CI@IBM.RHRZ.UNI-BONN.DE -


------------------------------

Date: Sat, 08 Nov 1997 15:40:37 -0500
From: Bill Guindon <billg@networkapparel.com>
Subject: Re: PERL MANUAL!!!
Message-Id: <3464CE44.25758709@networkapparel.com>

This is a multi-part message in MIME format.
--------------C73F7089BE68F35C8194E238
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

These should help for now.  Choose your version.

"Search Perl 5 Manual"
http://www.cclabs.missouri.edu/cgi-bin/perlman.cgi

"This web document is a re-organized version of the "perl.1" man page for PERL
version 4."
http://www-cgi.cs.cmu.edu/cgi-bin/perl-man

Bruno Matias - Fcul WebMaster wrote:

> Does anyone know where i can get a good PERL manual for download iin a
> single file? Or else a site with a good PERL manual instead?
> I've got some urgence on this...
> Thanks
>
>           __________________________________________________________
>          |   Bruno Berenguer |URL:                                  |
> _________|                   |    correio.cc.fc.ul.pt/~opbruno      |_________
> \        |    A.K.A. TheOne  |E-MAIL:                               |        /
>  \       |                   |    bebm@fc.ul.pt                     |       /
>   \      |----------------------------------------------------------|      /
>    \     |"Pelo amor muitos perdem a razao...                       |     /
>    /     | Mas pela razao, muitos perdem o amor...                  |     \
>   /      |                       <<>>                               |      \
>  /       |__________________________________________________________|       \
> /____________)                                               (_______________\



--------------C73F7089BE68F35C8194E238
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Guindon
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Bill Guindon
n:              Guindon;Bill
org:            Network Apparel Web Designers
email;internet: billg@networkapparel.com
title:          V.P. Programming
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------C73F7089BE68F35C8194E238--



------------------------------

Date: Sat, 8 Nov 1997 11:35:25 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Perl web page counter troubles
Message-Id: <642erk$aq0@bgtnsc02.worldnet.att.net>

Hmmmm . . . I think I'd simplify this just a bit:

#!/usr/bin/perl
#
# your path may vary   :D

print "Content-type: text/plain\n\n";
open(COUNT,"ezcount.dat") or die "Can't read from ezcount.dat";
$visitors = <COUNT>;
$visitors++;
print "You are visitor #",$visitors,"\n";
close COUNT;        # I think this is optional but I'm putting it in anyway
open(COUNT,">ezcount.dat") or die "Can't write to ezcount.dat";
print COUNT $visitors;
close COUNT;

Maybe closing the file and opening it instead of opening it read/write will
help.

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl

Bruce Seiler wrote in message <3463925b.5961640@news.intac.com>...
>I'm trying to use the following script to record hits to my
>web page.
>
>#!/usr/local/bin/perl
>print "Content-type: text/plain", "\n\n";
>open (COUNT, "+<ezcount.dat") || die "Cannot read
>from ezcount.dat.\n";
>$visitors = <COUNT>;
>$visitors = $visitors + 1;
>print $visitors;
>seek (COUNT, 0, 0);
>print COUNT $visitors;
>close (COUNT);
>
>I call it as a server side include from my home page
>index.shtml using:
>
><P><!--#exec cgi="/cgi-local/ezcount.pl" --></P>
>
>It works fine for a while, recording hits and incrementing
>the count as expected. But every couple of days, the
>count gets lost, and starts again from zero. I can't figure
>out why. Could there be a problem when two people hit
>the page at the same time? If so, can it be fixed? Or
>maybe it's something else. I have the feeling I'm
>overlooking something fundamental. I'd really
>appreciate help.
>
>Thanks,
>Bruce Seiler
>bjs@intac.com




------------------------------

Date: Sat, 8 Nov 1997 12:58:32 GMT
From: jamesgry@netcom.com (James Gryga)
Subject: Re: Print output contains extra characters
Message-Id: <jamesgryEJBw1K.F70@netcom.com>


Hi again

My sincerest apologies for wasting bandwidth and wasting your time with 
my last post but I found out what was causing the unwanted printout.

I had edited the three files that contain the word lists in TextEdit.  I 
still think it's a very good text editor.  Well, orginally, I had the 
word lists as arrays, for example:  @array = ("boy", "pen", "cup", ...) you 
get the idea.  When I moved the arrays to separate files, I just did your 
basic 'replace' go get rid of all the quotes and to insert returns after 
each word so that each word would be on sepatate line.  Looking at the 
results in TextEdit, it looked fine so I had no reason to think that 
anything was wrong.  But when I brought the files to my linux side of the 
PC, Lo and BeHold, the quotes and commas were still there.  This was the 
last thing I was expecting to find.  So I looked at the word files again 
that were still in the Win95 folder.  They too had all the quotes and 
commas.  Unless I had set something in TextEdit that I'm not familiar 
with (most likely) this is probably just one of those "things that happen".
So I got rid of them again this time using perl (should have done it in 
the first place) and this little program works fine now.

The lesson here is the causes of unwanted results can reside in the most 
unlikely places.

Again, many thanks to all who cared.

	jim



------------------------------

Date: Sat, 08 Nov 1997 09:43:51 -0600
From: tbergman@tkb.com
To: tbergman@tkb.com
Subject: Running Unix from inside perl script
Message-Id: <879003158.30966@dejanews.com>

Can anyone help?

I am attempting to interact with the telnet program from within a perl
program. The task is simply to verify a list of email addresses at a
particular domain. Perl provides facilities to pipe input either from or
to a unix program. I can get the perl program to launch telnet with a
command such as:

open (IN,"telnet somewhere.com 25 |");
while (<IN>){
print "$_";
}

This captures the output of the telnet program and prints it to the
screen. At this point I get stuck. I cannot seem to send any additional
strings to the telnet program. I have tried to open additional handles. I
have tried to use the backquote mechanism to execute a command in
unix--but to no avail. Can you tell me how to send additional information
to the active telnet session. I need to perform some processes between
strings sent that depend on the output I am getting from the telnet
session, e.g. save good addresses to another file, get the next address,
etc.

Can you recommend a book that would cover this topic?

Any help is appreciated.

Tom Bergman

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Sat, 8 Nov 1997 14:08:49 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Running Unix from inside perl script
Message-Id: <hsg246.ta5.ln@localhost>

tbergman@tkb.com wrote:
: Can anyone help?


Yes.

The documentation that is shipped with every proper perl distribution
can help.

Do you have perl installed?

from the Perl FAQ, part 8:

   "How can I open a pipe both to and from a command?"


: unix--but to no avail. Can you tell me how to send additional information
: to the active telnet session. I need to perform some processes between
: strings sent that depend on the output I am getting from the telnet
: session, e.g. save good addresses to another file, get the next address,
: etc.

: Can you recommend a book that would cover this topic?


Yes.

The documentation that is shipped with every proper perl distribution.


: Any help is appreciated.

Any checking of the docs before posting is appreciated ;-)


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: 08 Nov 1997 01:42:33 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: scalar function weird
Message-Id: <m3hg9n3enq.fsf@windlord.Stanford.EDU>

mehta <mehta@mama.indstate.edu> writes:

>  #!/usr/bin/perl
>  print ">>$/<<\n";
>  $/ = "";
>  open (IN, "<in.txt") or die "cannot open file in.txt $!\n";
>  if (1 == 1) {
>          local($all) = scalar (<IN>);
>          print "ALL: $all";
>          close (IN);
>  }

What do you find strange about it?  It appears to be working precisely as
documented.  <FILEHANDLE> in a scalar context reads a file up to the next
line terminator, and you've put Perl into "paragraph mode" by setting $/
to the empty string, which means that it will read up to the next blank
line.

Or are your results different than that?

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: Sat, 08 Nov 1997 19:02:45 GMT
From: abe@allied.demon.co.uk (Abe Davidson)
Subject: Sum of Lines
Message-Id: <879015795.5643.0.nnrp-08.9e982204@news.demon.co.uk>

I have a subroutine which uses;
$totalhours = ($quantity * $rate) + $totalhours.

This is a per line subroutine which adds work done from a pipe d/base
and calculates a total of hours worked, factored for various items,
e.g., rain, snow, cold = represented by $rate, (the factor). I input
the quantity per row and can change it, add other rows and
re-calculate, endlessly.

If I use a howgozit row at any point in the (unlimited) rows, I get
the correct factored totals  up to and including the row where I have
inserted the howgozit, rows which I add after the howgozit not
included in totals. I like to workaround that for interest.

What change to;
$totalhours =  ($quantity * $rate) + $totalhours
would cause an actual total (of all rows) instead of the present
running totals up to the howgozit.
My Dos stuff would be @sum(rowx..rowy)
Whats the perl alternative.
Thks...




------------------------------

Date: Sat, 8 Nov 1997 07:36:46 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Wrapping of Strings/Lines
Message-Id: <etp146.i34.ln@localhost>

Ravi Pina (ravi@iagnet.net) wrote:
: I have a string that I'd like to insert a \n every, n characters.  Is
: there an easy way of doing this?


----------------------------
#!/usr/bin/perl -w

$n = 12;

$_ = q/I have a string that I'd like to insert a \n every, n characters./;
s/(.{$n})/$1\n/g;
print "$_\n\n";


use Text::Wrap;
$Text::Wrap::columns = $n;

$_ = q/I have a string that I'd like to insert a \n every, n characters./;
print wrap('', '', $_), "\n";
----------------------------

outputs:

I have a str
ing that I'd
 like to ins
ert a \n eve
ry, n charac
ters.

I have a
string that
I'd like to
insert a \n
every, n
characters.



Whenever your find yourself looking for 'an easy way', it is a good
idea to see if there is a Perl Module that can help.


from the 'perlmodlib' man page, shipped with the perl distribution:

----------------------
=head1 CPAN

CPAN stands for the Comprehensive Perl Archive Network.  This is a globally
replicated collection of all known Perl materials, including hundreds
of unbundled modules.  Here are the major categories of modules:

 ...

For an up-to-date listing of CPAN sites,
see F<http://www.perl.com/perl/CPAN> or F<ftp://ftp.perl.com/perl/>.
----------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 1290
**************************************

home help back first fref pref prev next nref lref last post