http://www.perlmonks.org?node_id=942720


in reply to Variable in a string

You can build your name in stages:
my $file_name = "CAC1Bvariant"; $file_name .= $variable; $file_name .= '_fasta.txt';
I think it's a little easier on the maintenance programmer's eyes, and it high-lights the fact that the varying part of the name is in the middle of the string.

----
I Go Back to Sleep, Now.

OGB

Replies are listed 'Best First'.
Re^2: Variable in a string
by hbm (Hermit) on Dec 09, 2011 at 20:00 UTC

    Sleepy Bear,

    Might this be even easier on the eyes?

    my $file_name = 'CAC1Bvariant' . $variable . '_fasta.txt';
      You guys are awesome. I've used this site for 10 years and have valued it every time I've asked a question (though haven't in 8 years, and forgot my user info!)