You can assemble the regular expression as a string and then use that. So if your users call the script like: foo.pl .c .cpp .h .rc you could do something like this: my $regex = join ("|", @ARGV); # $regex is now '.c|.cpp|.h|.rc' $regex =~ s/\./\\./g; # escape the periods my @filtered = grep { /($regex)$/ } @unfiltered; --Art : -----Original Message----- : From: Tanya Graham [mailto:[EMAIL PROTECTED]] : Sent: Monday, June 04, 2001 2:16 PM : To: 'Troy Sniff'; [EMAIL PROTECTED] : Subject: RE: grep : : : ok, the grep works when i hardcode it. any ideas on how to take the : extensions from the command line? would the user have to type : it in the : correct format, i.e. (\.c|\.cpp|\.h|\.rc) : thanks : tanya : : -----Original Message----- : From: Troy Sniff [mailto:[EMAIL PROTECTED]] : Sent: Monday, June 04, 2001 11:19 AM : To: [EMAIL PROTECTED] : Subject: RE: grep : : : Why not put the . before the (). This way if the list of type of files : is long, you don't have to retype the \. every time. : : my @filtered = grep { /\.(html|asp)$/ } @unfiltered; : : Just a thought. : : Troy : : : : -----Original Message----- : From: [EMAIL PROTECTED] : [mailto:[EMAIL PROTECTED]] On Behalf Of : Arthur Cohen : Sent: Monday, June 04, 2001 11:47 AM : To: Tanya Graham; [EMAIL PROTECTED] : Subject: RE: grep : : : Grep is what you want, e.g. : : : : my @filtered = grep { /(\.html|\.asp)$/ } @unfiltered; : : : : --Art : : : : : -----Original Message----- : : : From: Tanya Graham [mailto:[EMAIL PROTECTED]] : : : Sent: Monday, June 04, 2001 1:38 PM : : : To: [EMAIL PROTECTED] : : : Subject: grep : : : : : : : : : Hi, : : : I need to be able to take my array of files @files, and : : : exclude files that : : : aren't of a certain extensions. more specifically, one of my : : : arguments on : : : the command line is a comma-separated list of file extensions : : : and i need to : : : alter only the files with those extensions...do i use grep : : : for this? is : : : there a better way? : : : thank you : : : tanya graham : : : : : : -----Original Message----- : : : From: Troy Sniff [mailto:[EMAIL PROTECTED]] : : : Sent: Monday, June 04, 2001 10:17 AM : : : To: [EMAIL PROTECTED] : : : Subject: Determining memory leak : : : : : : : : : I have a suspicion I have a memory leak in a script I am working on. : : : : : : How can I go about determining the amount of memory the : : : script is using? : : : : : : Is there a module that will report the amount of memory used while : : : executing parts of the script. Maybe reporting the amount : used as it : : : jumps throughout the script and subs? : : : : : : Troy : : : : : : _______________________________________________ : : : Perl-Win32-Users mailing list : : : [EMAIL PROTECTED] : : : http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users : : : _______________________________________________ : : : Perl-Win32-Users mailing list : : : [EMAIL PROTECTED] : : : http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users : : : : : _______________________________________________ : Perl-Win32-Users mailing list : [EMAIL PROTECTED] : http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users : : : _______________________________________________ : Perl-Win32-Users mailing list : [EMAIL PROTECTED] : http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users : _______________________________________________ : Perl-Win32-Users mailing list : [EMAIL PROTECTED] : http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users : _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users