problem in assigning hash variable.

Posted on 2006-03-21
Last Modified: 2010-03-05
I have one defs.h file which is made at run time.
Another file use this defs.h file and I want to assign a hash variable from defs.h
file to a local hash variable.
I cannot require this defs.h file as it is made at run time.
I am unable to assign that variable.

code is goes like this:
#File defs.h

our %global_hash = ('car'=> 'lanser','bike'=> 'ducati');

#!/usr/bin/perl -w
my $file = "defs.h";
  if($_ =~ /\%global_hash/)
     chop($_); # chop newline
     chop($_); # chop ;
     my $pos = index($_,"=");
     my %local_hash =
     my @ky = keys %scp_hash;
     my @vl = values %scp_hash;
     print "keys=@ky";
     print "car=".$scp_hash{'car'};
  }# if
} #while
I m not getting the values in %local_hash.
can u help me in this case.I can't require defs.h file.
Question by:rahul_milo
    1 Comment
    LVL 84

    Accepted Solution

    do "defs.h";

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
    I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now