comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
April 2008
motuwethfrsasuw
 123456 14
78910111213 15
14151617181920 16
21222324252627 17
282930     18
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Regex for "at start of line OR preceded by space".         


Author: Robbie Hatley
Date: Apr 26, 2008 23:16

I needed a regex that says "either at the start of a line, OR
preceded by some whitespace".

The whitespace (if any) is not to be part of the match.
That part I know how to do with lookbehind:

(?<=\s)($Regex1)

Start of line is easy too:

^($Regex1)

but when I tried to or them together:

my $Regex2 = qr{^|(?<=\s)($Regex1)};

But for some reason, it matches the empty string at the beginning
of every input string. Why is that?

What I finally came up with that works is:

my $Regex2 = qr{((?:^$Regex1)|(?:(?<=\s)$Regex1))};

That's pretty messy, tho. Are there easier ways of
doing this that I don't see?
Show full article (0.80Kb)
11 Comments
  FAQ 2.13 What mailing lists are there for Perl?         


Author: PerlFAQ Server
Date: Apr 26, 2008 18:03

This is an excerpt from the latest version perlfaq2.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

2.13: What mailing lists are there for Perl?

Most of the major modules (Tk, CGI, libwww-perl) have their own mailing
lists. Consult the documentation that came with the module for
subscription information.

A comprehensive list of Perl related mailing lists can be found at:

http://lists.perl.org/

--------------------------------------------------------------------
Show full article (1.30Kb)
no comments
  FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?         


Author: PerlFAQ Server
Date: Apr 26, 2008 12:03

This is an excerpt from the latest version perlfaq2.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

2.17: What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?

Perl.com at http://www.perl.com/ is part of the O'Reilly Network, a
subsidiary of O'Reilly Media.

The Perl Foundation is an advocacy organization for the Perl language
which maintains the web site http://www.perl.org/ as a general advocacy
site for the Perl language. It uses the domain to provide general
support services to the Perl community, including the hosting of mailing
lists, web sites, and other services. There are also many other
sub-domains for special topics like learning Perl, Perl news, jobs in
Perl, such as:
Show full article (2.22Kb)
no comments
  Very good CGI Programming text book         


Author: tutorialwebs
Date: Apr 26, 2008 11:43

no comments
  FAQ 2.16 Where do I send bug reports?         


Author: PerlFAQ Server
Date: Apr 26, 2008 06:03

This is an excerpt from the latest version perlfaq2.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

2.16: Where do I send bug reports?

If you are reporting a bug in the perl interpreter or the modules
shipped with Perl, use the *perlbug* program in the Perl distribution or
mail your report to perlbug@perl.org or at http://rt.perl.org/perlbug/ .

For Perl modules, you can submit bug reports to the Request Tracker set
up at http://rt.cpan.org .

If you are posting a bug with a non-standard port (see the answer to
"What platforms is perl available for?"), a binary distribution, or a
non-standard module (such as Tk, CGI, etc), then please see the
documentation that came with it to determine the correct place to post
bugs.

Read the perlbug(1) man page (perl5.004 or later) for more information.

--------------------------------------------------------------------
Show full article (1.72Kb)
3 Comments
  untaint a hash eval         


Author: Daniel Parry
Date: Apr 26, 2008 04:49

Hello all,

I was wondering if anyone could give me some pointers as to the
best way to untaint the assocative array %%config in the following
snippet please? Do I need to check its content against a suitable
regexp somehow? Or maybe I should use another method to read in
the file contents, though I'd prefer to not to have to include
any cpan libraries...

no strict;
if ( open( CONFIG, "$configFile" ) ) {
my $readConfig = "";
while ( ) { $readConfig .= $_; }
eval $readConfig;
%%config = %%{ $userconfig };
close( CONFIG );
}
else {
die "Could not read config file: $configFile!";
}
use strict;
Show full article (0.79Kb)
9 Comments
  FAQ 2.14 Where are the archives for comp.lang.perl.misc?         


Author: PerlFAQ Server
Date: Apr 26, 2008 00:03

This is an excerpt from the latest version perlfaq2.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

2.14: Where are the archives for comp.lang.perl.misc?

The Google search engine now carries archived and searchable newsgroup
content.

http://groups.google.com/groups?group=comp.lang.perl.misc

If you have a question, you can be sure someone has already asked the
same question at some point on c.l.p.m. It requires some time and
patience to sift through all the content but often you will find the
answer you seek.

--------------------------------------------------------------------
Show full article (1.42Kb)
2 Comments