in reply to Variable in a string
Good question! Use curly braces: my $pattern = "CAC1Bvariant${variable}_fasta.txt";.
Improve your skills with Modern Perl: the free book.