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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to glob an array of filenames

Status
Not open for further replies.

NullTerminator

Programmer
Oct 13, 1998
293
US
I want to glob an array of filenames retrieved from a source control list command.

The array contains a list of filenames with newlines.
I could walk the list and pre chomp them, but how to feed them to glob and get the filtered list out to an array

Tnx
Jeb
\0
 
If you just want to remove the linefeed chars from the end of each element of the array, chomp the whole array!

Code:
my @array;   # this contains filenames with trailing lf
chomp @array;


Trojan.
 
thanks, chomping is the easy part,

what I need to figure out is how to use the array as the input to glob

Code:
@globbedFiles = glob( "*.java", @FilesFromSrcControl)
 
I think you want grep. Maybe something like:
Code:
my @globbedFiles = grep {/\.java$/} @FilesFromSrcControl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top