[9076] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2694 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 22 16:08:00 1998

Date: Fri, 22 May 98 13:01:42 -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           Fri, 22 May 1998     Volume: 8 Number: 2694

Today's topics:
    Re: Help needed with reg. expr. (newbie) <lance@nospam.net-school.com>
    Re: Help with Perl for DOS and STDOUT <lance@nospam.net-school.com>
    Re: Killing a thread (was: Re: Stop Changing Subject Li <p-fein@uchicago.edu>
    Re: Killing a thread (was: Re: Stop Changing Subject Li (Dave Barr)
    Re: liberame (Stefaan A Eeckels)
    Re: Perl Cron/At weirdness <paul.joslin@sdrc.com>
        replace line in file (Ryan McGuigan)
    Re: replace line in file (brian d foy)
    Re: Sequestration (I R A Aggie)
    Re: Stop Changing Subject Lines!! <p-fein@uchicago.edu>
    Re: Tom Christiansen attacks the free software communit <keithmur@mindspring.com>
    Re: Tom Christiansen attacks the free software communit (Abigail)
    Re: Tom Christiansen attacks the free software communit (Abigail)
    Re: Tom Christiansen attacks the free software communit (Kees Hendrikse)
    Re: What is wrong with this FileHandle code? eryq@zeegee.com
    Re: Why NOT crypt??? (Gurusamy Sarathy)
    Re: wierd regex question <keithmur@mindspring.com>
    Re: wierd regex question <danboo@negia.net>
    Re: Win32 NT Perl Wrapper <ebohlman@netcom.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 22 May 1998 18:39:15 GMT
From: "Lance Hollman" <lance@nospam.net-school.com>
Subject: Re: Help needed with reg. expr. (newbie)
Message-Id: <01bd85b0$abc69b20$7df486cd@myname>

rgold@sctcorp.com wrote in article <6k45t4$o11$1@nnrp1.dejanews.com>...
> I am writing a test perl script to help distinguish PVCS base version
numbers
> (such as 1.12) from branches (such as 2.1.3.0).  In the process, I have
found
> that my understanding of regular expression parsing does not seem to work
very
> well in perl.

you are doing fine on the regexp part.  you need to brush up on scalar vs.
list context.

new_nonbranch( "22", "ab", "12.3", "32.3.1.0" );

sub new_nonbranch {
    my @branch_arr = @_;
    foreach (@branch_arr) {
        if (/(\d+)/) {
            print "$_ matches at ", $1, "\n";
        } else {
            print "$_ doesn't match\n";
        }
    }
}

Lance


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

Date: 22 May 1998 18:52:16 GMT
From: "Lance Hollman" <lance@nospam.net-school.com>
Subject: Re: Help with Perl for DOS and STDOUT
Message-Id: <01bd85b2$7da3c680$7df486cd@myname>



Draco Paladin <paladin@uvic.ca> wrote in article
<Pine.A41.3.96.980522090328.60536A-100000@unix3.UVic.CA>...
> 
> close(STDOUT);
> system("copy $f1 $f2");
> open(STDOUT, ">-");
> 

check for errors in your open command like:

open (STDOUT, ">-") or die "could not open STDOUT: $!\n";

Also, use the -w switch and post the errors you receive.

Lance


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

Date: Fri, 22 May 1998 18:44:08 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Killing a thread (was: Re: Stop Changing Subject Lines!!)
Message-Id: <871ztmm9hj.fsf@bj2-64.rh.uchicago.edu>

Per Abrahamsen <abraham@dina.kvl.dk> writes:

> Peter A Fein <p-fein@uchicago.edu> writes:
> 
> > It makes generating a useful killfile damn near impossible.
> 
> Use the thread kill function (`L T' in your newsreader) instead.

True- if I do it on the original message.  Otherwise, it's only going
to kill the subthread, as it should.  Half the time, I don't know
which original messages I'd like to kill.  But the crosspost kill rule
seems to be working well.

-- 
Peter Fein                                                         773-834-6206
1005 E. 60th St.                                              Chicago, IL 60637
p-fein@uchicago.edu                                   http://pfein.home.ml.org/


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

Date: 22 May 1998 19:53:38 GMT
From: barr@cis.ohio-state.edu (Dave Barr)
Subject: Re: Killing a thread (was: Re: Stop Changing Subject Lines!!)
Message-Id: <6k4l42$1mq$1@news.cis.ohio-state.edu>

In article <871ztmm9hj.fsf@bj2-64.rh.uchicago.edu>,
Peter A Fein  <p-fein@uchicago.edu> wrote:
>Per Abrahamsen <abraham@dina.kvl.dk> writes:
>> Peter A Fein <p-fein@uchicago.edu> writes:
>> > It makes generating a useful killfile damn near impossible.
>> Use the thread kill function (`L T' in your newsreader) instead.
>
>True- if I do it on the original message.  Otherwise, it's only going
>to kill the subthread, as it should.

No, only a subthread kill should kill a subthread.  ("T," in trn)
A thread kill ("Tk" in trn) kills a thread.

Sounds like a deficient threading/killfile implementation to me.

--Dave
-- 
http://www.cis.ohio-state.edu/~barr/
barr@cis.ohio-state.edu


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

Date: 22 May 1998 16:12:22 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: liberame
Message-Id: <6k4856$8tk$1@justus.ecc.lu>

In article <6k3tkp$r1l$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
> In comp.lang.perl.misc, Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
>:free (no charge) = gratis (D,F) or gratuit (F)
>:free (no strings) = vrij (D) or libre (F)
> 
> Adding E (English) and S (Spanish) and G (German):  
> 
>:free (no charge) = gratis (D,F,E,S) or gratuit (F)
>:free (no strings) = vrij (D) or frei (G) [same sound as in D] or libre (F)
Not quite the same sound - in Dutch it's a 'v' sound (though not in
all dialects, some tend to 'f') followed by 'r' and 'ay' as in 'dAY',
whereas in German is an 'f' sound followed by 'r' and 'ai' as in
'HawAIi'.
> 
> And monoglot Anglos wonder how so many Europeans speak or at least read
> several languages.  It's because there just aren't that many words to
> go around. :-)
You'd be amazed (but you probably know) how many subtle shifts
of meaning occur - take the English 'versatile' which is a
positive qualification and the French 'versatile' which is
wholly negative. Take 'hablar' in Spanish and 'habler' in
French, as compared to 'parlar' and 'parler'.  Many Frenchmen
speaking English will use 'eventually' to mean possibly,
and vice-versa. These subtle differences between
related langauges can be quite difficult to master.

> Hm... is the freeware that the public talks about not free software?
I guess what we see here is two perfectly legimate meanings of
the word 'free' leading to needlessly acrimonious debate ;-)

-- 
Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
   Williams and Holland's Law:  If enough data is collected,
          anything may be proven by statistical methods.


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

Date: 22 May 1998 14:08:50 -0400
From: Paul Joslin <paul.joslin@sdrc.com>
Subject: Re: Perl Cron/At weirdness
Message-Id: <y4dbtsqyy8d.fsf@hppop.sdrc.com>

On 22 May 98 15:02:30 GMT, paul@cassens.com (Paul Falbe) said:

Paul> Hi, I've been experiencing some weirdness with a perl script I wrote.
Paul> When the script is run from a "at" command I get different results then
Paul> when it the same script is run from the command line using the same
Paul> datafile and scripts to run it.  In my shell script which runs the perl
Paul> script I do have SHELL=/usr/local/bin/perl; export SHELL.  Does anyone
Paul> have any ideas on why this would occur.  The perl is version 4.  I am
Paul> going to test the script under version 5 tonite.

Most likely causes:
1) at runs things from 'sh'; if your login shell is different, it will even
   warn you.  Setting $SHELL doesn't change this.
2) There may be a difference in environment variables under at.  Try this from 
   the command line and via at, and comparing the results:

   foreach $key (sort(keys %ENV)) {
       print $key, '=', $ENV{$key}, "\n";
       }
-- 
Paul R. Joslin          paul.joslin@sdrc.com     +1 513 576 2012
"It's a psychological as well as physical barrier; the woman who
breaks it [the 2:20 marathon] will undoubtedly usher in a new age in
the sport of running, the way Roger Bannister did when he shattered
the 4-minute mile." --Joan Benoit Samuelson


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

Date: 22 May 1998 19:38:12 GMT
From: ryan@mail.ramresearch.com (Ryan McGuigan)
Subject: replace line in file
Message-Id: <6k4k74$nk6$1@news13.ispnews.com>

I need to replace a single line in a text file, I'd like to be able to
open it in read/write mode, read down to the correct line and replace it
with something else.  The problem is, if the line I'm overwriting is
longer than the new line, it doesn't overwrite the whole line.

for example, if I try to replace testing with kill, I'll end up with
killing.  

here's a small bit of code
open TEST, '+<testfile' or die "can't open it. $!\n";
while (<TEST>) {
        if ($_ =~ /$search/) {
                print TEST "kill";
        }
}
close TEST;    

thanks,
Ryan


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

Date: Fri, 22 May 1998 15:57:34 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: replace line in file
Message-Id: <comdog-ya02408000R2205981557340001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6k4k74$nk6$1@news13.ispnews.com>, ryan@mail.ramresearch.com (Ryan McGuigan) posted:

>I need to replace a single line in a text file

there are some examples in the FAQ.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>


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

Date: Fri, 22 May 1998 14:02:16 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Sequestration
Message-Id: <fl_aggie-2205981402170001@aggie.coaps.fsu.edu>

In article <35659B6A.3D388EAD@fccjmail.fccj.org>, bill@astro.fccj.cc.fl.us
wrote:

+ Tom Christiansen wrote:
+ > 
+ > To try to make some amends for the ridiculous amounts of non-Perl crud
+ > and destructive flaming that I was largely responsible for inciting over
+ > the last two days, <snip ...>
+ 
+ That you are solely responsible is questionable.  We are all mature 
+ enough not to contribute to the madness.  Just because someone yells 
+ FIRE doesn't mean someone else should go off the deep end.

Well, just kill anything cross-posted into gnu.*...

James - one solution...

-- 
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: Fri, 22 May 1998 18:41:57 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Stop Changing Subject Lines!!
Message-Id: <873ee2m9l6.fsf@bj2-64.rh.uchicago.edu>

jdporter@min.net (John Porter) writes:

> On Fri, 22 May 1998 02:50:50 GMT,
> in article <87wwbfvx11.fsf@bj2-64.rh.uchicago.edu>,
> p-fein@uchicago.edu (Peter A Fein) wrote:
> > Look, this GPL/Perl/FSF discussion is very entertaining, but it would
> > make some of us *real* happy if you all would stop changing subject
> > lines every post.  It makes generating a useful killfile damn near
> > impossible.  I'm all for a good intellectual debate every now and
> > then, but these threads have rapidly swamped the perl group.
> 
> I set mine to kill messages cross-posted to gnu.misc.discuss.
> 

Yeah, I did that last night.  I was reluctant though- I was under the
delusion that something useful might come out of this.  Oh well.

-- 
Peter Fein                                                         773-834-6206
1005 E. 60th St.                                              Chicago, IL 60637
p-fein@uchicago.edu                                   http://pfein.home.ml.org/


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

Date: Fri, 22 May 1998 13:12:58 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Tom Christiansen attacks the free software community (was: Re: GNU attacks on the open software community)
Message-Id: <3565C02A.326971A5@mindspring.com>

Stefaan A Eeckels wrote:
[cut]
> And 'vrije liefde' doesn't
> mean you don't have to pay your Significant Other ;-)
> 
That's not what "free love" means in English, either!
[cut]


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

Date: 22 May 1998 19:13:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Tom Christiansen attacks the free software community (was: Re: GNU attacks on the open software community)
Message-Id: <6k4iop$o4c$3@client3.news.psi.net>

Kees Hendrikse (kees@echelon.nl) wrote on MDCCXXV September MCMXCIII in
<URL: news:EtD3MG.J8v@echelon.nl>:
++ In <6k3k7m$76l$1@justus.ecc.lu> Stefaan A Eeckels writes:
++ 
++ > In Dutch, some 'bleeding' of the meaning is present, however -
++ > to indicate that something doesn't accrue taxes, one would say
++ > 'belastingvrij' (litteraly 'tax free'), whereas the French would
++ > say 'hors taxe' (litteraly 'without taxes').
++ > 
++ > It's safe to say that in Dutch the word 'vrij' (which descends
++ > from the same roots as 'free') has stayed closer to the original
++ > meaning (which isn't 'gratis') than in English.
++ 
++ I'm not so sure about that. Take for example the dutch 'vrij parkeren' (free
++ parking) which does mean: no charge for parking. I think in all western
++ languages the notion of free is dangerously close to 'gratis'. 

No, not quite. "Vrij parkeren" really means, "no strings attached".
It doesn't mean "parking without charge, but only for customers",
or "parking without charge, but only on weekends". It really means
anyone can park there.

Also note that you can't really replace 'belastingvrij' with 'vrij
van belastingen' without getting odd looks. 'zonder belastingen'
(without taxes) is the normal term.

(We'll leave the explainations of Vrijdag and vrijen for some other time)



Abigail
-- 
perl -pwle '$_ .= reverse'


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

Date: 22 May 1998 19:19:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Tom Christiansen attacks the free software community (was: Re: GNU attacks on the open software community)
Message-Id: <6k4j3b$o4c$4@client3.news.psi.net>

Tyson Richard DOWD (trd@cs.mu.oz.au) wrote on MDCCXXV September MCMXCIII
in <URL: news:6k35r4$49m$1@mulga.cs.mu.OZ.AU>:
++ 
++ No, it is incumbent on whoever quoted them out of context.
++ 
++ What do you expect the FSF to do, monitor every newsgroup for people
++ who read something on their web page and are quoting it out of
++ context?

Oh please. Out of context? It was me who first quoted that page, and
it was the CONTEXT that made me angry.

   "A good free manual for Perl. (There are proprietary books, but these
    are no good, because they are being withheld from our community by
    their owners.)"


Other points in the list only mention 'manual'. But the point for Perl
adds "free". And the context given are "proprietary books". IT DOES NOT
SAY A SINGLE BIT ABOUT THE EXISTING MANUALS. It doesn't say that the
manuals aren't free in FSF religion. It says that there are proprietary
books.



Abigail
-- 
perl -pwle '$_ .= reverse'


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

Date: Fri, 22 May 1998 19:30:04 GMT
From: kees@echelon.nl (Kees Hendrikse)
Subject: Re: Tom Christiansen attacks the free software community (was: Re: GNU attacks on the open software community)
Message-Id: <EtDI64.Jv7@echelon.nl>

In <6k4735$8nc$1@justus.ecc.lu> Stefaan A Eeckels writes:

> In article <EtD3MG.J8v@echelon.nl>,
> 	kees@echelon.nl (Kees Hendrikse) writes:
> > In <6k3k7m$76l$1@justus.ecc.lu> Stefaan A Eeckels writes:
> > 
> >> In Dutch, some 'bleeding' of the meaning is present, however -
> >> to indicate that something doesn't accrue taxes, one would say
> >> 'belastingvrij' (litteraly 'tax free'), whereas the French would
> >> say 'hors taxe' (litteraly 'without taxes').
> >> 
> >> It's safe to say that in Dutch the word 'vrij' (which descends
> >> from the same roots as 'free') has stayed closer to the original
> >> meaning (which isn't 'gratis') than in English.
> > 
> > I'm not so sure about that. Take for example the dutch 'vrij parkeren' (free
> > parking) which does mean: no charge for parking. I think in all western
> > languages the notion of free is dangerously close to 'gratis'. 
>
> I do stick to my guns here - especially if you take my first
> and second paragraphs together. I do acknowledge that
> there are cases where 'vrij' means 'gratis', but the usage of
> 'vrij' in that meaning is not as common as in English. 

I just compared what The Concise Oxford has to say about 'free' to what
Van Dale (comparable Dutch dictionary) has to say about 'vrij'. It turns
out 'vrij' has as many meanings as 'free', most of them related to unbonded,
unrestricted, loose etc, but many meanings are close to or directly related
to "gratis".

> One wouldn't say 'vrije koffie' when wanting to indicate that the
> coffee is served free of charge. And 'vrije liefde' doesn't
> mean you don't have to pay your Significant Other ;-)
> 
> So it's quite unlikely that 'Vrije Software Stichting' 
> (Free Software Foundation in Dutch) could ever be 
> misconstrued to mean people who advocate 'Gratis Software'.

Maybe not; but a 'vrij reizen stichting' (free travel foundation) will
surely mean a foundation that advocates 'gratis' travel.

> There might be a shift of meaning between the dialects of
> Dutch spoken in the Netherlands and in Belgium, but I'd still be
> sceptical if you'd tell me that in the Netherlands 'vrij' is used
> as a common synonym for 'gratis' in all circumstances. 

I didn't suggest it is synonymous, I said the notion of free is dangerously
close to 'gratis'. It is very clear what free or vrij means in contexts
like religion, speech or love. But as soon as free is used close to things
you normally have to pay for, you have to be very careful not to suggest
tou mean gratis. And it doesn't seem to matter very much if we are talking
dutch, german or english.

> Also note that in English you'd have to strain to use
> any other word but 'free' - neither 'gratis' nor 'libre'
> are words that are commonly used in English to express
> the two different meanings of 'free' we've been arguing
> about in this thread.

I think the real problem is not so much with the words and terms, but is
at a cultural level. During most of the past 4 or 5 centuries, freedom was
closesly associated with wealth and power. It's quite modern to be able to
be poor and free at the same time.

-- 
Kees Hendrikse                               | email:     kees@echelon.nl
                                             | web:        www.echelon.nl
ECHELON consultancy and software development | phone: +31 (0)53 48 36 585
PO Box 545, 7500AM Enschede, The Netherlands | fax:   +31 (0)53 43 37 415


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

Date: Fri, 22 May 1998 17:59:49 GMT
From: eryq@zeegee.com
Subject: Re: What is wrong with this FileHandle code?
Message-Id: <6k4eek$49s$1@nnrp1.dejanews.com>

In article <6k2t0d$hhr$1@csnews.cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:

> It seems subclever to suck in nearly 5,000 lines of code and
> seventeen files merely to say:
>
>     $fh = FileHandle->new();
>     open($fh, "< $path");
>
> instead of
>
>     open(FH, "< $path");
>

Yes, but (and forgive me for sounding like a broken record on this point),
if we had a mature bytecode compiler(*) for Perl which created fast-loadable,
pre-compiled .pmc files out of the .pm files (just like Emacs Lisp,
Quintus Prolog, and most other interpreted languages do), this wouldn't
be as *much* of an issue.

    (*) I actually don't care a whit about compiling to native
        machine code. :-)

We don't know what the original poster planned to do with their
application, ultimately.  Perhaps they wanted to be able to
use some of the more-obscure methods in FileHandle.
Perhaps they planned ultimately to subclass IO::Handle and provide
their own funky methods.  The point is, they wanted to use a
module which is a part of the standard Perl distribution.

One could make the argument that C++'s...       cout << "Hi!\n"
 ...is less efficient than...                    printf("Hi!\n")
 ...which in turn is less-efficient than...      write(1, "Hi!\n", 4)

 ...but do we really want to be advising people to always code in
[what may be to them] an uncomfortably low-level fashion... just
because of weaknesses in the current language enviroment?

And I say "current", because I honestly feel that this has got
to change for the language to endure.  Perl's about 10 years old
now, and Perl5 is something like 4 or 5.  With all the progress
that's been made, I can't imagine that Perl would lack fast-loadable
modules on its 20th birthday.

(By the way, this is not intended to be a slight on Malcolm's efforts...
we all know the service he's provided to the community with the Alpha3
compiler and the latest work on 5.005.  And maybe people on p5p know
something I don't about 5.005.  But last time I checked, we weren't
at the point I'd want to be at.)

Eryq.






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


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

Date: 22 May 1998 18:17:05 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Why NOT crypt???
Message-Id: <6k4ff1$3ij@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <6k1p22$lkm$1@nnrp1.dejanews.com>,
 <pittelli@envmed.rochester.edu> wrote:
>Ok, I've seen the threads discussing how to get crypt to work on the most
>recent CPAN NT Perl (5.00402), and I am also aware of Activeware's
>crypt-enabled 5.00307.
>
>BUT, could someone PLEASE tell me WHY the hell crypt was not implemented in
>the 5.00402 NT build,

For two reasons:

   * There's no crypt() available on win32 systems (not even via the C
     runtime)
   * I didn't know better than to fear US law (to which I am subject,
     being domiciled there)

>                       WHO was paranoid about WHAT (from people using
>encryption???),

I was paranoid about breaking the law.

>                and have the developers acknowledged that this implementation
>omission was stupid (at the very least form the standpoint of all the users
>asking for crypt!),

I don't know about stupid, but if you look in the latest sources, you'll
find that you can build in crypt support if you provide it in source form,
or a library that exports the crypt() function, at build time.  I guess
that constitutes an acknowledgement that enabling crypt() should be
possible.

>                    or will I need to build a workaround in all my scripts for
>clients b.c. of an expected lack of FUTURE crypt support???

Since the time I prepared the previous binary distribution, I have convinced
myself that the law (peril be mine!) does not apply to the crypt() function
distributed in binary form.  So the next binary distribution (based on
5.004_05, when it is released) will have it.

But it is unlikely that the standard sources will ever bundle the source
for crypt(), unless the law changes, or is made less ambiguous.

Considering the price you (and I) had to pay for the perl in question, I
hope you find these arrangements satisfactory.

 - Sarathy.
   gsar@umich.edu



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

Date: Fri, 22 May 1998 13:33:59 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: wierd regex question
Message-Id: <3565C516.A3553649@mindspring.com>

Go away.  We're all far too busy discussing what "free" means.  :-)

Try saying:
 $test = '\d{3}-\d{2}-\d{4}'; #no / delimiters
 
The "/"s are being seen as part of your regexp.

Unless you train all you web visitors to always preface their SSNs with
slashes!  :-)

Now, "free" should mean...

thonge@my-dejanews.com wrote:
> 
> Hello all,
> 
> I'm learning this stuff as I go, of course, but I'm putting together a little
> online fill-out form using Perl.  I'd like to verify that certain fields are
> in the right format for the type of information the field contains,
> for instance: e-mail, phone numbers, ssnumbers, and other ad hoc fields that
> might come up.
> 
> In the interest of keeping my Cgi program modular, I want to include the
> verification formats in hidden feilds in the actual HTML document.  is there
> any way to read a regex into a $calar and then compare the contents of a field
> against it?  like this (command line version) (now, please tell me if my
> pattern is right to match a social security number)
> 
> print "Input >";
> chomp ($in = <STDIN>);
> $test = '/\d{3}-\d{2}-\d{4}/';
> if ($in =~ $test) {
>         print "Yup";
> } else {
>         print "Nope";
> }
> 
> As far as my linited logic and regex experiance can tell, this should work as
> long as $test is actually seen as the pattern /\d{3}-\d{2}-\d{4}/.
> 
> Can anybody see what I'm doing wrong, or see a better way?
> 
> Thanks Alot,
> Tony
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 22 May 1998 12:49:35 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: wierd regex question
Message-Id: <3565AC9F.68C5536A@negia.net>

thonge@my-dejanews.com wrote:
> 

[SNIP]

> 
> print "Input >";
> chomp ($in = <STDIN>);
> $test = '/\d{3}-\d{2}-\d{4}/';
> if ($in =~ $test) {
>         print "Yup";
> } else {
>         print "Nope";
> }

[SNIP]

> 
> Can anybody see what I'm doing wrong, or see a better way?

the correctness of your pattern is up for debate, but the key
problem is the right side of the binding operator. when you
use a scalar on the right hand side it is used as a pattern. so
what you've effectively got is:

 if ($in =~ m|/\d{3}-\d{2}-\d{4}/|) { # pattern includes slashes

i believe you want this instead:

 $test = '\d{3}-\d{2}-\d{4}';
 if ($in =~ /$test/) {

or even:

 $test = '\d{3}-\d{2}-\d{4}';
 if ($in =~ $test) {  # no slashes


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: Fri, 22 May 1998 19:40:15 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Win32 NT Perl Wrapper
Message-Id: <ebohlmanEtDIn3.FyH@netcom.com>

Cameron Dorey <camerond@mail.uca.edu> wrote:
: Gurusamy Sarathy wrote:
: > 
: [snip about AS Win32 port]
: > 
: > As for the necessity of wrappers, consider the fact that file associations
: > are broken for redirections.  Or that they're not available in
: > poor-mans-win32 (aka Windows95).

: Maybe I misunderstand you here and/or file associations, but in using
: your Win32 port under Win95, I "associated" .pl files with perl.exe just
: like you do in NT and can double-click on a script and get it to run,
: such as the simple example below (testassoc1.pl):

In NT, you can set up associations so that you can invoke a Perl script 
by typing its name on the command line, followed by arguments.  In Win95, 
you can't: if you want to invoke a script from the command line, you have 
to type "perl" (possibly with some path information) followed by the 
script name followed by the arguments.  Not a really big deal for 
personal use, but if you're creating scripts for other people to use, you 
have to explain to them that any "-" switches have to come after the 
second word on the command line, not the first, or they'll be misinterpreted.



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

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

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