[10039] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3632 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 4 03:05:40 1998

Date: Fri, 4 Sep 98 00:00:41 -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, 4 Sep 1998     Volume: 8 Number: 3632

Today's topics:
    Re: Blowfish crypo with perl (Martien Verbruggen)
    Re: CGI POSTing information to another CGI program. (Martin Gleeson)
    Re: CGI scripts <jbc@west.net>
        Change of array construction behaviour (5.00401 to 5.00 (Damian Conway)
    Re: COBOL and Perl <richmond@plano.net>
    Re: DeCrypt ? (Ronald J Kimball)
    Re: Does open() lock the file? (Mark-Jason Dominus)
        email attachments (Jye Tucker)
    Re: even or odd (Ronald J Kimball)
    Re: file copying <kevinbartz@geocities.com>
    Re: file copying (Martien Verbruggen)
    Re: file copying (Larry Rosler)
    Re: Forum addons ie: bad words filter (Martien Verbruggen)
        HELP : Pattern Matching <s2170000@cse.unsw.edu.au>
    Re: Newbie RE Question (Ronald J Kimball)
    Re: Newbie RE Question (Larry Rosler)
    Re: Perl & Java - differences and uses (Martien Verbruggen)
    Re: Perl compiler (John Moreno)
    Re: Perl gurus opinion needed. stevenjm@olywa.net
    Re: Programmer Needed ASAP (Ronald J Kimball)
    Re: Question of regex in perl (Ronald J Kimball)
    Re: Question of regex in perl (Tad McClellan)
        RE: Trolls bitnut1@hotmail.com
    Re: Trolls (Martien Verbruggen)
    Re: Trolls bitnut1@my-dejanews.com
        Unusual training request <hermanr@fuse.net>
    Re: Unusual training request (Martien Verbruggen)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 04 Sep 1998 02:58:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Blowfish crypo with perl
Message-Id: <vHIH1.6$rg2.13607@nsw.nnrp.telstra.net>

In article <6slpnl$cks$1@news.kth.se>,
	e98_abl@e.kth.se (Anders) writes:
> Does anyone know how to crypt a string using Blowfish in Perl?

If somebosy has already done this for you, their work most likely can
be found at CPAN: http://www.perl.com/CPAN/modules. Spend some time
looking through the module list there, especially section 14, and see
if one of those modules can do what you want it to do.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 04 Sep 1998 12:15:38 +1000
From: gleeson@unimelb.edu.au (Martin Gleeson)
Subject: Re: CGI POSTing information to another CGI program.
Message-Id: <gleeson-ya02408000R0409981215380001@news.unimelb.edu.au>

[courtesy cc: sent to original author via email.]

In article <35eee365.6458191@news.btinternet.com>,
Gellyfish@btinternet.com (Jonathan Stowe) wrote:

>On Thu, 03 Sep 1998 12:16:23 -0400, Earl Westerlund wrote :

>>Josh Freeman wrote:

>>> I need help with a small problem.  I want to pass information using POST
>>> from an HTML form.  That program will save the information, then POST
>>> that information to another CGI program.

>>> The problem is the second step.  I need to know how to send information
>>> from my(the first) CGI program to the second CGI program using POST.

>>> I want to avoid using GET, and also want to avoid have the user have to
>>> press a second submit button.

>>> Any Ideas?

>>This is not a Perl question, but since you asked here...

>>Take a look at CGI.pm.  You can find information about it at
>>http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.htm.

>I'm not entirely sure whether CGI.pm will help  entirely (although of
>course it is widely recommended to be used in CGI programs) - what is
>required is probably the LWP (libwww-perl) library of modules
>available from CPAN this will allow you to pass POST requests to
>another CGI - however one would need to learn about the correct
>encoding for the POST'ed data which should be taken up with the
>relevant documentation or a newsgroup concerned with CGI issues.

I actually did this earlier this year, and there are a few pitfalls if
you don't know CGI thoroughly. I've made the program available at
<http://www.unimelb.edu.au/%7Egleeson/perl-scripts/cgi-proxy.pl>.
Enjoy!

Cheers,
Marty.
--
Martin Gleeson        ** Personal opinion only **
Webmaster, The University of Melbourne, Australia.
     "I'm sorry for the double slash."
     - Tim Berners-Lee in a Panel Discussion, WWW7, Brisbane, 1998.


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

Date: Thu, 03 Sep 1998 23:45:35 -0700
From: John Callender <jbc@west.net>
Subject: Re: CGI scripts
Message-Id: <35EF8C8F.D464B8A3@west.net>

Jules wrote:
> 
> Please point out the errors for me.
 
> print << END;
> Content-type: text/html
> <HTML><BODY><H1><P>Thank you for joining the list</H1></BODY></HTML>

1) You need a blank line after the "Content-type: text/html" header.

2) You asked a CGI question in comp.lang.perl.misc, rather than
comp.infosystems.www.authoring.cgi. For obscure reasons, this annoys the
hell out of certain people. Doubtless you'll be hearing about that...

--
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: 4 Sep 1998 01:20:57 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Change of array construction behaviour (5.00401 to 5.00502)
Message-Id: <6snf9p$4l1$1@towncrier.cc.monash.edu.au>

Is the change in behaviour of the following code documented somewhere?

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

	$_ = 0;

	@array1 = (1, /2/,   3);
	@array2 = (1, undef, 3);

	print "[", join('|',@array1), "]\n";
	print "[", join('|',@array2), "]\n";


Under Perl 5.00401:

	Use of uninitialized value at test.pl line 9.
	[1||3]
	[1||3]


Under Perl 5.00502:

	Use of uninitialized value at test.pl line 9.
	[1|3]
	[1||3]


I liked the old behaviour better :-/

The version info:


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

	This is perl, version 5.004_01

	Copyright 1987-1997, Larry Wall

        Perl may be copied only under the terms of either the Artistic
        License or the GNU General Public License, which may be found
        in the Perl 5.0 source kit.

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

	This is perl, version 5.005_02 built for IP22-irix

	Copyright 1987-1998, Larry Wall

        Perl may be copied only under the terms of either the Artistic
        License or the GNU General Public License, which may be found
        in the Perl 5.0 source kit.

        Complete documentation for Perl, including FAQ lists, should be
        found on this system using `man perl' or `perldoc perl'. If you
        have access to the Internet, point your browser at
        http://www.perl.com/, the Perl Home Page.

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



Damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 name: Damian Conway                           addr: School of Computer Science
email: damian@csse.monash.edu.au                        and Software Engineering
  web: http://www.cs.monash.edu.au/~damian           Monash University
  fax: +61-3-9905-5146                               Clayton 3168, AUSTRALIA


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

Date: Thu, 03 Sep 1998 22:40:07 +0000
From: Charles Richmond <richmond@plano.net>
To: rivie@daa-utah.com
Subject: Re: COBOL and Perl
Message-Id: <35EF1AC7.F1F9B3DC@plano.net>

Roger Ivie wrote:
> 
> In article <35ED0C98.3512@iridia.ulb.antispam_remove.ac.be>, Nick Bradshaw wrote:
> >Mark-Jason Dominus wrote:
> >>
> >> Stored-program computers, such as EDSAC and UNIVAC, were not even in
> >> the planning stages until 1946, and none was completed before 1949.
> >
> >That would be *American* stored-program computers, of course.
> 
> We'll take the credit for EDSAC if you really _must_ give it to us.
>
EDSAC, which was Maurice Wilkes' computer in England, and EDVAC, which was
John von Neumann's computer at Princeton, are so closely named that it is easy
to get them mixed up.  So perhaps this post meant to reference the Princeton machine.

-- 
+-------------------------------------------------------------+
|     Charles and Francis Richmond     <richmond@plano.net>   |
+-------------------------------------------------------------+


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

Date: Thu, 3 Sep 1998 22:25:40 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: DeCrypt ?
Message-Id: <1desrv8.19b3dw51e28n4N@bay2-87.quincy.ziplink.net>

Abigail <abigail@fnx.com> wrote:

>     for my $i1 ("\x00" .. "\xFF", "") {

Sorry, the magic of the range operator (and auto-increment) only works
with strings which match the regex /^[a-zA-Z]*[0-9]*$/.

  DB<1> x ("\x00" .. "\xFF")
0  "\c@"

for my $i1 ((map chr($_), 0x00 .. 0xFF), '') {

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 3 Sep 1998 21:06:40 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Does open() lock the file?
Message-Id: <6snef0$qmm$1@monet.op.net>

In article <6smt7d$9km$1@nnrp1.dejanews.com>,  <smitzla@uswest.com> wrote:
>When I do an open() on a file for writing, is the file that is opened locked
>in any way that would prevent other processes from writing to this file or
>otherwise manipulating it? 

No.


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

Date: Fri, 04 Sep 1998 15:38:10 +1000
From: jye@buckconsultants.com.au (Jye Tucker)
Subject: email attachments
Message-Id: <jye-ya02408000R0409981538100001@qld.nnrp.telstra.net>

Hi everyone,

I'm having some trouble trying to work out how to get a perl script of mine
to send an email with a plain text file attachment. I would have thought
one of the mail modules would have handled this but haven't been able to
find anything.

I'd appreciate any help at all!

Thanks,

Jye


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

Date: Thu, 3 Sep 1998 22:25:42 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: even or odd
Message-Id: <1dessjw.1u5tk3tkrltneN@bay2-87.quincy.ziplink.net>

John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:

> In article <6seo42$r42$1@nnrp1.dejanews.com>,
>   <birgitt@my-dejanews.com> wrote:
> >In article <6sbo6n$be$1@news.smart.net>,
> >  hymie@lactose.smart.net (hymie!) wrote:
> >> Every (integer) is an even multiple of 1, because 1 divides evenly into
> >> them all with no remainder.
> 
> Whoops. Definition shift leads to incorrect result.

Like many words in the English language, 'even' has several meanings.

> >> 9 is an even multiple of 3, because 3 divides into it evenly.
> 
> 9 is an odd multiple of 3. It may be an "exact" multiple of 3, but in
> this context something either is a multiple of something else or it is
> not. Talking about "exact" is silly. That's what happens when you talk
> integers.

3 evenly divides 9.  9 is an even multiple of 3.  The result of dividing
9 by 3, however, is an odd number.

Consider: if you have three boards that you placed side by side, and all
three boards were the same length, then you would say that the ends of
the board were even.  For this definition of 'even', the antonym is
'uneven', not 'odd'.

> >> On the other hand, 6.25 is a multiple of 2, 
> 
> But 6.25 is not an integer, and thus cannot be even or odd. 

Can't argue with that!

> >A non native English speaker would get confused here. I thought an even
> >number is a number you can divide by 2 without a having a remainder.
> 
> It is.

Yes, an even *number* is a number you can divide by 2 without having a
remainder.  But hymie was referring to even *multiples*, not even
numbers.

> >In your two examples, you use the word even with a different meaning. In
> 
> Yep, and that leads to confusion and mistakes.

Even I find it confusing sometimes.  ;-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 3 Sep 1998 15:39:17 -1000
From: "Kevin Bartz" <kevinbartz@geocities.com>
Subject: Re: file copying
Message-Id: <6snghd$1um$1@supernews.com>

Hmmm... I make my entry to the Perl newsgroup with this response:

Use
open(HANDLE,"file")
to open the file you want to copy. Then load a string with its contents:
$string=<HANDLE>
then close the file:
close(HANDLE)

Then you can create a new file with
open(NEWFILE,">filename")
And then this line does the copy
print NEWFILE "$string";
then close it
close(NEWFILE)

Then, to set the permissions, use the chmod method:
chmod(0666,"filename");
Substitution 666 for your permissions. Hope this helps.

--- Kevin Bartz

Doyle Johnson wrote in message <6snaf9$ta$1@nnrp03.primenet.com>...
>   Hi all,
>
>   First I would like to thank Faisal Nasim for his speedy reply to my last
>question.. I have it working fine now... Thanks!
>
>   Now for question number 2:
>
> I need to be able to copy SPECIFIC files from one directory to another and
>set the permissions.... what would be the command and proper syntax to get
>this done?
>
>Thanks
>
>Doyle Johnson
>
>
>




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

Date: Fri, 04 Sep 1998 03:09:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: file copying
Message-Id: <ARIH1.11$rg2.13607@nsw.nnrp.telstra.net>

In article <6snaf9$ta$1@nnrp03.primenet.com>,
	"Doyle Johnson" <sales@madm.com> writes:

>  I need to be able to copy SPECIFIC files from one directory to another and
> set the permissions.... what would be the command and proper syntax to get
> this done?

use File::Copy;
copy($source, $destination);

# perldoc File::Copy

chmod $octalmask, $file
chmod $octalmask, @files

# perldoc -f chmod

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 3 Sep 1998 22:57:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: file copying
Message-Id: <MPG.1059212066a52aab989822@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6snghd$1um$1@supernews.com> on Thu, 3 Sep 1998 15:39:17 -
1000, Kevin Bartz <kevinbartz@geocities.com> says...
> Hmmm... I make my entry to the Perl newsgroup with this response:

Welcome.  PLEASE take the trouble to test everything you choose to post, 
even if it seems trivial to you!

> Use
> open(HANDLE,"file")
> to open the file you want to copy.

You need to terminate every statement.  The proper way to terminate this 
one is by testing for success and reporting failure, like this:

     or die "Couldn't open 'file'. $!\n";

>     Then load a string with its contents:
> $string=<HANDLE>

This reads the file until and including the first newline.  I don't think 
that's what's wanted.  (Of course, as written it doesn't compile, because 
it isn't terminated.)  Perhaps you meant first to specify

  local $/;
 
> then close the file:
> close(HANDLE)

               ;

> Then you can create a new file with
> open(NEWFILE,">filename")

As above.

> And then this line does the copy
> print NEWFILE "$string";

Finally a semicolon!  But the double-quotes are superfluous.

> then close it
> close(NEWFILE)

                ;

> Then, to set the permissions, use the chmod method:
> chmod(0666,"filename");
> Substitution 666 for your permissions. Hope this helps.

Helps better if correct.  There are plenty of examples of copying files 
in all the elementary texts.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 04 Sep 1998 03:02:26 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Forum addons ie: bad words filter
Message-Id: <6LIH1.7$rg2.13607@nsw.nnrp.telstra.net>

In article <35eeb60c.0@news3.uswest.net>,
	"'V)ReTK'" <socrates@uswest.net> writes:

What sort of mushrooms did you eat?

> need some help installing two addons to working cgi wwwboard x2
> badwords check & preview (edit msg's before post)

So? hire someone.

> begin 666 badword.txt
> M0T1!($-E;G-O<CH@075T;RU$971E8W0@(D)!1"(@5V]R9',-"D-$02!#96YS

What the crap is this? Don't post encoded stuff to this group, please.

Are you for real, or are you just playing troll?

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 04 Sep 1998 16:40:47 +1000
From: Chern Leong Lau <s2170000@cse.unsw.edu.au>
Subject: HELP : Pattern Matching
Message-Id: <35EF8B6F.167E@cse.unsw.edu.au>

how do u exclude some strings in your regular expression?
Example , I want to match for links in a html file, links such as

<a href = "http://something/">
<a href = "./myscript.html">

but I want to exclude mailto or ftp links ,like
<a href="mailto:s2170000@cse.unsw.edu.au">

To match for string with in <a href="">
one can write 
/<a href="(.*?)">/ig

Is there anything u can do to ignore certain string in expression??


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

Date: Thu, 3 Sep 1998 22:25:43 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Newbie RE Question
Message-Id: <1desubs.11plg9s17rjlaqN@bay2-87.quincy.ziplink.net>

Larry Rosler <lr@hpl.hp.com> wrote:

> $f1 = (split /\t/)[0];

Does the Benchmark for this one improve if you change it to

$f1 = (split /\t/, $_, 2)[0];

?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 3 Sep 1998 22:44:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie RE Question
Message-Id: <MPG.10591e133d5120b9989821@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <1desubs.11plg9s17rjlaqN@bay2-87.quincy.ziplink.net> on Thu, 3 
Sep 1998 22:25:43 -0400, Ronald J Kimball <rjk@coos.dartmouth.edu> 
says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> 
> > $f1 = (split /\t/)[0];
> 
> Does the Benchmark for this one improve if you change it to
> 
> $f1 = (split /\t/, $_, 2)[0];

None whatsoever.  With only one "\t" in the strings being split, why 
should it?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 04 Sep 1998 02:47:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl & Java - differences and uses
Message-Id: <gxIH1.5$rg2.13607@nsw.nnrp.telstra.net>

In article <35EE5D83.41B6DD9D@acm.org>,
	Patricia Shanahan <pats@acm.org> writes:
> This treatment of programming language selection as a dirty topic is
> very unfortunate. It is a critical aspect of software design, and

Indeed. Of software design. But only _after you specify what you want
to do. Most of the critiques here on the "what's the best programming
language' discussion are about the fact you cannot talk about this
issue in a general sense. Which programming language is 'better' at
certain well defined tasks is something that can be discussed, and is
discussed in many places. Which programming language is better in
general cannot be discussed, and isn't discussed anywhere. You get
threads about it, but they're always religiously inspired, or troll
perpetuated.

As soon as the original poster tells us what the actual task is, we
might be able to move this whole thread into reality. Until then, it's
useless.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 4 Sep 1998 00:17:48 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: Perl compiler
Message-Id: <1det1ao.hhaujx1c9bw3kN@roxboro0-017.dyn.interpath.net>

In comp.lang.perl.misc Joe McMahon <joe.mcmahon@gsfc.nasa.gov> wrote:

> phenix@interpath.com (John Moreno) wrote:
> 
> >What I fail to understand is why you posted this in reply to my message
> >without including any of what I wrote or addressing (except indirectly
> >in this last paragraph) what I said.
> 
> Sorry - my news reader picks whatever I last read in the thread as what
> I'm replying to; I definitely didn't intend to single out or ignore
> anyone. 

Only if the window is still open and you "Followup via Posting" instead
of "New Posting'.

> >Breaking security can be more serious than breaking a contract - it
> >results in jail time and not lost money (companies aren't concerned with
> >this but the executives who might end up in jail probably do).
> 
> I agree, in principle, but I'll bet that it would end up at the programmer's
> desk saying "he did it", plausible deniability being what it is these days...

Yep, but he immediately says that there was a conspiracy (which there
was) in order to plea out.  Unlike just duplicating a file, cracking a
system is a very definite and positive act.

-- 
John Moreno


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

Date: Fri, 04 Sep 1998 00:31:16 GMT
From: stevenjm@olywa.net
Subject: Re: Perl gurus opinion needed.
Message-Id: <6sncck$sor$1@nnrp1.dejanews.com>

What!

No Perl Diver's?

Steve



> Elaine -HappyFunBall- Ashton  <eashton@bbnplanet.com> wrote:
> >perl jerky-boy
> >perl tiger
> >[etc.]
>
> At the conference, when we were printing certificates, people asked us
> for the darndest things.  We certified people as Perl Programmers,
> Perl Studmuffins, Perl Gurus, Perl Hackers, Perl Engineers, Perl
> Experts, Perl Wizards, Perl Poets, Perl Porters, Perl Pornographers,
> and Perl Pimps.
>
> For some reason nobody asked to be a certified Perl Pederast.
> I suppose it's only a matter of time.
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 3 Sep 1998 22:25:44 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Programmer Needed ASAP
Message-Id: <1desve1.1sse4lqwjfk9cN@bay2-87.quincy.ziplink.net>

Aaron <aaron@pornoinferno.com> wrote:

> and will pay hansomly.
               ^^^^^^^^

But, you'll have to pay income taxis.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 3 Sep 1998 22:25:45 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Question of regex in perl
Message-Id: <1desvih.1y4yoyi1vddc3zN@bay2-87.quincy.ziplink.net>

duke <djhwang@lgtel.co.kr> wrote:

> The following is part of my perl script to match a string.
> 
> $line =~ m/^From: (\S+).*\(([^()]*)\)/
> 
> I like to match a string like
> "From: yasha@harari.org (the king)" or
> "From: yasha@harari.org " with the regex.

It appears that you want the \(...\) part of the regex to be optional.

$line =~ m/^From: (\S+).*(?:\([^()]*\))?/;

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 4 Sep 1998 00:24:26 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Question of regex in perl
Message-Id: <aitns6.eb2.ln@metronet.com>


[ Matching of email addresses has been beaten to death here.

  Please do a dejanews search to see how hopeless it is to
  try to match all legal email addresses correctly.
]


duke (djhwang@lgtel.co.kr) wrote:
: The following is part of my perl script to match a string.

: $line =~ m/^From: (\S+).*\(([^()]*)\)/
                         ^^
                         ^^ why not \s+ instead

   Do you _want_ $from_name to get "deceased" from a line like:

      From: yasha@harari.org (the king) (deceased) 

   ??


: I like to match a string like
: "From: yasha@harari.org (the king)" or

  It does, so I guess this is not your problem.  ;-)


: "From: yasha@harari.org " with the regex.
                         ^
                         ^

   With the space there?

   Is it optional or required to be there?

   Can there be more than one there?


: And I print the $line variable with

: $reply_address = $1;
: $from_name = $2;

   Of course $from_name will be unitialized for your second From: line
   (assuming the regex was changed so that the match was successful)


: print "To: $reply_address ($from_name) \n";

   print "addr '$1'  name '$2'\n" if  /^From: (\S+)(?:\s+\(([^()]*)\))?/


: but it did not work.

   That is content free.

   Helps us to help you not at all.

   Maybe you meant "but it does not match" instead?


: please help me out.

   Don't have enough information.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 04 Sep 1998 02:44:36 GMT
From: bitnut1@hotmail.com
Subject: RE: Trolls
Message-Id: <6snk6k$3mt$1@nnrp1.dejanews.com>


>........
> syntax error at - line 3, near "print"
>........


How about taking off Perl blinders when reading
(assuming there's something between your ears)?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 04 Sep 1998 03:12:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Trolls
Message-Id: <pUIH1.13$rg2.13607@nsw.nnrp.telstra.net>

In article <6snk6k$3mt$1@nnrp1.dejanews.com>,
	bitnut1@hotmail.com writes:
>>........
>> syntax error at - line 3, near "print"
>>........
> 
> How about taking off Perl blinders when reading
> (assuming there's something between your ears)?

How about getting a news reader that properly sets its headers when
following up? And how about not getting all worked up when someone
doesn't scream with laughter at your little joke, but chooses to
follow it up with another one? Did you expect that, even in a joke,
you could get away with wrong perl syntax?

Lighten up.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 04 Sep 1998 06:04:43 GMT
From: bitnut1@my-dejanews.com
Subject: Re: Trolls
Message-Id: <6snvtr$ij4$1@nnrp1.dejanews.com>



 $question = 'You expect someone to laugh even when the syntax is wrong?';

 $answer = 'YES';

 $perl_bozos_now_happy = 'Yep, the syntax is OK';

 return ( $pleasure = 5 / 0 ); # wonder if they'll notice :]

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 03 Sep 1998 22:32:08 -0400
From: Robert Herman <hermanr@fuse.net>
Subject: Unusual training request
Message-Id: <35EF5128.D4A1E2B2@fuse.net>

Hello there,

In brief (story and explanation follow), I am searching for some kind of
"official" (commercial or from a college) course in perl.  I know there
are many fine books out there (as the FAQ explained), but read
further...

I signed up for the learning-perl course in my small high school.  It
turns out that not only was I the only one to sign up, but the teacher
who would have taught the course, can't.  Rather than dropping the
course ingloriously, the school has asked me to try to find an online
correspondence course--preferably sanctioned by some
college/university.  If possible, the course should focus on teaching
perl--not perl and a bunch of other stuff, nor CGI/UNIX/whatever through
perl.  I have searched the Web and several university sites to no avail,
and so I've turned here.

A couple of notes, in case they matter:

1) I'm competent at C and BASIC, and remember a bit of Pascal.

2) Assuming the cost isn't ridiculous, the school will pick it up.

3) Yes, I know I should just buy a book and learn it myself, but I'd
like to get credit from the school.

I would be very appreciative of any help anyone could offer.  I'm sorry
about posting without a week's worth of lurking, but these circumstances
are a little weird.

Thanks again,
--Robert



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

Date: Fri, 04 Sep 1998 03:18:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Unusual training request
Message-Id: <c_IH1.15$rg2.13607@nsw.nnrp.telstra.net>

In article <35EF5128.D4A1E2B2@fuse.net>,
	Robert Herman <hermanr@fuse.net> writes:
> Hello there,
> 
> In brief (story and explanation follow), I am searching for some kind of
> "official" (commercial or from a college) course in perl.  I know there
> are many fine books out there (as the FAQ explained), but read
> further...

Have a look at: 

http://www.perltraining.com/
http://reference.perl.com/query.cgi?courses

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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