[8369] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1986 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 27 18:17:15 1998

Date: Fri, 27 Feb 98 15:00:29 -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           Fri, 27 Feb 1998     Volume: 8 Number: 1986

Today's topics:
    Re: "Or" Operator? <ajohnson@gpu.srv.ualberta.ca>
    Re: &ReadParse not working in PerlScript ASP <heidi.housten@edt.ericsson.data>
    Re: &ReadParse not working in PerlScript ASP <barnett@houston.Geco-Prakla.slb.com>
    Re: CGI_lib.pl and upload bug ? on Enterprise 3 (Abigail)
    Re: CGI_lib.pl and upload bug ? on Enterprise 3 (William R. Ward)
        Does putting the word "newbie" as subject help? <Geert.Roovers@POBoxes.com>
    Re: Does putting the word "newbie" as subject help? <mindmore@mindless.com>
    Re: extract part of a string <joseph@5sigma.com>
    Re: Function evaluation within strings? <jim.michael@gecm.com>
    Re: Function evaluation within strings? <tchrist@mox.perl.com>
    Re: Generic Config-file maintenance (Roy Culley)
    Re: How do you put a string into a array? <barnett@houston.Geco-Prakla.slb.com>
    Re: ICQ within a PERL <Geert.Roovers@POBoxes.com>
        JOB: Hotshot Perl Programmer wanted  xvs-RemoveThisFirst-@yahoo.com
    Re: Killfile Triage (Peter Samuelson)
    Re: many ways but i can not find one (Martin Vorlaender)
    Re: Musings on English.pm <joseph@5sigma.com>
        Need guestbook <scottgperry@hotmail.com>
        param <jacques.huntziger@khe.scn.de>
    Re: performance : is "eq" fast & efficient ? (Charles Bueche)
        Perl and the Windows clipboard (Ben Jones)
        Perl Training UK <tony@furness.co.uk>
    Re: Perl Training UK <alexs@online.emap.com>
    Re: removing new line (\n) <mindmore@mindless.com>
    Re: seeking and changing /etc/passwd (Rahul Dhesi)
    Re: seeking and changing /etc/passwd <joseph@5sigma.com>
    Re: SQL/Perl syntax question about Quotes (Geoffrey Coulter)
    Re: The Ineffable Tom C. (Brian Altheim)
        time matter... <ndufort@cadre.sjsu.edu>
    Re: use system or backticks?? <tchrist@mox.perl.com>
    Re: using a Module (Brian Lavender)
        Viewing local vars in debugger <Matthew.Couchman@bbsrc.ac.uk>
        What does this one-liner do? <oreinert@daimi.aau.dk>
        Why doesn't "tr/\x0D//d" work? <spam@no_spam_please.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Feb 1998 02:11:02 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: "Or" Operator?
Message-Id: <34F67516.5FC93688@gpu.srv.ualberta.ca>

Abigail wrote:
> 
> Jr. (df6954@eecs1.eecs.usma.edu) wrote on 1640 September 1993 in
> <URL: news:34F5DCF1.5032@eecs1.eecs.usma.edu>:
> ++
> ++ There is no value that $var1 can have that will cause execution
> ++ to process the second print statement.
> 
> Wanna bet?

a fetching challenge...perhaps when I'm less tied up :-)

andrew


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

Date: Fri, 27 Feb 1998 10:49:11 +0100
From: "Heidi Housten" <heidi.housten@edt.ericsson.data>
Subject: Re: &ReadParse not working in PerlScript ASP
Message-Id: <6d61uf$6p7@newstoo.ericsson.se>

if you are using perlscript in ASP, then why not access the ASP's
request object instead?
$request->{'fieldname'}
notice that there are 5 request objects, if you don't specify the
object, as I haven't above, then it will search all five , I can't
quite remember them all - something like form,
querystring,cookies,session but check your ASP documentation. The nice
thing about it is when you are testing, you can just put all the info
into the url string instead of having to keep filling in the form...

-Heidi

Alan wrote in message <34F66F2E.4524F265@globalec.com>...
>I am using PerlScript in ASP files to create dynamic pages.  However,
I
>can't get &ReadParse (from cgi-lib.pl) to pickup the info from the
form
>that executes the script.  There is no error, just nothing shows up.
>Help!
>
>Thanks
>Alan Sturm
>
>




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

Date: Fri, 27 Feb 1998 08:12:53 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: &ReadParse not working in PerlScript ASP
Message-Id: <34F6C9E5.7C582538@houston.Geco-Prakla.slb.com>

Alan wrote:
> 
> I am using PerlScript in ASP files to create dynamic pages.  However, I
> can't get &ReadParse (from cgi-lib.pl) to pickup the info from the form
> that executes the script.  There is no error, just nothing shows up.
> Help!
> 
> Thanks
> Alan Sturm

Well...  Please elaborate for us on what you mean by "doesn't show up"?

How about a code snippet?

How about switching to CGI.pm?  Heard tell it is better/easier to use.

Perhaps the script is okay, but the html page that is passing it info is
not?  Perhaps nothing is being passed?

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 27 Feb 1998 06:41:46 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: CGI_lib.pl and upload bug ? on Enterprise 3
Message-Id: <6d5n7a$nfc$5@client3.news.psi.net>

mgui@iname.com (mgui@iname.com) wrote on 1640 September 1993 in
<URL: news:6d40fp$k6u$1@nnrp2.dejanews.com>:
++ I use the CGI_lib.pl module to upload files on Netscape Enterprise 3.0I et
++ 3.5.1 on NT 4.0 SP 3 and the binmode command failed the upload. The same
++ script on Netscape Enterprise 2.0 don't bug? Have-you the same problem?

I think cgi_lib was outdated before more than 10 people had
heard of Netscape. Get something modern. People didn't have
to bang rocks together to create CGI.pm.


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 26 Feb 1998 23:49:47 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: Re: CGI_lib.pl and upload bug ? on Enterprise 3
Message-Id: <waapvk9o5b8.fsf@ese.UCSC.EDU>

mgui@iname.com writes:
> I use the CGI_lib.pl module to upload files on Netscape Enterprise 3.0I et
> 3.5.1 on NT 4.0 SP 3 and the binmode command failed the upload. The same
> script on Netscape Enterprise 2.0 don't bug? Have-you the same problem?

I suggest you give up on cgi-lib.pl and switch to CGI.pm instead.  For
more information about the differences between the two, check out some
web pages I put together for a presentation on this very topic.  The
URL is:
	http://www.bayview.com/mindsrc-talk/

--Bill.

-- 
William R Ward          Bay View Consulting   http://www.bayview.com/~hermit/
hermit@bayview.com     1803 Mission St. #339        voicemail +1 408/479-4072
hermit@cats.ucsc.edu  Santa Cruz CA 95060 USA           pager +1 408/458-8862
 PGP Key 0x2BD331E5; Public key at http://www.bayview.com/~hermit/pubkey.txt


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

Date: Fri, 27 Feb 1998 11:16:28 +0100
From: Geert Roovers <Geert.Roovers@POBoxes.com>
Subject: Does putting the word "newbie" as subject help?
Message-Id: <34F6927C.66B4@POBoxes.com>

Hi,

I'm quite new at perl, but already considdered expert here at the office
(no, I cannot convince them that I'm not). Now someone asked me to do
the following:

In some HTML-file, the user can click a button, so that it sends an
e-mail. To this e-mail, there should be a number attached. This number
is the follow-number, so I already made a little script that fetches the
last number from a file, increase it, and write it back to the file. But
now I'm kinda stuck since I just don't know enough.

My questions:
Am I posting in the correct news-group?

If so: is this a FAQ, and if so, where can i find the answer?

If not so: How can I add this number I fetch to the e-mail just before
it is sent?

Greetings, 
~Geert


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

Date: Fri, 27 Feb 1998 13:29:57 +0200
From: Fain <mindmore@mindless.com>
To: Geert Roovers <Geert.Roovers@POBoxes.com>
Subject: Re: Does putting the word "newbie" as subject help?
Message-Id: <34F6A3B5.9C826D80@mindless.com>

OK... here is what I would try.

You say you have already made a script that increases the number and
records it to a fine.
I am assuming that when you recorded it to that file you had the new number
in a variable. Let's call that variable $Number
So, after you finish recording the new number to the file just use $Number
in your sendmail routine and include $Number in it.

I guess the key here is:
1. Both of your CGI scripts (the incrementing number script and the
Sendmail script) are going to have to be in the same script.
2. the Sendmail part of you script has to come after you add the new number
to the file so that we have the proper value of $Number (or whatever you
call it).

- Nathan Fain
mindmore@mindless.com
Geert Roovers wrote:

> Hi,
>
> I'm quite new at perl, but already considdered expert here at the office
> (no, I cannot convince them that I'm not). Now someone asked me to do
> the following:
>
> In some HTML-file, the user can click a button, so that it sends an
> e-mail. To this e-mail, there should be a number attached. This number
> is the follow-number, so I already made a little script that fetches the
> last number from a file, increase it, and write it back to the file. But
> now I'm kinda stuck since I just don't know enough.
>
> My questions:
> Am I posting in the correct news-group?
>
> If so: is this a FAQ, and if so, where can i find the answer?
>
> If not so: How can I add this number I fetch to the e-mail just before
> it is sent?
>
> Greetings,
> ~Geert





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

Date: Fri, 27 Feb 1998 02:14:42 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: extract part of a string
Message-Id: <34F683D8.57AA1E57@5sigma.com>

Using a regular expression is almost always more efficient
than split.  Split is more readable in many cases, but even for
complicated situations a regex is generally considerably faster.

  ($data) = / (\S+) /;

or something like that.  That said, I'm a fan of using split when
efficiency isn't a prime concern.

	-joseph

Brian Lavender wrote:
> 
> On Thu, 26 Feb 1998 03:02:36 -0800, Marty McKolskey <marty@marty.net>
> wrote:
> 
> >Try this:
> >
> >$data  = "data1 data2 data3";
> >@data  = split(/ /,$data);      # splits $data on space
> >$data2 = $data[1];              # $data2 now equals "data2"
> >
> >If you know $data is going to have a fixed length, you can also use
> >substr to pull out the part you need.
> >
> >Maybe not the quickest solution, but it certainly works.
> >
> >Marty
> 
> Why not:
> 
> $data2 = (split ' ', $data)[1];
> 
> A little more efficient.

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Fri, 27 Feb 1998 07:34:59 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Function evaluation within strings?
Message-Id: <34F6B2F3.2942@gecm.com>

John Fisher wrote:
> 
> Is it possible to evaluate a function within a string? I'd like to do
> something like the following:

perldoc -f eval


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

Date: 27 Feb 1998 13:47:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Function evaluation within strings?
Message-Id: <6d6g4r$4bl$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, suing an obfsucated address now entered into my
auto-antispam-conversion list, "John Fisher" <fisher@ers.ibm.com> writes:

:Is it possible to evaluate a function within a string? 

You mean other than the way documented in the standard perlfaq3 manpage
distributed with each and every perl distribution?

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

There ain't nothin' in this world that's worth being a snot over.
	    --Larry Wall in <1992Aug19.041614.6963@netlabs.com>


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

Date: 27 Feb 1998 11:15:16 GMT
From: tgdcuro1@gd2.swissptt.ch (Roy Culley)
Subject: Re: Generic Config-file maintenance
Message-Id: <6d6784$qt0@gd2inews.swissptt.ch>

In article <6cqhh2$k7q$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, 
>     tgdcuro1@swissptt.ch (Roy Culley) writes:
>:> Just make the config file straight perl!  Anything else is dubious
>:> at best.

TMTOWTDI

>:Thats ok for perl hackers but what if the config file is maintained
>:by non-programmers?
> 
> Then teach them quotes, semicolons, and dollar signs.  Even my grandmother
> can do this.

I use to hear remarks like that in primary school.

> 
> To paraphrase Doug Gwyn, Perl was not designed to stop people from doing
> stupid things, because that would also stop them from doing clever things.
> As with GUIs, you infuriatingly penalize everyone else just because
> some people have room-temperature IQs and shouldn't be allowed to feed
> themselves.

The arrogance of that paragraph astounds me. Take a step out of your
ivory tower and enter the real world.

-- 
Roy G. Culley                   Tel: +41 31 342 56 62
Dept. IS-B-53                   Fax: +41 31 342 04 62
Swisscom                      Email: Roy.Culley@switzerland.org
Key fingerprint = 6B AD 68 79 30 0B C0 5F  16 BC 90 57 35 E9 FC 40


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

Date: Fri, 27 Feb 1998 08:05:39 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: How do you put a string into a array?
Message-Id: <34F6C833.FBB5B269@houston.Geco-Prakla.slb.com>

DKD CEO. wrote:
> 
> Seong Y. Kim wrote:
> >
> > Let's say that I have a string "I you he she they me her him
> > his them their", and I want the array like this.
> >
> > $string = "I you he she they me her him his them their";
> >
> > @array;
> > $array [1]= "I";
$array[0] = "I";

> > $array[2]= "you";
$array[1] = "you";

> > $array[3]="he";
$array[2] = "he";

> > .....
> > $array[11]="their";
$array[10] = "their";


Arrays in perl are 0 based (1st element = =0, 2nd element = 1, ...)

> >
> > how do you do this?
> >
> > thanks to .......   ;-)
> 
> Just use:
> 
> @array = $string
> 
Well....  I'm not sure about your implementation of perl, but mine
doesn't do what he asked for.

The above on my system generates a one element array containing the
entire phrase.

Perhaps you meant:
@array = split(' ',$string);

That will split $string on whitespace (spaces, tabs, returns(??)), and
return a *list* of items, each of which will become their own elements
in @array.

If you actually want $array[1] to be "I", and the others to match as you
specified, change the above line to:
@array = (undef, split(' ',$string));   # outside parens required to
actually put right
					# hand side in list context.

That will cause $array[0] to be undefined, and then the rest will match
up as you indicated.

HTH.

Dave

> There ya go!,
> 
> DK!
> +=
> http://dkd.home.ml.org/index.html -Web Design Like You've Never Seen.

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Fri, 27 Feb 1998 08:52:55 +0100
From: Geert Roovers <Geert.Roovers@POBoxes.com>
Subject: Re: ICQ within a PERL
Message-Id: <34F670D7.5628@POBoxes.com>

,u&bD5'Y wrote:
> 
> > Is there anyway of sending a message to an ICQ number from within a perl,
> > and then getting back confirmation that the ICQ was actually on-line.
> 
>   Ask ICQ.com

make that mirabilis.com


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

Date: Fri, 27 Feb 1998 08:07:46 GMT
From: xvs-RemoveThisFirst-@yahoo.com
Subject: JOB: Hotshot Perl Programmer wanted 
Message-Id: <34f6744f.61556770@news2.ibm.net>

We are looking for a hotshot Unix/Perl programmer for a project
starting ASAP, and running through April. More projects are in the
pipeline as well.

Work can be done offsite (for example, if you live in Timbuktu), or
onsite (in San Francisco near South Park). 

Do you:
 - design simple, elegant ways to perform required tasks?
 - write beautiful, clear, readable code?
 - enjoy making everything modular?
 - like experimenting with all the Perl modules just for fun?
 - think ahead and write code that handles various possible error
conditions?
 - have experience writing large systems?
 - know other languages, such as c++ or Java? 

Are you:
 - available for at least 20 hours per week for the next 2 months?

If so, please send a resume and salery requirements to
xvs-RemoveThisFirst-@yahoo.com, and we'll take it from there. Contract
and Permanent (incl stock options) are both possible.

Development is in the Solaris environment. Deployment is on multiple
platforms. Experience with SQL databases, installation scripts, and
Perl under NT are all plusses.


*****************************
I DO NOT want unsolicited e-mail & I will bill you for it.
By US Code Title 47, Sec. 227(a)(2)(B), a computer/modem/printer meets the
definition of a telephone fax machine. By Sec.227(b)(1)(C), it is unlawful to
send any unsolicited advertisements to such equipment, punishable by action
to recover actual monetary loss, or $500, whichever is greater, for each
violation.

Pursuent to US Code, Title 47, Chapters 5, Subchapter II, Sec. 227, any and
all non-solicitied commercial e-mail sent to this address is subject to a
download & archival fee of $500 US.

E-mailing denotes acceptance of these terms.
*****************************


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

Date: 27 Feb 1998 02:41:33 -0600
From: psamuels@sampo.REMOVETHIS.creighton.edu (Peter Samuelson)
Subject: Re: Killfile Triage
Message-Id: <6d5u7t$5rp$1@sampo.creighton.edu>

  [peter caffin <synic@omen.net.au>]
> > Whereas if I receive a bounce message, I read it to find out:
> >   (a) Who didn't get my email,
> >   (b) Why they didn't get my email (system down? misspelled domain?),
> >   (c) What I need to do to get the message through.
[Eli the Bearded  <*@qz.little-neck.ny.us>]
> Very time consuming. Do you get paid to do this?

Not in the case of spamaddr demangling.  (Typos can be harder.)  Most
people do something semi-obvious to the address itself, rather than
outright replace it.  If the person _did_ replace it with
nospam@nowhere.org or whatever, then no, I wouldn't go grep through
news spools to find the original sig with the magic decoder ring.  But
it's usually obvious enough from the address itself.

> Good faith effort to answer some question on the procmail list?
> (People there seem to be intoxicated with the powers of that
> filtering program.)

Ummm, avid procmail users still mangle their addresses?  Why?  As soon
as I get a procmail setup I'm comfortable with (yes, I've been
procrastinating on that one) I'll probably start using my real address
again.

> Recently I have been getting five to ten bounces a week on twenty to
> fifty pieces of email a week, mostly (I suspect) post rejections.

Seems to me it'd save you time to glance at your To: address before
typing stuff out; should take all of, say, five seconds to spot the
average spam-mangled address, and you can probably save at least a
couple minutes not typing the message you were going to type.

-- 
Peter Samuelson
<sampo.creighton.edu ! psamuels>


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

Date: Fri, 27 Feb 1998 05:57:06 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: many ways but i can not find one
Message-Id: <34f647a2.524144494f47414741@radiogaga.harz.de>

~arthur (star@sonic.net) wrote:
: i do not know printf (and can not find the man page)

Let's see: printf is a function, right?

Hey! There's a perlfunc man page -- and it deals with functions!

(as you probably would have found out if you would have cared to look at
the perl man page).

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Fri, 27 Feb 1998 02:29:17 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Musings on English.pm
Message-Id: <34F68743.43AB660F@5sigma.com>

Wow, I can't believe that this actually works:

$_ = "testing one two three";
/one/;
eval q{
    print "before: $`\n";
    print "match: $&\n";
    print "after: $'\n";
};

I think my understanding of the way the match variables work must
be flawed.

	-joseph

schwern@starmedia.net wrote:
> Why not make *MATCH, et al. a tied variable?  The FETCH routine would use eval
> to cause $& not to be mentioned until $MATCH is actually used.  Something
> like...

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Fri, 27 Feb 1998 09:10:05 -0500
From: "Scott G. Perry" <scottgperry@hotmail.com>
Subject: Need guestbook
Message-Id: <34F6C93B.623CDCD8@hotmail.com>

Our company is looking for someone to re-design and write our
guestbook.  It is located at
http://www.apolloind.com/guestbook/addguest.html .  The following
information would need to be added:
Individual's name
Company Name
Address 1
Address 2
City
State
Zip
Country
Phone
Fax
E-mail
Website
Request Information (yes/no)
Comments
Submit Button

The webpage should be plain and efficient.  Information will be posted
to password protected page, and also forwarded to our e-mail address
aerosols@juno.com.  Quote on the entire project, not hourly rate.
Payment made upon test of site.

Please forward quotation to
Scott G. Perry  scottgperry@hotmail.com
Marketing
Apollo Industries
1850 South Cobb Industrial Blvd.
Smyrna, GA 30082
Phn: 770-433-0210
Fax: 770-433-0132
Website www.apolloind.com




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

Date: 27 Feb 1998 12:56:57 GMT
From: "Zeta" <jacques.huntziger@khe.scn.de>
Subject: param
Message-Id: <01bd4380$1f16ba60$840c138e@HUNTZIGE.FR_HAG_01A>

Hello,
Could you help me?
I want to put a param in cgi wrote in perl
I know that in ksh it's $1 for the first param but in perl ???

Zeta



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

Date: Fri, 27 Feb 1998 07:51:30 GMT
From: Charles.Bueche@swisscom.com (Charles Bueche)
Subject: Re: performance : is "eq" fast & efficient ?
Message-Id: <34f66f34.3035256@news.unisource.ch>

On Thu, 26 Feb 1998 18:35:44 -0600, schwern@starmedia.net wrote:



>In article <slrn6fahn4.v6e.Tom.Grydeland@mitra.phys.uit.no>,
>  Tom.Grydeland@phys.uit.no (Tom Grydeland) wrote:
>>
>> On Thu, 26 Feb 1998 10:32:18 GMT,
>> Charles Bueche <Charles.Bueche@swisscom.com> wrote:
>>
>> > Should I use the regex // or is eq better ?
>>
>> Don't take anybody's word for it.
>>
>> use Benchmark;
>
>I think I can say with a fair amount of safety that eq is going to be faster
>than regexes.  However, you should try the Benchmark anyway... if nothing else
>then to learn how to Benchmark.
>
>However, you're approaching this whole efficiency issue from completely the
>wrong angle.  
> ....
[Great tutorial snipped and stored into my know-how database for
later reference.]

The problem is that I have a system (Seagate NerveCenter Pro)
which generate log files and trim them without my control,
anytime it decides to do so. I have to read these log files
and take out the new lines only. I now I could have some sort
of "tail -f" on them, but the whole is very dynamic. They are
created, trimmed, added to, and so on.

I now have take the "heavy but sure" approach where I
read the file until I get the $stamp I did save from the previous
run. 

If I find if,  I rewind and analyze the file from the new
records. If not, I assume the complete content must be analyzed.

It's not that bad anyway as the whole takes under 10 sec
and run only once an hour.

Charles


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

Date: Fri, 27 Feb 1998 10:48:08 GMT
From: ben_j@usa.net (Ben Jones)
Subject: Perl and the Windows clipboard
Message-Id: <34f69912.9604240@jeeves>

Hi,

I'm new to Perl, and I've just written my first few scripts which do
various bits of text processing.
What I'd like to do is incorporate these Perl utilities into my text
editor (TextPad). I can get TextPad to copy selected text to the
clipboard before it runs a Perl script. So the question is this:

Is there a way of using the windows clipboard as the input file for a
Perl script?

(I'm running NT3.51 if that makes a difference)

Thanks,

ben_j@usa.net


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

Date: Fri, 27 Feb 1998 10:44:48 -0000
From: "Tony Kenny" <tony@furness.co.uk>
Subject: Perl Training UK
Message-Id: <6d662m$5h4$1@svr-c-02.core.theplanet.net>

We are intending to host a training course in Cumbria, England possible in
early August of the year.
It is intended that an instructor from Stonehenge
 http://www.perltraining.con ) will conduct the course.
At this stage we are looking for ballpark figures on attendance numbers.
Could anyone who has an interest in such a course please contact me:
tony@furness.co.uk
The price is dependent on numbers but will be very competitive with other UK
course providers.

~Tony Kenny
Furness Internet Limited
Tel: +44 1229 588588
Fax: +44 1229 581050




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

Date: Fri, 27 Feb 1998 13:16:03 +0000
From: Alex Schajer <alexs@online.emap.com>
To: Tony Kenny <tony@furness.co.uk>
Subject: Re: Perl Training UK
Message-Id: <34F6BC93.913E5BA@online.emap.com>

We have two people interested (email me direct for more info)

What sort of level would this course be.

Beginners ? Then why not use Learned Tree?
Intermediate/Advanced - now that would be a good idea!

Alex Schajer

Tony Kenny wrote:

> We are intending to host a training course in Cumbria, England possible in
> early August of the year.
> It is intended that an instructor from Stonehenge
>  http://www.perltraining.con ) will conduct the course.
> At this stage we are looking for ballpark figures on attendance numbers.
> Could anyone who has an interest in such a course please contact me:
> tony@furness.co.uk
> The price is dependent on numbers but will be very competitive with other UK
> course providers.
>
> ~Tony Kenny
> Furness Internet Limited
> Tel: +44 1229 588588
> Fax: +44 1229 581050





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

Date: Fri, 27 Feb 1998 10:34:05 +0200
From: Fain <mindmore@mindless.com>
To: Grimoire <grimoire@oaktree.net>
Subject: Re: removing new line (\n)
Message-Id: <34F67A7D.2B01BFC7@mindless.com>

Grimoire wrote:

> On Sat, 21 Feb 1998, Zylbersztejn Nathan wrote:
>
> > Hello,
> >
> > when I put the lines of a text in an @array how do i remove the "new
> > line "(\n).
> > s/\\n/ / doesn't work
> > The problem is that when I want to print the last word of a line
> >
> > Nathan(brussels)
> > http://www.imaginet.be/~nathan
>
> I am fairly new to the whole Perl game, as it were, but it sounds like
> your problem could be fixed by using 'chomp()'.
>
>         ~grimoire

chomp() will work but it can be done in the method that you were trying
like so:$var ~= s/\n/ /;

So, you hit on the nose but just didn't need the extra slash (\).
Let em know if you have any troubles.

- Nathan Fain
mindmore@mindless.com




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

Date: 27 Feb 1998 06:26:40 GMT
From: c.c.eiftj@60.usenet.us.com (Rahul Dhesi)
Subject: Re: seeking and changing /etc/passwd
Message-Id: <6d5mb0$cmb$1@samba.rahul.net>

In <6d55gh$iqj$1@ha2.rdc1.sfba.home.com> dmmartin@home.net (Michael
Martin) writes:

>open(PASSWD, "+</etc/passwd");

>while(<PASSWD>){
>s/^$username:\*:/^$username:!:/;
>last;
>}
>__END__

>that snipit should work, although it is untested...  Basicly it loops through 
>your shadowed password file and looks for the exact username you specified.  
>When it finds it, the script replaces the username and the * with the username 
>and a !.

I don't want to deliberately make a helpful person feel bad, but the
above is much, much worse than justifiable.  Let's list the errors:

1. Locking of the password file is neither done nor discussed.  If you
   believe it should not be locked, this assumption should be clearly
   stated.
2. There is no check for the open failing.
3. Nothing is ever written back to the file.
4. The code inserts a ^ character before the username.  Fortunately
   nothing is written back to the file so no damage will be done.
   Unfortunately if the code is revised to write back to the file
   the wrong stuff will be written back.
5. The loop as shown exits after scanning one line.
6. There is no close().  This doesn't matter in the code above, because
   nothing is written back.  But if the code were modified to write back,
   it would be essential to do a close() and check for the error code.

A better algorithm would be:

   - lock password file, on most systems by creating /etc/ptmp
   - open for reading check for error
   - open temp output file (which could be /etc/ptmp), check for error
   - scan and replace, sending updates to output
   - close output, check for error
   - safely move temp file back to /etc/passwd as follows
     - link /etc/passwd to backup file name such as /etc/passwd.old
     - rename() temp file to /etc/passwd, print warning if error

The replace line could be:
   s/^$username:\*:/$username:!:/

and there would be no 'last' statement, because the entire file is being
written out.

Don't forget to check to see if there is a shadow file.
-- 
Rahul Dhesi <dhesi@spams.r.us.com>


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

Date: Fri, 27 Feb 1998 02:19:43 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: seeking and changing /etc/passwd
Message-Id: <34F68506.D4768A47@5sigma.com>

Don't, don't, don't muck with the live password file with a Perl
script.  Holy cow.  I cannot even begin to communicate what a bad
idea this is.

There is a module in the CPAN that provides a Perl interface to some
of the system calls that you SHOULD be using to do this.  Offhand
I don't remember what it's called, but it's there ....

	-joseph

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: 27 Feb 1998 03:16:45 -0500
From: gcoulter@elsewhere.fragment.com (Geoffrey Coulter)
Subject: Re: SQL/Perl syntax question about Quotes
Message-Id: <6d5spd$g6$1@elsewhere.fragment.com>

Actually, this could be interpreted as "really a perl problem".  My
style tends to be a bit different, but perhaps:

1) use an alternate quote style (also likely to be more readable)

my($sql)=<<ENDSQL;
 select LAST_NAME, FRST_NAME 
 from PRSN
 where LAST_NAME = '$lname'
 and FRST_NAME = '$frname'
ENDSQL

@RESULT = &sql($dbproc1,$sql);

2) if you can bind parameters (and a few more steps)

my($sql)=<<ENDSQL; # or conventionally quoted...
 select LAST_NAME, FRST_NAME 
 from PRSN
 where LAST_NAME = :lname
 and FRST_NAME = :frname
ENDSQL

$sth=$dbh->prepare($sql);
$sth->bind_param(":lname",$lname);
$sth->bind_param(":frname",$frname);
$sth->execute;
@RESULT=$sth->fetchrow;


Only problem I have with the blockquotes is that they drive emacs'
perl-mode nuts.


Geoffrey

In article <6cd1s2$d5i$2@comdyn.comdyn.com.au>,
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>In article <34e9fd6c.427041@typhoon.texas.net>,
>	peter.gilchrist@antares.dhs.state.tx.us (Peter Gilchrist) writes:
>
>> @RESULT = &sql($dbproc1,"select LAST_NAME, FRST_NAME 
>>                          from PRSN
>>                          where LAST_NAME = '$lname'
>>                          and FRST_NAME = '$frname'");
>> 
>> Note: the whole select statement is in double quotes.  I tried
>> reversing the quotes, but with no results.
>
>This is not really a perl problem, unless you're asking: How can I get
>$lname and $frname expanded within DOUBLE quotes in my SQL query:
>
>One way to do it:
>
>@RESULT = &sql($dbproc1,"select LAST_NAME, FRST_NAME 
>                         from PRSN
>                         where LAST_NAME = \"$lname\"
>                         and FRST_NAME = \"$frname\"");
>
>Martien
>-- 
>Martien Verbruggen                  | 
>Webmaster www.tradingpost.com.au    | I'm just very selective about what I
>Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
>NSW, Australia                      | 




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

Date: 27 Feb 1998 13:41:31 GMT
From: altheim@agc.bio.ns.ca (Brian Altheim)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d6fqb$4p21@sapphire.mtt.net>

Peter Samuelson (psamuels@sampo.REMOVETHIS.creighton.edu) wrote:
: [Sean Ahern <SxA@wrdcom.clara.net>]
: > Since, of course, every damn person on this group who thinks it's
: > forgivable to insult beginners for asking 'obvious' questions has
: > never, ever done the same thing in their past.

: I hope you don't think you're exaggerating for shock value or whatever.
: You aren't.  A number of us have come to that precise conclusion.
: Trying to learn a *programming language* without reading any
: documentation is *stupid*.  Trying to get someone to volunteer time
: helping you learn a programming language without reading any
: documentation is *rude*.  I see no need to be overly polite to such
: people.

: And no.  I have never, ever done the same thing in my past.  I assume
: with some confidence that Tom and several others here can say the same.

<snip>

: -- 
: Peter Samuelson
: <sampo.creighton.edu ! psamuels>

I have to agree with Peter here.  I am (still) a "Perl beginner", with little
(read no) programming experience, yet I have still managed not to inundate
this group with FAQs.  When I hit a roadblock (every five minute or so ;-), I
find it much easier and more informative to pull out one of the books
(whichever one is within reach) and try to find the answer there.  Failing
that, the perldoc command can do wonders in clearing up questions.  Maybe it's
a matter of upbringing.  Nowadays in school, the motto is "No question is too
stupid to ask."  (Although my motto was "No question is too stupid to ask, but
if you ask a question I've directly given the answer to during my lecture, it
shows me that you're too stupid to pass." :-).  When I was in school the 
(unofficial) motto was "If you ask a question, you're trying to kiss up to the
teacher, and are earning yourself a wedgie/beating/ridicule session during
lunch."  Kinda quashes the questioning spirit a little.  Also makes you want
to understand things with as little outside help as possible.  I wonder if
a difference in upbringing leads to people who turn to others for help more
quickly???  Please note that I'm not saying the wedgie treatment is a good
thing...it may just have one semi-positive side effect.

Or maybe there's just a lotta people out there with poor Netiquette.

Brian


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

Date: Fri, 27 Feb 1998 03:05:01 -0800
From: ndufort <ndufort@cadre.sjsu.edu>
Subject: time matter...
Message-Id: <34F69DDD.167E@cadre.sjsu.edu>

hi everyone,


i'm a french college student in computers in art, and i would need some
help for my assignment.

i'm totally new to PERL, and i need to write some kind of script for my
art class (computers in art).  but since i know absolutly nothing to
PERL, i don't even where to start; and if i have to check the notes i
have from class, i guess i should be able to write this in a couple of
years...

here is my idea for the project:

when you are on a web site, as you click on a link, it will save the
time in a file, thru a script.  when you click on another link, it will
write the second time, and another script would calculate the difference
between time_2 and time_1.  then, with the result (in seconds), i would
use the number (reduced to a number < or =  to 10) to have the browser
open the same number of windows.  and if it were something possible, it
would use the same number to define how many times the windows would
reload, and how often they would do it.

ok, i know, it's kind of ambitious, but that was my idea of a
'parasite.'  i know that i am not be able to write all this stuff (we
have to figure out how PERL works by ourselves - just like for C and
OpenGL last semester), but i would like to know if i could do the first
part:  writing the time to a file, calculate the difference and use the
result to open 'n' windows.

for example, the person spends 20 sec on a page, i would like to add 2 +
0, which would give 2, then it would open 2 windows, and they would
reload twice...

could anyone help me?  i would appreciate any suggestions.
thank you.


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

Date: 27 Feb 1998 13:51:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: use system or backticks??
Message-Id: <6d6gcr$4td$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, mshavel@erols.com (Michael Shavel) writes:
:Also could someone please
:explain the difference between the backticks and using "system". 

The explanation for that is in the standard perlfaq8 manpage, distributed
with each and every Perl distribution.   Please read it.  Please.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


Sockets are the X windows of IO interfaces.  --Rob Pike


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

Date: Fri, 27 Feb 1998 08:06:52 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: using a Module
Message-Id: <34f973d3.3556650@news.jps.net>

[cc'ed to author]

Take a look at my coin du perl page. I have some examples.

http://www.brie.com/coinduperl/

On Thu, 26 Feb 1998 11:44:34 +0200, Naama Kraus
<naamah@haifa.vnet.ibm.com> wrote:

>Hi!
>I have a module residing in a non standard directory. I would like to
>use it in a perl
>program (use MyModule). How can I teach perl to look for my module in
>that directory?
>Thanks in advance,
>  Naama.
>
>---> naamah@haifa.vnet.ibm.com

----------------
Brian Lavender                           http://www.brie.com/brian/
PO Box 19184, Sacramento,CA 95819-0814   (916) 443-6195
I am looking for a job in web development. See my home page. 
CGI, PERL, HTML,SQL, GPS, GIS <--- Impressive or what :?


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

Date: Fri, 27 Feb 1998 12:05:46 +0000
From: Matthew Couchman <Matthew.Couchman@bbsrc.ac.uk>
Subject: Viewing local vars in debugger
Message-Id: <34F6AC18.9C4633B@bbsrc.ac.uk>

Hello,

I'm using the debugger with perl5.00404 but i'm having trouble viewing
variables that have been declared local with my(). I can view variables
whose scope has not been specified as normal but "X var" on a local
variable returns a blank. Has anyone else experienced this? Is there a
solution?

Thanks in advance,

                                            Matt.



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

Date: Fri, 27 Feb 1998 13:05:27 +0100
From: Olav Reinert <oreinert@daimi.aau.dk>
Subject: What does this one-liner do?
Message-Id: <34F6AC06.C182F7AD@daimi.aau.dk>

Hi folks,

Another guy trying to learn Perl, and I'm having trouble understanding what
the return value of the assignment operator is. Consider this statement:

print ( $x = ($a) = (7,8,9) );

See if you can guess what is printed. If you can, could you please explain
to me exactly why it gives that result? What is the value returned by the
right-most assignment?

Regards,
Olav
-- 
Olav Reinert ~ oreinert@daimi.aau.dk ~ http://www.daimi.aau.dk/~oreinert


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

Date: Fri, 27 Feb 1998 12:52:49 GMT
From: Fred Vaughn <spam@no_spam_please.com>
Subject: Why doesn't "tr/\x0D//d" work?
Message-Id: <34F6B7D2.C8EF9DDE@no_spam_please.com>

Greetings,

I'm new to the Perl language and I'm a bit puzzled by the following.. As
a learning exercise, I've created a small Perl script to remove carriage
return characters ( hex value: x0D ) from an ASCII text file:

open(INFILE, $ARGV[0] ) || die "Error unable to open filename: $infile
$!";

open(OUTFILE, ">new.txt") || die "Error unable to open filename: new.txt
$!";

while ( $line = <INFILE> )
{
 $line =~ tr/\x0D//d;
 print OUTFILE $line;
}

The script refuses to remove the "x0D" charaters. Why? what did I do
wrong?

Thanks,
Fred

--
=============================
Fred Vaughn
Domain Pharma Corporation
Cambridge, MA, USA
Email: fvaughn@domaincorp.com
==============================




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

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 1986
**************************************

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