Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Glob question 1

Status
Not open for further replies.

PerlGerl

Programmer
Jun 29, 2004
19
US
How to glob but not include all files, example: I want to list all files in a directory that end in a certain extention except those that have the string "all" in the filename. so it would capture

foo.c
bar.c

but not

foo-all.c
bar-all.c
 
Use grep with negation (!)?
Code:
my @cfiles = grep(!/-all/, glob("*.c"));
 
yes, that is it exactly. I didn't have the syntax right, i was trying a != grep and it was not having it.
Thanks for your help ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top