NAME
Hash::Identity - Get a hash that always returns the key
VERSION
Version 0.01
SYNOPSIS
use Hash::Identity qw(e);
print "The result is: $e{ 1 + 2 }\n";
print "sin(1) = $e{ sin(1) }\n";
# Or you wish to import multiple. though I think one is usually sufficient.
use Hash::Identity qw(ident expr);
print "You could use expr like this: $expr{2**3}.\n";
print "Or you could use ident $ident{ 'a' . 'b' } as well.\n";
# NOTE
use Hash::Identity qw(e);
print "If you want to just call a sub without params. Don't use $e{ rand }. Use $e{ rand() } instead.\n";
DESCRIPTION
To get a hash that always returns the key.
A hash that always returns the key is useful when interpolating EXPR in a double quoted string.
This module uses Tie::Hash::Identity to achieve this, and provides a better importing interface.
EXPORT
This module will not export anything by default. You could assign each name you want to use like this:
use Hash::Identity qw(a b c);
Then you will have identity hash %a, %b, and %c.
SEE ALSO
AUTHOR
Cindy Wang (CindyLinz)
BUGS
Please report any bugs or feature requests to bug-hash-identity at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hash-Identity. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
LICENSE AND COPYRIGHT
Copyright 2010 Cindy Wang (CindyLinz).
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.