[9122] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2740 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 27 19:08:13 1998

Date: Wed, 27 May 98 16:00:30 -0700
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, 27 May 1998     Volume: 8 Number: 2740

Today's topics:
    Re: Backquote problem? (Jonathan Stowe)
    Re: Backquote problem? <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Backquote problem? <tchrist@mox.perl.com>
    Re: Benchmark: unpack slower than /(..)(...)/ (Ilya Zakharevich)
    Re: Call another perl script <aqumsieh@matrox.com>
    Re: Copylefting manuals <barmar@bbnplanet.com>
    Re: Deleteing files <abaugher@rnet.com>
    Re: Email address checker - comments welcome (I R A Aggie)
    Re: Email address checker - comments welcome <tchrist@mox.perl.com>
    Re: Email address checker - comments welcome (Michael J Gebis)
    Re: Hash value length limit? <dlacroix@cray-ymp.acm.vt.edu>
    Re: Is this WEB-BASED mail script good? <abaugher@rnet.com>
    Re: Job Postings (Stuart McDow)
    Re: Job Postings <webmaster@fccjmail.fccj.org>
    Re: LABOR CRISIS: Perl SW Guru NEEDED MA Intranet Start <jc@ral1.zko.dec.com>
    Re: list context: || vs or <gnat@frii.com>
    Re: Need a "word-count" <tchrist@mox.perl.com>
    Re: Perl Memory profiling? (Ilya Zakharevich)
    Re: Perl Win95 Question (Jeff Henry)
    Re: Perl Win95 Question (Jonathan Stowe)
        read and write <tw96@email.msn.com>
    Re: read and write (Jonathan Stowe)
    Re: Regexps <jdf@pobox.com>
    Re: Regexps <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Regexps <danboo@negia.net>
    Re: Regexps <danboo@negia.net>
    Re: Relative Newbie Question: Multiple Form Inputs Into <abaugher@rnet.com>
    Re: Relative Newbie Question: Multiple Form Inputs Into <danboo@negia.net>
    Re: replace line in file (Ryan McGuigan)
        Sensing whether a script is already running... <GGarcia.at@ix.dot.netcom.dot.com>
        SetupSup jstephan@my-dejanews.com
    Re: string to ASCII question <jason.holland@dial.pipex.com>
        Substitute gurus... got a better word wrap? (Mid Summers Eve Festival)
    Re: Text File Manipulatoin <jdf@pobox.com>
    Re: Tom Christiansen attacks the free software communit <evan@garrett.hpl.hp.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 27 May 1998 20:59:24 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Backquote problem?
Message-Id: <356c7c85.11859845@news.btinternet.com>

On Wed, 27 May 1998 12:51:35 -0700, Tom White wrote :

>I'm having problems copying a file with perl.
>
>system: HPUX10.20  perl, version 5.004_01
>
>$ perl -e '`cp /usr/bin/ls .` || die "$!"'
>No such file or directory at -e line 1.
>
>Actually, the file is copied correctly. I just don't like the error I'm
>getting.
>Any ideas?

Yeah,

You dont want to do the "|| die $!" thing with the backticks.  The
error message derived from $! is spurious.  You should instead be
checking $?  aka $CHILD_ERROR (the same goes for system())

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Wed, 27 May 1998 22:58:20 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Backquote problem?
Message-Id: <356CFCFC.36FC@comenius.ms.mff.cuni.cz>

Tom White wrote:
> 
> I'm having problems copying a file with perl.
> 
> system: HPUX10.20  perl, version 5.004_01
> 
> $ perl -e '`cp /usr/bin/ls .` || die "$!"'
> No such file or directory at -e line 1.
> 
> Actually, the file is copied correctly. I just don't like the error I'm
> getting.
> Any ideas?
> 
> thanks

Does the cp provide any output?
You should reread the manpages to see what `` means.
I think you wanted to use system() instead.
	perl -e 'system("cp /usr/bin/ls .") || die $!'

BTW, I suppose that you realy mean something different than simple
copying, 
keep in mind that you may
	use File::Copy;
	copy '/usr/bin/ls','.' || die $!;

Hi, Jenda


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

Date: 27 May 1998 21:34:08 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Backquote problem?
Message-Id: <6ki0sg$ip8$4@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz> writes:
:	use File::Copy;
:	copy '/usr/bin/ls','.' || die $!;

No you can't.

1) You messed up or/|| precedence.
2) The module doesn't support that sane a command syntax.

--tom
-- 
lint(1) is the compiler's only means of dampening the programmer's ego.


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

Date: 27 May 1998 21:09:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Benchmark: unpack slower than /(..)(...)/
Message-Id: <6khvdt$7ui$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<jari.aalto@poboxes.com>],
who wrote in article <tbzpg3esxz.fsf@blue.sea.net>:
> 
>     Camel 2nd p.66 suggests that unpack is more efficient for getting out
>     contant width string, but I was suprised that it is not true.
>     Would anyone know in whichg situation unpack would be faster?

When somebody puts enough time to optimize pp_unpack() ;-).

Ilya


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

Date: Wed, 27 May 1998 17:40:48 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Call another perl script
Message-Id: <356C8860.941E4478@matrox.com>

Richard Amdi Madsen wrote:

> 1. program:
>
> #!/bin/perl
>
> print "Content-Type: text/html\n\n";
>
> open FH, "my_perl_prog.cgi |" || die "Error $! on open of pipe\n";

You should have a look at the precedence and short-circuit behaviour of
the || operator (check out the or operator while you're at it). The ||
operator is so strong that it is performed first BEFORE the open()
command. So .. you can do either of 2 things ..

open FH, "my_perl_prog.cgi |" or die "Can't open my_perl_prog: $!";

here .. the or is weaker than the open() command ... so open() gets
executed first..
OR remove ambiguity explicitly:

open (FH, "my_perl_prog.cgi |") || die "Error $! on open of pipe\n";

> while(<FH>) {
>         print "$_";
> }
>
> 2. program: my_perl_prog
>
> #!/bin/perl
>
> print "Content-Type: text/html\n\n";
>
> print "output from my_perl_prog";

 Hope that helps.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Wed, 27 May 1998 21:44:08 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: Copylefting manuals
Message-Id: <IO%a1.29$443.900243@cam-news-reader1.bbnplanet.com>

In article <87solxoi5b.fsf@io.oryxsoft.com>, Paul Fisher  <rms@gnu.org> wrote:
>One other limit on your flexibility is that you can't stop people from
>copying small examples no matter what you say.  Small quotations from
>a book are "fair use"; people don't need special permission for them.

I wish a lawyer would join the discussion and say whether the above is
really true.  As I've posted elsewhere, my lay understanding of "fair use"
is that it's not so liberal.  Besides being small quotations, fair use also
specifies the type of use you make of it, and I'm not sure that
incorporating examples into a program falls into its limits.  The web page
<http://www.benedict.com/fairtest.htm> describes the factors that are now
considered when deciding whether use is fair.  "Relative amount" is just
one of the four factors listed there.

Brad Templeton's Copyright Myths FAQ has this to say about fair use:

        Fair use is a complex doctrine meant to allow certain valuable
        social purposes.  Ask yourself why you are republishing what
        you are posting and why you couldn't have just rewritten it
        in your own words.

The "social purposes" he refers to are "commentary, parody, news reporting,
research and education".  These quotes in my posting are fair use; if I
were to write my own FAQ and incorporate the above paragraph, I might be
violating Brad's copyright (except that his FAQ has a notice allowing
copying in electronic form).

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.


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

Date: 27 May 1998 16:12:52 -0500
From: Aaron Baugher <abaugher@rnet.com>
Subject: Re: Deleteing files
Message-Id: <m290nno1t7.fsf@haruchai.rnet.com>

q2020262@my-dejanews.com writes:

> Can somebody decribe to me what I need to do to delete a file using
> perl, I am using the 'unlink' command at the moment, I had it
> working a while back but no, but the files still remain now.

> And if you're wondering I have made sure the permissions and
> addresses are correct.

It must be magic then. :-) Check the permissions on the directory the
files are in.

--
Aaron Baugher
Extreme Systems Consulting
CGI, Perl, Java, and Unix Administration
http://haruchai.rnet.com/esc/


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

Date: Wed, 27 May 1998 17:00:01 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Email address checker - comments welcome
Message-Id: <fl_aggie-2705981700010001@aggie.coaps.fsu.edu>

In article <1998052719190900.PAA12131@ladder01.news.aol.com>,
mark666769@aol.com (Mark666769) wrote:

+ Submitted for your approval: yet another Email address
+ checker from the twilight zone. Any and all
+ comments and improvements would be most welcome.

It doesn't work.

Checking: |fred&barney@stonehenge.com|
Invalid Email address: fred&barney@stonehenge.com

Really?

---begin snippet---

From: The Fred and Barney Comedy Team <fred&barney@stonehenge.com>
To: <zap>
Subject: Re: test
Precedence: bulk

[this is an automated message from a perl script.]

As you can see, this is a valid address.  But we're not home right
now.  You'll probably want to write <merlyn@stonehenge.com> and say
"OK, I get it now".

---end snippet---

Remember that pretty much _any_ character can go in front of the
"@" if it's properly handled. For instance, here's a doozy:

Checking: |"/dd.ccMail=Carroll F Winn at jpl-700-b180/"@cc2mhb.jpl. nasa.gov|
Invalid Email address:
 "/dd.ccMail=Carroll F Winn at jpl-700-b180/"@cc2mhb.jpl. nasa.gov

And yet I have it on reasonable authority that this is deliverable.

James - some munging of addresses has occured...

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 27 May 1998 21:28:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Email address checker - comments welcome
Message-Id: <6ki0io$ip8$3@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, mark666769@aol.com (Mark666769) writes:
:Submitted for your approval: 

Rejected.  This is incorrect.  I'm sure others will tell you why.
You should put some research time into learning why what you want to
do, verify the submitters mail address, is provably impossible to do in
real time.  That's right: I said *provably*.  It's hard to beat that one.

--tom
-- 
    X-Windows: A moment of convenience, a lifetime of regret.
	--Jamie Zawinski


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

Date: 27 May 1998 22:23:26 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Email address checker - comments welcome
Message-Id: <6ki3ou$rhv@mozo.cc.purdue.edu>

Tom Christiansen <tchrist@mox.perl.com> writes:

}In comp.lang.perl.misc, mark666769@aol.com (Mark666769) writes:
}:Submitted for your approval: 

}Rejected.  This is incorrect.  I'm sure others will tell you why.
}You should put some research time into learning why what you want to
}do, verify the submitters mail address, is provably impossible to do in
}real time.  That's right: I said *provably*.  It's hard to beat that one.

It is, of course, possible to reject things that can't possibly work.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 27 May 1998 18:27:58 GMT
From: David La Croix <dlacroix@cray-ymp.acm.vt.edu>
Subject: Re: Hash value length limit?
Message-Id: <6khlve$g8v$1@solaris.cc.vt.edu>

In my original post, I said:
> I inherited an application that uses a hash of hashes for internal 
> data storage (similar to the example I have fabricated below).
> 
> I am experiencing a phenomenon where the value appears to be truncated
> at about 250 bytes.  Is this a limit or a bug?

It turns out that the truncation was actually a product of the client
using Netscape on a Macintosh computer ...   for some reason, it
truncates <input type=text> data...   The code I'm charged with 
maintaining was actually fine.

Thanks for all the responses.  Sorry it took so long to follow up.





-- 
dlacroix@acm.vt.edu


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

Date: 27 May 1998 16:25:32 -0500
From: Aaron Baugher <abaugher@rnet.com>
Subject: Re: Is this WEB-BASED mail script good?
Message-Id: <m27m37o183.fsf@haruchai.rnet.com>

"David A. Lyons" <lyonsd@atl.hp.com> writes:

> Ala Qumsieh wrote:
> > 
> > Paul van der Pan wrote:
> > 
> > > I found this perl cgi-script for Web based email
> > > (should work on Linux) on the net,
> > > can somebody tell me if there are big security holes
> > > in this script?
> > >
> > 
> >  I will ... if you pay me $100/hr ;-)
> 
> Paul, don't let this guy rip you off!  I'll do it for $90/hr!  ;^)

Bob, I'll say $80/hr!  [applause, applause]

--
Aaron Baugher
Extreme Systems Consulting
CGI, Perl, Java, and Unix Administration
http://haruchai.rnet.com/esc/


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

Date: 27 May 1998 21:35:00 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Job Postings
Message-Id: <6ki0u4$mho$1@ns1.arlut.utexas.edu>

comdog@computerdog.com (brian d foy) writes:
>
>    print "okay to post"     if $newsgroup =~ m/\.jobs?\./;
     print "okay to post"     if $newsgroup =~ m/\.jobs?\./ || readers_curious_about_perl_jobs() > 0;

--
Stuart McDow                                     Applied Research Laboratories
smcdow@arlut.utexas.edu                      The University of Texas at Austin
            "Look for beauty in roughness, unpolishedness"


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

Date: Wed, 27 May 1998 22:06:04 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Job Postings
Message-Id: <356C8C57.6B47BF71@fccjmail.fccj.org>

brian d foy wrote:
> 
>    print "okay to post"     if $newsgroup =~ m/\.jobs?\./;
>    print "not okay to post" if $newsgroup =~ m/\Qcomp.lang.perl.misc\E/;
> 

LOL :-)
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Wed, 27 May 1998 13:52:44 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: LABOR CRISIS: Perl SW Guru NEEDED MA Intranet Start-up 80K+>+Equity
Message-Id: <356C52EC.B5A82559@ral1.zko.dec.com>

Zenin wrote:
> scott@softbase.com wrote:
> : I stand by my main point, though, that the labor crisis is largely a
> : hoax of unfillable positions that require too many micro-specific
> : skills.
>         Doubtful, IMHO.  This guy emailed me directly to ask if I would
>         be interested or if I knew anyone that would be interested (no, it
>         wasn't spam).  The skill list was pretty small infact and closely
>         related.  It actually describes most of the people I work with
>         pretty well.  Looks pretty legit to me.


Possible, but there is a large component of hoaxiness (hoaxicity?) in the
"Software Labor Shortage".  If you'd like to read some well-researched and
well-written documents on the subject, visit prof. Matloff's summary page
at http://heather.cs.ucdavis.edu/itaa.others.html, where you will find links
to a lot of interesting reading on the topic.

One of prof Matloff's theses is that the software industry has a widespread
practice of complaining loudly about a labor shortage, while most of the 
companies actually interview only a tiny percentage of applicants, and make
offers to an even tinier number.  This isn't due to the "unqualified" nature
of the applicants, since the training period for the typical job is much
shorter than it takes to fill the position, but companies go to great lengths
to avoid retraining even their current employees, preferring to take a long
time finding someone who is "already trained".  This is so extremely illogical
and counterproductive that it can't possibly by the true explanation; a much
more credible explanation is that the employers are making up fake requirements
and fake shortages as a technique of keeping pay scales low.

It's all very interesting reading, especially for those of us trying to make
a living in the software biz.  It's also a useful antidote to those economic
theories that describe "The Market" as rational.


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

Date: 27 May 1998 15:21:58 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: list context: || vs or
Message-Id: <5q67irmmtl.fsf@prometheus.frii.com>

charlie@antipope.org (Charlie Stross) writes:
> >Um, one uses hashes for sets, not arrays.
> 
> Now _I'm_ confused. I used the word 'set' colloquially, to
> mean a collection of unindexed thingies, as opposed to a hash (a bunch
> of indexed thingies); as in, "perl understands singular, plural, and
> indexed data". Is my understanding incorrect?

"Set" is a mathematical term.  Mathematically, sets are not arrays.

Then again, mathematicians appear to have stolen all the good terms
that you could describe an array in, e.g. "group".  I guess we're left
to say that a scalar is a single thing, an array is a bunch of things
accessed by position in the array, and a hash is a bunch of things
accessed by name.

Ish.

Nat
(waiting for those twin swine Orwant and mjd to tell me about the
number theoretic term "bunch" ...)


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

Date: 27 May 1998 20:46:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Need a "word-count"
Message-Id: <6khu3s$ip8$2@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, "Larry Rosler" <lr@hpl.hp.com> writes:
:I guess that's as close as I'll come to getting an apology for being
:called "evil".

I meant evil according the hackers' dictionary, not Deuteronomy.

:Everyone will benefit
:from your cookbook when it is published.

Hope so.  Realizing that some early chapters were moor geared for only
the beginner and later ones only for the expert, we have in these ultimate
days been, um, adjusting this. :-) 

--tom
-- 
    X-Windows: It was hard to write; it should be hard to use.
	--Jamie Zawinski


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

Date: 27 May 1998 21:11:27 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Memory profiling?
Message-Id: <6khvhv$844$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Rokicki
<rokicki@cello.hpl.hp.com>],
who wrote in article <6khff7$t8g@cello.hpl.hp.com>:
> 
> > Is there any way I can get memory usage info from a running perl process?
> 
> To find out where the RAM is going, this is what I do.  I run my script
> under the Perl debugger, let it run a while, and then use the `V' command.

There is also some option like 'sizeOnly' for the dumper.  Do not know
how useful it is, and the numbers are just user-visible sizes, not
memory-footprint sizes.

Ilya


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

Date: Wed, 27 May 1998 20:49:45 GMT
From: jdhenry.NOSPAM@ismi.net (Jeff Henry)
Subject: Re: Perl Win95 Question
Message-Id: <356c4158.4877941@news.ismi.net>

On Mon, 25 May 1998 18:47:45 GMT, cicho@polbox.com (Marek Jedlinski)
wrote:

>sowmaster@juicepigs.com (Bob Trieger)  wrote:
>
>>
>>The easiest ways to do it is to just write a one line .bat file or make it 
>>clickable with a shortcut to "perl yourscript.pl"
>
>Yeah, but thanks to the immense stupidity of the shell, you then lose the
>ability to redirect input/output.
Yes, the shell supplied with Win95 is broken. I'm using 4DOS from JP
Software as a replacement (www.jpsoft.com). 4DOS allows "executable
extensions", so I can, in my autoexec.bat, put:

set .pl=d:\perl\bin\perl.exe

Then i can run foo.pl from anywhere in my path simply by typing:

foo

This fully supports input/output redirection, command line args, etc.
I understand there is also a port of bash for win32, but I haven't
tried it (yet).

Hope this helps.
-- 
Jeff Henry, Compuware Corp.           |  This sig under construction
standard opinions/employer disclamer  |  Some cute ASCII art here, or
"A witty quote" - by someone famous   |   maybe my name in big block 
http://url.to.some.cool.site          |   letters, so I look important


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

Date: Wed, 27 May 1998 22:36:15 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl Win95 Question
Message-Id: <356c9337.17285611@news.btinternet.com>

On Wed, 27 May 1998 20:49:45 GMT, Jeff Henry wrote :

<snip>
>
>This fully supports input/output redirection, command line args, etc.
>I understand there is also a port of bash for win32, but I haven't
>tried it (yet).
>

This is the Cygwin32 port available from <URL:http://www.cygnus.com/>
You probably want to get all of the file and shell utils as well for
that Unix Look'n'Feel.  However if you are using networked drives you
might run into problems unless you have compiled perl with Cygwin32.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Wed, 27 May 1998 17:15:13 -0500
From: "tw96" <tw96@email.msn.com>
Subject: read and write
Message-Id: <O5wY8ybi9GA.164@uppubnews03>

hello, everybody!
i met a problem.
when i use :
    open(FILE,"+>".filename);
    $a = <FILE>;
    print $a,"\n";
    $a++;
    print FILE $a,"\n";
i always get the first line null, and the second line '1'.
what's the problem?
please help!

meng




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

Date: Wed, 27 May 1998 22:57:04 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: read and write
Message-Id: <356c9747.18103170@news.btinternet.com>

On Wed, 27 May 1998 17:15:13 -0500, tw96 wrote :

>hello, everybody!
>i met a problem.
>when i use :
>    open(FILE,"+>".filename);
>    $a = <FILE>;
>    print $a,"\n";
>    $a++;
>    print FILE $a,"\n";
>i always get the first line null, and the second line '1'.
>what's the problem?
>please help!
>

I'm not quite sure what you want to do with this but if you want to
simply keep a count in a file you will want to amend your code to
something like the following - No account has been taken of any
possible locking or other possible concurrency issues here (or
anything else for that matter)

#!/develop/bin/perl
$filename = "myfile";
open(FILE,"+>>". $filename) || die "Cant open $filename : $!";
# If you use "+>" you will overwrite the previous contents of the file
# Always check whether your open succeeds
seek(FILE,0,0) || die "Cant seek - $!";;
# Seek to beginning of file to get existing value
$a = <FILE>;
print $a,"\n";
$a++;
seek(FILE,0,0) || die "Cant seek - $!";
# Seek back to beggining of file to write new value
print FILE $a,"\n";
close(FILE);
__END__
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 27 May 1998 17:05:53 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Erik Alm <erik.alm@swipnet.se>
Subject: Re: Regexps
Message-Id: <iumrz7we.fsf@mailhost.panix.com>

Erik Alm <erik.alm@swipnet.se> writes:

> I have a problem with regexps.

The documentation for Perl's regular expressions can be found mainly
in two places: perlre and perlfaq6.

  C:\>perldoc perlre
 
  C:\>perldoc perlfaq6

> Is there a way (I know I've heard of it but I can't find it!!) to
> override the "greed" in for instance a /(.*?)\"/ so that instead of
> matching the last \" ever, it will stop at the very first \"  ?

Why is there a backslash before that quote sign?  Do you think it's
doing anything?  The regex you quote will indeed match up to the first
quote.  Can you show us some brief sample code in which it doesn't? 

> If not... is there a way to do a match like: anything BUT a \" ?

You need a character class, which uses brackets [] to denote "match
any one of the enclosed characters."  A negated character class has a
caret ^ as the first character in the class

  [^"]

will therefore match one non-quote character.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: Wed, 27 May 1998 23:08:11 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Regexps
Message-Id: <356CFF4B.6EA9@comenius.ms.mff.cuni.cz>

Erik Alm wrote:
> 
> Hello,
> 
> I have a problem with regexps.
> 
> Is there a way (I know I've heard of it but I can't find it!!) to
> override the "greed" in for instance a /(.*?)\"/ so that instead of
> matching the last \" ever, it will stop at the very first \"  ?
> 
> If not... is there a way to do a match like: anything BUT a \" ?
> 
> Regards,
> 
> Erik Alm
> Stereomedia Stockholm

Actualy the regexp you present is nongreedy due to the question mark.
I can assure you that thes regexp will not do you good.

 (.*?) matches 0 or more arbitrary characters, the less the better
   and stores the match in $1 (or $2, $3, ...)
 \" will match the first doublequote (the backslash is not needed)
 and since you do not use ^ at the beginning of the regexp the (.*?)
 doesn't have to match anything and you will get nothing in $1.

Your regexp could be written as /"/ with the same result.

I think you meant /^(.*?)"/ == give me everything till first dblqoute.

Please reread perlre manpage (man perlre   or   perldoc perlre   or 
perlre.html).

HTH, Jenda


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

Date: Wed, 27 May 1998 17:41:22 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Regexps
Message-Id: <356C8882.D7574B61@negia.net>

Jan Krynicky wrote:
> 
> Erik Alm wrote:

[SNIP]

> > Is there a way (I know I've heard of it but I can't find it!!) to
> > override the "greed" in for instance a /(.*?)\"/ so that instead of
> > matching the last \" ever, it will stop at the very first \"  ?

[SNIP]

> 
> Actualy the regexp you present is nongreedy due to the question mark.
> I can assure you that thes regexp will not do you good.
> 
>  (.*?) matches 0 or more arbitrary characters, the less the better
>    and stores the match in $1 (or $2, $3, ...)
>  \" will match the first doublequote (the backslash is not needed)
>  and since you do not use ^ at the beginning of the regexp the (.*?)
>  doesn't have to match anything and you will get nothing in $1.
>
> Your regexp could be written as /"/ with the same result.
> 

did you test this theory? you're in for a surprise. the ? modifier
means that the matching will terminate as soon as possible, but it
doesn't mean it will also begin as late as possible.

> Please reread perlre manpage (man perlre   or   perldoc perlre   or
> perlre.html).

ditto. :-)

hope this helps,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Wed, 27 May 1998 17:11:07 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Regexps
Message-Id: <356C816B.89BE5ECF@negia.net>

Erik Alm wrote:
> 
> Hello,
> 
> I have a problem with regexps.
> 
> Is there a way (I know I've heard of it but I can't find it!!) to
> override the "greed" in for instance a /(.*?)\"/ so that instead of
> matching the last \" ever, it will stop at the very first \"  ?

could you show some sample code in which your regex does not 
stop at the first quote character? your code above contains the
non-greedy modifier '?', and should work as you have expressed.
when i run:

$_ = 'a"b"';
/(.*?)"/;
print $&;

i get: a"

note that the escaping of the quote is not necessary.

> 
> If not... is there a way to do a match like: anything BUT a \" ?

sure, use a negated character class:

/([^"]*)/;

in fact, i prefer this method for its specificity.

hope this helps,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: 27 May 1998 16:32:08 -0500
From: Aaron Baugher <abaugher@rnet.com>
Subject: Re: Relative Newbie Question: Multiple Form Inputs Into a List Array
Message-Id: <m267iro0x3.fsf@haruchai.rnet.com>

Randal Schwartz <merlyn@stonehenge.com> writes:

> Now, an array of listrefs, or a list of arrayrefs, or a list of
> listrefs, or an array of arrayrefs... *that* would be interesting
> *and* useful.

Actually, in the camel book (2nd ed.), starting on page 265, there are
sections on "Arrays of Arrays," "Arrays of Hashes," etc.  Of course,
it is explained in the text that these are really arrays and hashes of
references, but the authors apparently feel that for ease of
communication, it's ok to consider that implied.

--
Aaron Baugher
Extreme Systems Consulting
CGI, Perl, Java, and Unix Administration
http://haruchai.rnet.com/esc/


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

Date: Wed, 27 May 1998 18:29:59 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Relative Newbie Question: Multiple Form Inputs Into a List Array
Message-Id: <356C93E7.584D97D6@negia.net>

Aaron Baugher wrote:
> 
> Randal Schwartz <merlyn@stonehenge.com> writes:
> 
> > Now, an array of listrefs, or a list of arrayrefs, or a list of
> > listrefs, or an array of arrayrefs... *that* would be interesting
> > *and* useful.
> 
> Actually, in the camel book (2nd ed.), starting on page 265, there are
> sections on "Arrays of Arrays," "Arrays of Hashes," etc.  Of course,
> it is explained in the text that these are really arrays and hashes of
> references, but the authors apparently feel that for ease of
> communication, it's ok to consider that implied.

read the list of camel authors again, and then refer to the 'From:'
field in the post to which you responded. you may notice something
interesting. (or maybe you already did, and this was a joke.)

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: 27 May 1998 21:03:04 GMT
From: ryan@mail.ramresearch.com (Ryan McGuigan)
Subject: Re: replace line in file
Message-Id: <6khv28$p0l$1@news12.ispnews.com>

: > Maybe you'de like to investigate the \b (boundary) assertion.

: he'd do better to replace entire lines according to the FAQ.  a
: boundary assertion is of limited use for in-place editing, and
: certainly doesn't solve this problem.

I quickly discovered that after testing it out, it ALMOST worked for what
I need to do, but not quite.  So I went with what was in the FAQ, except I
did it a little differently.


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

Date: Wed, 27 May 1998 18:44:27 -0400
From: "Gus Garcia" <GGarcia.at@ix.dot.netcom.dot.com>
Subject: Sensing whether a script is already running...
Message-Id: <6ki50f$4le@dfw-ixnews5.ix.netcom.com>

Is there a way for one Perl script to detect whether another (or even the
same one for that matter) script is already running?

Thank you for your time and your assistance.

Sorry about my 'spam' address... +ADs--)

Gus Garcia
GGarcia.at+AEA-ix.dot.netcom.dot.com




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

Date: Wed, 27 May 1998 21:07:57 GMT
From: jstephan@my-dejanews.com
Subject: SetupSup
Message-Id: <6khvbd$eh2$1@nnrp1.dejanews.com>

Unfortunately I lost the message that this pertains to.  Someone told
me that I might be able to send keystrokes to another application with
the module Win32::SetupSup.  This is supposed to be located at
ftp.roth.net/pub/ntperl/SetupSup

That server tells me that the files have moved.  The address it points me to
is the same as the one I just came from.

Anybody know where I can find this module.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Wed, 27 May 1998 22:16:22 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Brian <tenfoot@ddaccess.com>
Subject: Re: string to ASCII question
Message-Id: <356C90B6.38C344DC@dial.pipex.com>

Hello

use something like THIS:

	print ord( "A" );

producing:
	
	65

Bye!





Brian wrote:
> 
> Hi, i am new at this perl stuff - so here goes:
> 
> I need to convert an array of characters to its numeric ASCII value.
> 
> if anyone knows how i can do this, i would appreciate the help!!
> 
> please reply via email
> thanks alot!
> -Brian
> tenfoot@ddaccess.com

-- 
             jason.holland@dial.pipex.com
                  Jay's Place is at
     http://dspace.dial.pipex.com/jason.holland/


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

Date: Wed, 27 May 1998 23:05:47 GMT
From: msef@pyramus.com (Mid Summers Eve Festival)
Subject: Substitute gurus... got a better word wrap?
Message-Id: <6ki5m0$8cd$1@core.savvis.net>

I've been using the following for word wrapping :

s/(.{1,80})\s+/$1\n/g

But this appears to remove leading tabs/spaces at the begining of each line... 
does someone have a better method?

Peace,
Blake


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

Date: 27 May 1998 16:58:55 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: johns@cc.gatech.edu (John)
Subject: Re: Text File Manipulatoin
Message-Id: <lnrnz880.fsf@mailhost.panix.com>

johns@cc.gatech.edu (John) writes:

> What I want to do is just remove the pattern I'm searching for and
> replace it with some other text that isn't necessarily the same size
> at the pattern being removed.  Could someone point me in the right
> direction here?

What you *really* want to do is to buy and read the book _Learning
Perl_, which will walk you through these elemntary things that you
want to do, and quite a bit more.  You should also begin reading the
documentation that comes with perl.  The perlre document concerns
regular expressions in Perl.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: 27 May 1998 14:10:38 -0700
From: Evan Kirshenbaum <evan@garrett.hpl.hp.com>
Subject: Re: Tom Christiansen attacks the free software community (was: Re: GNU attacks on the open software community)
Message-Id: <v9haf83mnch.fsf@garrett.hpl.hp.com>

galibert@pobox.com (Olivier Galibert) writes:

> In article <6k2ur0$jut$1@csnews.cs.colorado.edu>, Tom Christiansen wrote:
> >I'm sorry Barry, but when Joe Anybody hears the word "free", his thought
> >is "gratis", not "libre".  Go ask someone on the street what a "free
> >lunch", a "free computer", a "free hamburger", or some "free software"
> >are.  Heck, I'll bet they even get the wrong idea about "free rooms".
> >Go ahead.    This is all very misleading.
> 
> Then  ask anybody about "free speech"  or  "freedom of press". This is
> only a matter of context. The bad  thing being that for software, both
> are valid.

I suspect that they would give something akin to "not subject to
government regulation" (Merriam-Webster's definition 4b).  I would be
quite surprised if anybody said that a "free press" implied that a
purchaser of the _New York Times_ was allowed to recast and republish
the lead story.

I've definitely come to the conclusion (which I had not previously
held) that the FSF's use of the word "free" really *is* a new
meaning.

-- 
Evan Kirshenbaum                       +------------------------------------
    HP Laboratories                    |The plural of "anecdote"
    1501 Page Mill Road, Building 1U   |is not "data"
    Palo Alto, CA  94304

    kirshenbaum@hpl.hp.com
    (650)857-7572

    http://www.hpl.hp.com/personal/Evan_Kirshenbaum/


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

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

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