[25711] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7951 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 7 06:10:24 2005

Date: Thu, 7 Apr 2005 03:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 7 Apr 2005     Volume: 10 Number: 7951

Today's topics:
    Re: FAQ 9.22 How do I read mail? Fred
    Re: FAQ 9.22 How do I read mail? robic0@yahoo.com
    Re: FAQ 9.22 How do I read mail? Fredd
    Re: install module with CPAN - how to change default co <lard@tardis.ed.ac.molar.uk>
    Re: Need script to fix C++ "#include" statements robic@yahoo.com
        OO and Inheritance WelkinConsulting@gmail.com
    Re: OO and Inheritance <see_sig@invalid>
    Re: OO and Inheritance <postmaster@castleamber.com>
    Re: output-monitoring module <glex_nospam@qwest.invalid>
        Perl CGI & File I/O Problem <msargent100@hotmail.com>
    Re: Perl CGI & File I/O Problem <1usa@llenroc.ude.invalid>
    Re: Perl CGI & File I/O Problem <tadmc@augustmail.com>
    Re: Perl CGI & File I/O Problem <yyusenet@yahoo.com>
    Re: Perl on TRIPOD hosted sites..file uploading questio <wdflannery@aol.com>
    Re: Perl on TRIPOD hosted sites..file uploading questio <1usa@llenroc.ude.invalid>
    Re: Perl on TRIPOD hosted sites..file uploading questio <wdflannery@aol.com>
    Re: Regular expression question. <someone@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 07 Apr 2005 00:09:07 -0700
From: Fred
Subject: Re: FAQ 9.22 How do I read mail?
Message-Id: <34n951d43j95obj4ojo4i1m5e9d00hkcqu@4ax.com>

On Thu, 24 Mar 2005 17:03:01 +0000 (UTC), PerlFAQ Server
<comdog@panix.com> wrote:

>This message is one of several periodic postings to comp.lang.perl.misc
>intended to make it easier for perl programmers to find answers to
>common questions. The core of this message represents an excerpt
>from the documentation provided with Perl.
>
>--------------------------------------------------------------------
>
>9.22: How do I read mail?
>
>    While you could use the Mail::Folder module from CPAN (part of the
>    MailFolder package) or the Mail::Internet module from CPAN (part of the
>    MailTools package), often a module is overkill. Here's a mail sorter.
>
>        #!/usr/bin/perl
>
>        my(@msgs, @sub);
>        my $msgno = -1;
>        $/ = '';                    # paragraph reads
>        while (<>) {
>            if (/^From /m) {
>                /^Subject:\s*(?:Re:\s*)*(.*)/mi;
>                $sub[++$msgno] = lc($1) || '';
>            }
>            $msgs[$msgno] .= $_;
>        }
>        for my $i (sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msgs)) {
>            print $msgs[$i];
>        }
>
>    Or more succinctly,
>
>        #!/usr/bin/perl -n00
>        # bysub2 - awkish sort-by-subject
>        BEGIN { $msgno = -1 }
>        $sub[++$msgno] = (/^Subject:\s*(?:Re:\s*)*(.*)/mi)[0] if /^From/m;
>        $msg[$msgno] .= $_;
>        END { print @msg[ sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msg) ] }
>
>
>
>--------------------------------------------------------------------
>
>Documents such as this have been called "Answers to Frequently
>Asked Questions" or FAQ for short.  They represent an important
>part of the Usenet tradition.  They serve to reduce the volume of
>redundant traffic on a news group by providing quality answers to
>questions that keep coming up.
>
>If you are some how irritated by seeing these postings you are free
>to ignore them or add the sender to your killfile.  If you find
>errors or other problems with these postings please send corrections
>or comments to the posting email address or to the maintainers as
>directed in the perlfaq manual page.
>
>Note that the FAQ text posted by this server may have been modified
>from that distributed in the stable Perl release.  It may have been
>edited to reflect the additions, changes and corrections provided
>by respondents, reviewers, and critics to previous postings of
>these FAQ. Complete text of these FAQ are available on request.
>
>The perlfaq manual page contains the following copyright notice.
>
>  AUTHOR AND COPYRIGHT
>
>    Copyright (c) 1997-2002 Tom Christiansen and Nathan
>    Torkington, and other contributors as noted. All rights 
>    reserved.
>
>This posting is provided in the hope that it will be useful but
>does not represent a commitment or contract of any kind on the part
>of the contributers, authors or their agents.

ty



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

Date: Thu, 07 Apr 2005 00:10:12 -0700
From: robic0@yahoo.com
Subject: Re: FAQ 9.22 How do I read mail?
Message-Id: <96n951ta15uji76jua0krvfcr78sve32pu@4ax.com>

On Thu, 07 Apr 2005 00:09:07 -0700, Fred wrote:

>On Thu, 24 Mar 2005 17:03:01 +0000 (UTC), PerlFAQ Server
><comdog@panix.com> wrote:
>
>>This message is one of several periodic postings to comp.lang.perl.misc
>>intended to make it easier for perl programmers to find answers to
>>common questions. The core of this message represents an excerpt
>>from the documentation provided with Perl.
>>
>>--------------------------------------------------------------------
>>
>>9.22: How do I read mail?
>>
>>    While you could use the Mail::Folder module from CPAN (part of the
>>    MailFolder package) or the Mail::Internet module from CPAN (part of the
>>    MailTools package), often a module is overkill. Here's a mail sorter.
>>
>>        #!/usr/bin/perl
>>
>>        my(@msgs, @sub);
>>        my $msgno = -1;
>>        $/ = '';                    # paragraph reads
>>        while (<>) {
>>            if (/^From /m) {
>>                /^Subject:\s*(?:Re:\s*)*(.*)/mi;
>>                $sub[++$msgno] = lc($1) || '';
>>            }
>>            $msgs[$msgno] .= $_;
>>        }
>>        for my $i (sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msgs)) {
>>            print $msgs[$i];
>>        }
>>
>>    Or more succinctly,
>>
>>        #!/usr/bin/perl -n00
>>        # bysub2 - awkish sort-by-subject
>>        BEGIN { $msgno = -1 }
>>        $sub[++$msgno] = (/^Subject:\s*(?:Re:\s*)*(.*)/mi)[0] if /^From/m;
>>        $msg[$msgno] .= $_;
>>        END { print @msg[ sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msg) ] }
>>
>>
>>
>>--------------------------------------------------------------------
>>
>>Documents such as this have been called "Answers to Frequently
>>Asked Questions" or FAQ for short.  They represent an important
>>part of the Usenet tradition.  They serve to reduce the volume of
>>redundant traffic on a news group by providing quality answers to
>>questions that keep coming up.
>>
>>If you are some how irritated by seeing these postings you are free
>>to ignore them or add the sender to your killfile.  If you find
>>errors or other problems with these postings please send corrections
>>or comments to the posting email address or to the maintainers as
>>directed in the perlfaq manual page.
>>
>>Note that the FAQ text posted by this server may have been modified
>>from that distributed in the stable Perl release.  It may have been
>>edited to reflect the additions, changes and corrections provided
>>by respondents, reviewers, and critics to previous postings of
>>these FAQ. Complete text of these FAQ are available on request.
>>
>>The perlfaq manual page contains the following copyright notice.
>>
>>  AUTHOR AND COPYRIGHT
>>
>>    Copyright (c) 1997-2002 Tom Christiansen and Nathan
>>    Torkington, and other contributors as noted. All rights 
>>    reserved.
>>
>>This posting is provided in the hope that it will be useful but
>>does not represent a commitment or contract of any kind on the part
>>of the contributers, authors or their agents.
>
>ty
??



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

Date: Thu, 07 Apr 2005 00:11:22 -0700
From: Fredd
Subject: Re: FAQ 9.22 How do I read mail?
Message-Id: <d8n9511vd7vld7jgik1htn8rj7pffrc16l@4ax.com>

On Thu, 07 Apr 2005 00:09:07 -0700, Fred wrote:

>On Thu, 24 Mar 2005 17:03:01 +0000 (UTC), PerlFAQ Server
><comdog@panix.com> wrote:
>
>>This message is one of several periodic postings to comp.lang.perl.misc
>>intended to make it easier for perl programmers to find answers to
>>common questions. The core of this message represents an excerpt
>>from the documentation provided with Perl.
>>
>>--------------------------------------------------------------------
>>
>>9.22: How do I read mail?
>>
>>    While you could use the Mail::Folder module from CPAN (part of the
>>    MailFolder package) or the Mail::Internet module from CPAN (part of the
>>    MailTools package), often a module is overkill. Here's a mail sorter.
>>
>>        #!/usr/bin/perl
>>
>>        my(@msgs, @sub);
>>        my $msgno = -1;
>>        $/ = '';                    # paragraph reads
>>        while (<>) {
>>            if (/^From /m) {
>>                /^Subject:\s*(?:Re:\s*)*(.*)/mi;
>>                $sub[++$msgno] = lc($1) || '';
>>            }
>>            $msgs[$msgno] .= $_;
>>        }
>>        for my $i (sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msgs)) {
>>            print $msgs[$i];
>>        }
>>
>>    Or more succinctly,
>>
>>        #!/usr/bin/perl -n00
>>        # bysub2 - awkish sort-by-subject
>>        BEGIN { $msgno = -1 }
>>        $sub[++$msgno] = (/^Subject:\s*(?:Re:\s*)*(.*)/mi)[0] if /^From/m;
>>        $msg[$msgno] .= $_;
>>        END { print @msg[ sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msg) ] }
>>
>>
>>
>>--------------------------------------------------------------------
>>
>>Documents such as this have been called "Answers to Frequently
>>Asked Questions" or FAQ for short.  They represent an important
>>part of the Usenet tradition.  They serve to reduce the volume of
>>redundant traffic on a news group by providing quality answers to
>>questions that keep coming up.
>>
>>If you are some how irritated by seeing these postings you are free
>>to ignore them or add the sender to your killfile.  If you find
>>errors or other problems with these postings please send corrections
>>or comments to the posting email address or to the maintainers as
>>directed in the perlfaq manual page.
>>
>>Note that the FAQ text posted by this server may have been modified
>>from that distributed in the stable Perl release.  It may have been
>>edited to reflect the additions, changes and corrections provided
>>by respondents, reviewers, and critics to previous postings of
>>these FAQ. Complete text of these FAQ are available on request.
>>
>>The perlfaq manual page contains the following copyright notice.
>>
>>  AUTHOR AND COPYRIGHT
>>
>>    Copyright (c) 1997-2002 Tom Christiansen and Nathan
>>    Torkington, and other contributors as noted. All rights 
>>    reserved.
>>
>>This posting is provided in the hope that it will be useful but
>>does not represent a commitment or contract of any kind on the part
>>of the contributers, authors or their agents.
>
>ty
ti



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

Date: Thu, 07 Apr 2005 09:45:52 GMT
From: Alex Hunsley <lard@tardis.ed.ac.molar.uk>
Subject: Re: install module with CPAN - how to change default compiler flags?
Message-Id: <kj75e.39009$C12.35228@fe1.news.blueyonder.co.uk>

Alex Hunsley wrote:
> Pretty simple stuff... trying to install Text::CSV_XS module via cpano 
> on a redhat 8 system.
> So I run the command and get the output:
> 
[snip]
> cc1: invalid option `tune=pentium4'
> make: *** [CSV_XS.o] Error 1
>   /usr/bin/make  -- NOT OK
> Running make test
>   Can't test without successful make
> Running make install
>   make had returned bad status, install seems impossible
> 
> 
> .... So it appears I need to get rid of the tune=pentium4 option being 
> passed to gcc, but I can't find out where to make this change, can 
> anyone help?
> thanks
> alex

Following up to myself...
still got the problem, but the obvious workaround was to then go to the 
package installation directory in /root/.cpan/build/[packageName], edit 
Makefile to remove the offending option, then do

  make
  make test
  make install


alex




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

Date: Thu, 07 Apr 2005 02:01:44 -0700
From: robic@yahoo.com
Subject: Re: Need script to fix C++ "#include" statements
Message-Id: <2nt95192li0sh0u6hug7sn8840sm5cdq85@4ax.com>

On Thu, 24 Mar 2005 15:04:31 -0600, Tad McClellan
<tadmc@augustmail.com> wrote:

>Ed J <jed@privacy.net> wrote:
>
>> Does anyone want to take a shot at writing a Perl script to fix filenames
>
>
>> I know a pro could write such a script in two minutes.  I use Perl once a
>> year.  It would take me two hours at least!
>
>
>How much does this job pay?

More than your newspaper route...



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

Date: 6 Apr 2005 19:10:28 -0700
From: WelkinConsulting@gmail.com
Subject: OO and Inheritance
Message-Id: <1112839828.096477.69060@l41g2000cwc.googlegroups.com>

I have a question either about OO in general, or its implementation in
Perl--I'm not sure which because I don't know enough.

I've created the module Net::Browser::InternetExplorer.  It drives an
IE instance.

I want to eventually create modules for driving other browsers--like
Net::Browser::FireFox .  I would like to be able to say, therefore:

my $browser = Net::Browser->new( flavor => 'InternetExplorer', $URL );

or

my $browser = Net::Browser->new( flavor => 'FireFox', $URL );

I've tried to figure out myself how to implement this, but I don't even
know which OO concept or catchphrase I should be looking for!  Thanks
in advance for any references or examples.

Andrew



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

Date: Wed, 06 Apr 2005 22:47:43 -0400
From: Bob Walton <see_sig@invalid>
Subject: Re: OO and Inheritance
Message-Id: <4254a01d$1_1@127.0.0.1>

WelkinConsulting@gmail.com wrote:

> I have a question either about OO in general, or its implementation in
> Perl--I'm not sure which because I don't know enough.
-----------------------------------^^^^^^^^^^^^^^^^^^^
That can be remedied with the book "Object Oriented Perl" by Conway.

 ...
> Andrew
-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


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

Date: 7 Apr 2005 07:49:34 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: OO and Inheritance
Message-Id: <Xns96311C5E8BC15castleamber@130.133.1.4>

 wrote:

> I have a question either about OO in general, or its implementation in
> Perl--I'm not sure which because I don't know enough.
> 
> I've created the module Net::Browser::InternetExplorer.  It drives an
> IE instance.
> 
> I want to eventually create modules for driving other browsers--like
> Net::Browser::FireFox .  I would like to be able to say, therefore:
> 
> my $browser = Net::Browser->new( flavor => 'InternetExplorer', $URL );
> 
> or
> 
> my $browser = Net::Browser->new( flavor => 'FireFox', $URL );

Or

my $browser = Net::Browser::Firefox( $url );
my $browser = Net::Browser::InternetExplorer( $url );

Is there a reason why you want to pass it as a parameter? If so, it 
sounds like you want to do something with plug ins, e.g.

Otherwise, in the new of Net::Browser you try to use 
Net::Browser::YourBrowser, if ok, you call new, and return the instance.

> know which OO concept or catchphrase I should be looking for!

Factory:

<http://www.vico.org/pages/PatronsDisseny/Pattern%20Abstract%20Factory/>
<http://www.pasteur.fr/formation/infobio/python/ch18s06.html>

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Wed, 06 Apr 2005 18:00:44 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: output-monitoring module
Message-Id: <wSZ4e.172$tK1.1358@news.uswest.net>

Henry Townsend wrote:

> I'm thinking of writing a module which would monitor the output of any
> script which "use"d it looking for errors. E.g. something like this
> 
> use Output::Monitor STDOUT => qr/re1/, STDERR => qr/re2/;
> 
> This would - perhaps by using tied filehandles - watch all data flowing
> to stdout and stderr, apply the specified REs to each line, and convert
> the exit status to nonzero if any matches occur. The data would still be 
> delivered to the same place, just checked along the way.

> Does anyone know of such a module or something close to use as a
> starting point?

Filter::Handle should help.


http://search.cpan.org/~btrott/Filter-Handle-0.03/Handle.pm


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

Date: 6 Apr 2005 17:11:59 -0700
From: "Mike" <msargent100@hotmail.com>
Subject: Perl CGI & File I/O Problem
Message-Id: <1112832719.726036.87690@l41g2000cwc.googlegroups.com>

I have a simple Perl script that works good as a standalone script that
I want to migrate to work from a web page link.

The script opens a file and does a couple greps to pull out specific
lines from the file and report to the user.

For the CGI script (not using CGI pm and can not use it) as soon as I
hit the open statement all output to the web page stops. For example:

{All the html header stuff printed before this}

printf("Line 1");
open ...
printf("Line 2");

I will see Line 1 but not Line 2

I put all the file i/o and grep/substr work in a sub and called it
first and now I get an Internal Server Error message. Looks like no
output is being generated at all.

If I comment out the open statement I see all my literals output minus
the info I read from the file.

It almost appears that when I hit the open statement, perl loses the
standard out file handle - ?

Is there something special I'm missing about using file IO in a CGI
script?


Any help would be appreciated.


Thanks
  Mike



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

Date: Thu, 07 Apr 2005 00:23:58 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl CGI & File I/O Problem
Message-Id: <Xns9630CF83FC3E8asu1cornelledu@127.0.0.1>

"Mike" <msargent100@hotmail.com> wrote in
news:1112832719.726036.87690@l41g2000cwc.googlegroups.com: 

> I have a simple Perl script that works good as a standalone script
> that I want to migrate to work from a web page link.
> 
> The script opens a file and does a couple greps to pull out specific
> lines from the file and report to the user.
> 
> For the CGI script (not using CGI pm and can not use it) 

Why not?

> printf("Line 1");
> open ...
> printf("Line 2");

 ...

> Is there something special I'm missing about using file IO in a CGI
> script?

Well, there is really no information upon which one can provide any 
pertinent advice. All I can do is to suggest that you read:

perldoc -q 500
perldoc -q CGI

and the posting guidelines for this group.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Wed, 6 Apr 2005 22:56:54 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl CGI & File I/O Problem
Message-Id: <slrnd59bs6.aka.tadmc@magna.augustmail.com>

Mike <msargent100@hotmail.com> wrote:

> (not using CGI pm and can not use it)


Why is it that you cannot use the CGI module?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 06 Apr 2005 21:35:32 -0600
From: YYusenet <yyusenet@yahoo.com>
Subject: Re: Perl CGI & File I/O Problem
Message-Id: <d329q5$bh9$1@news.xmission.com>

Mike wrote:
> I have a simple Perl script that works good as a standalone script that
> I want to migrate to work from a web page link.
> 
> The script opens a file and does a couple greps to pull out specific
> lines from the file and report to the user.
> 
> For the CGI script (not using CGI pm and can not use it) as soon as I
                        ^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^
                         why can you not use CGI pm ??
> hit the open statement all output to the web page stops. For example:
> 
> {All the html header stuff printed before this}
> 
> printf("Line 1");
> open ...
> printf("Line 2");
> 
> I will see Line 1 but not Line 2
> 
> I put all the file i/o and grep/substr work in a sub and called it
> first and now I get an Internal Server Error message. Looks like no
> output is being generated at all.
> 
> If I comment out the open statement I see all my literals output minus
> the info I read from the file.
> 
> It almost appears that when I hit the open statement, perl loses the
> standard out file handle - ?
> 
> Is there something special I'm missing about using file IO in a CGI
> script?
> 
> 
> Any help would be appreciated.
> 
> 
> Thanks
>   Mike
> 

An example would be really helpful!

Please read the posting guidelines.

-- 
k g a b e r t (at) x m i s s i o n (dot) c o m

*Support Mozilla Firefox*!
http://www.spreadfirefox.com/?q=user/register&r=71209


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

Date: 6 Apr 2005 15:21:42 -0700
From: "joesplink" <wdflannery@aol.com>
Subject: Re: Perl on TRIPOD hosted sites..file uploading question..
Message-Id: <1112826102.868063.165150@l41g2000cwc.googlegroups.com>

I see that I've been building on an unsound foundation.... the
following program

#!/usr/bin/perl
use CGI;
$cgi = new CGI;
print "Content-type: text/html\n\n";
print "Hello World"; exit();

runs, but produces the error log

Use of uninitialized value in pattern match (m//) at CGI.pm line 30.
Use of uninitialized value in scalar dereference at CGI.pm line 1589.
Use of uninitialized value in concatenation (.) or string at CGI.pm
line 1589.

And I have no idea why.  I did another little test prog with a
TripodCGI object and also had error messages.  I did a prog with a
TripodPage ojbect and got no error messages.

In the words of Marvin Gaye....What is Going On?



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

Date: Wed, 06 Apr 2005 23:26:09 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl on TRIPOD hosted sites..file uploading question..
Message-Id: <Xns9630C5B6FF8B3asu1cornelledu@127.0.0.1>

"joesplink" <wdflannery@aol.com> wrote in news:1112826102.868063.165150
@l41g2000cwc.googlegroups.com:

> Use of uninitialized value in pattern match (m//) at CGI.pm line 30.
> Use of uninitialized value in scalar dereference at CGI.pm line 1589.
> Use of uninitialized value in concatenation (.) or string at CGI.pm
> line 1589.
> 
> And I have no idea why.  I did another little test prog with a
> TripodCGI object and also had error messages.  I did a prog with a
> TripodPage ojbect and got no error messages.

The messages above are warnings, not errors.

You might want to figure out the verison of the CGI module you are using. 
Then, you can check whether there were bugs in those modules.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: 6 Apr 2005 23:02:58 -0700
From: "joesplink" <wdflannery@aol.com>
Subject: Re: Perl on TRIPOD hosted sites..file uploading question..
Message-Id: <1112853778.382545.59220@o13g2000cwo.googlegroups.com>

>>>>>>The messages above are warnings, not errors.

Those are some nasty warnings!

>>>>>>>>>You might want to figure out the verison of the CGI module you
are using.
Then, you can check whether there were bugs in those modules.

Will do.

Thanks,
WDF



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

Date: Thu, 07 Apr 2005 00:07:12 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regular expression question.
Message-Id: <QQ_4e.4985$VF5.39@edtnps89>

Brian McCauley wrote:
> John W. Krahn wrote:
> 
>> A. Sinan Unur wrote:
>>>
>>> use strict;
>>> use warnings;
>>>
>>>> $required_pattern = "(\\|Line 4)";
> 
>>> my $required_pattern = '(\|Line 4)';
>>
>> Or even better:
>>
>> my $required_pattern = qr'(?:\|Line 4)';
> 
> Or even better:
> 
> my $required_pattern = qr/\|Line 4/;

Then you would have to backslash the backslash character because qr// 
interpolates its contents.

my $required_pattern = qr/\\|Line 4/;


> When there's no beniefit gained from using non-standard delimiters on 
> qr// it's best not to do so (IMNSHO).

I used the single quotes to avoid interpolation.  :-)


John
-- 
use Perl;
program
fulfillment


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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.

#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 V10 Issue 7951
***************************************


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