in reply to regular expressions and substituting in variables.

The way to quickly go through and replace NUM with a constant is:
@s_dn = map { s/NUM/1/; $_ } @s_dn;
But it sounds like you have some rule for wanting to determine what to replace NUM with.
for( @s_dn ) { my $num = 1; # calculate the local num, somehow. s/NUM/$num/g; }