Please read How do I post a question effectively?. In particular, please wrap code and inputs in <code> tags so avoid mangling of whitespace.[Update: corrected in OP; thank you]
This sounds very much like an XY Problem. What are you trying to accomplish through this obfuscation? It seems unlikely that you will be in an environment where perl runs with different permissions than the individual who is perusing your script. There is value in abstracting common constants that are shared across scripts, but that should probably be done with modules, e.g.
package Gvenkat5;
use strict;
use warnings;
use DBI;
require Exporter;
@EXPORT_OK = 'connect';
sub connect {
my $port = shift || 1000;
my $dbnam = '';
return DBI->connect("DBI:mysql:database=$dbnam;
host=abc01.xyz.com;
port=$port",
'gvenkat',
'ganesh99')
}
and
use Gvenkat5 'connect';
my $dbh = connect($ARGV[0]);
or, for literal values,
YAML or equivalent as suggested.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.