Harry Putnam wrote:
"John W. Krahn" <[EMAIL PROTECTED]> writes:

Harry Putnam wrote:

  my ($rgx,$use,@finddir);
  $use = shift @_;
$rgx = qr/(^|:)$use /;

You are using capturing parentheses but you never use the string thus
captured so you may want to use non-capturing parentheses instead.

What are non-capturing parens?

By `capturing' do you mean `(^|:)$use '?

I was shooting for a regex that finds both of these:

$matchofrgx bla bla bla
    and
bla bla bla:$matchofrgx

I'm really not sure what you meant there so I'm probably missing your
point.

Parentheses are used in a regular expression for grouping, alternation and capturing.

If you see a left parenthesis followed by a question mark '(?' then they are used for grouping or alternation or some other special purpose but not for capturing.

perldoc perlre
perldoc perlretut


  sub wanted {

Subroutine names are in package scope so defining a named subroutine
inside another named subroutine makes little sense.

I'm pretty confused about this scope business.  What do you mean
there?  What does it mean to say something is in package scope?

Or maybe you can direct me to the right perldoc output to get cleared
up on that a little better.

perldoc -f package
perldoc perlmod
perldoc perlsub
http://perl.plover.com/FAQs/Namespaces.html



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to