Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Read from a header file like C

by kennethk (Abbot)
on Aug 05, 2016 at 14:46 UTC ( [id://1169185]=note: print w/replies, xml ) Need Help??


in reply to Read from a header file like C

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1169185]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2024-04-18 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found