I'm new to this forum.
This is my first post!
I have an issue what I am trying to get a list of filenames and filter out some filenames.
For instance in a subdirectory "temp" I have the following file names:
hello.pl hTllo.pl hVllo.pl hQllo.pl
I want to retrieve a list of file names but not include filenames with the second character of 'T' or 'V'.
In other words I want the file names:
hello.pl hQllo.pl
The code I've written is:
######################################################## #!/usr/bin/perl -w my @{Files}; my ${FileName} = "h[[^TV]]*.pl"; my ${f} = ""; @Files = <temp\${FileName}>; printf ("\n##############[ ${FileName} ]####################\n"); foreach ${f} (@Files) { printf("${f}\n"); } printf ("##################################\n"); ########################################################
The response I get is:
##############[ h[[^TV]]*.pl ]#################### temp\hTello.pl temp\hVello.pl ##################################
The references tell me the '^' character is a NOT and should filter out the T and V characters... but does not.
Any suggestions?
20070320 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
In reply to File name filtering with ^ ? by Rory
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |