Scripting

Perl: Declaring Hash Names Dynamically

For advanced Perl programmers, this may come handy anytime when you have to generate a hash with a dynamic naming convention for temporary processing purposes.

C:\>perl
$a = "Test";
%{"$a"} = ( 'TestKey' => 'TestValue' );
print keys %{"$a"};
^D
TestKey
C:\>
Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.