Well, I am sure wiser Monks will tell you much better ways of doing this, but if you can name it, say, Backup_Data.pm, and make it look like the following:
package Backup_Data;
our %hash_of_att_db
= (
'0x40e00600' => {
'attack_type' => 'backdoor',
'attack_port' => '',
'attack_sig' => 'lib/attackprolib/fice-2000.dmp',
'attack_sig_v6' => 'lib/attackprolib/fice-2000.dmp',
},
'0x40e00500' => {
'attack_type' => 'backdoor',
'attack_port' => '',
'attack_sig' => 'lib/attackprolib/mpnewdump',
'attack_sig_v6' => 'lib/attackprolib/6_bionet.dump',
},
);
1;
(note the first line and the last) then, you could
use the file as follows:
use strict;
use warnings;
use lib '/home/phemal'; # wherever Backup_Data.pm is
use Backup_Data;
use Data::Dumper;
print Dumper( \%Backup_Data::hash_of_att_db );
That is to say,
our %foo; declared in Backup_Data.pm should now be available to you as
%Backup_Data::foo inside your program, which now
uses
strict. Hope this helps.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.