Don't try to futz with
grep (expr), @list;
or
grep ((expr), @list);
or any such... you just confuse the hell out of the parser and out of someone trying to read it. Instead use this syntax for grep:
grep { block } @list;
Those are curly braces setting off a block, not parenthesese setting off an expression. So your code would become:
grep {
( -f "$path/$_" ) and
( $_ =~ m/\.(java|xml|cpp|c|h|inc|pas)$/i ) and
( $self->Scan_File( "$path/$_", $out, $target )
} @files );
# Also scan any subdirectories.
grep {
( ( -d "$path/$_" ) and
( $_ !~ /^\.+$/ ) and # but avoid . and ..
( $self->parseDir( "$path/$_", $out, $target )
)
} @files;
However, it also doesn't make sense because you are using grep in a void context. grep is meant to filter a list (reduce some of the contents out of list1 into list2). If you just want to apply a block of code against every item in a list, think of using map or foreach. Most folks here will complain, likewise, if you use map in a void context (for the same reason, sort of, that I complain about you using grep... the purpose of map (in perl) is to *mutate* a list... although in some other language paradigms one might think of map as making sense in a void context... but that's another argument).
------------
:Wq
Not an editor command: Wq
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.