I have a list of a directory and need to process the files depending on the number of underscore characters in the file name. For example, the files
filename_date.txt
and
file_name_date.txt
will be processed differently by the script.
I've tried
$count = ($data =~ tr/_/_/);
but it doesn't seem to work - I continue to get a zero (0) for $count.
Is there a flaw in my logic above? Is there a better way to do this?
Thanks in advance!
Tom