in reply to Setting a Variable from filename

Can you show us the relevant code you have and how it fails to do what you want?

I would imagine that something like the following should work for your code, but that's mostly guesswork from your description and not based on seeing actual code:

my @filenames = qw(foo_CF_foo bar_CF_bar baz_NOCF_baz); my $file = $filenames[0];