http://qs321.pair.com?node_id=382248


in reply to Confusing syntax error with grep

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