Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    Tie::TwoLevelHash 1.2

    Download button

    No screenshots available
    Downloads: 334  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Poor (1.3/5)
    3 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kevin Meltzer | More programs
    Perl Artistic License / FREE
    December 14th, 2007, 05:29 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Tie::TwoLevelHash description

    Tie::TwoLevelHash is a tied interface to multi-dimensional (Two-Level) hash files.

    Tie::TwoLevelHash is a tied interface to multi-dimensional (Two-Level) hash files.

    SYNOPSIS

    # Tie to Hash-o-hashes
    use Tie::TwoLevelHash;
    tie (%hash, 'Tie::TwoLevelHash', $file, 'rw'); # Open in read/write mode

    $hash{PEOPLE} = {YOU => "me"}; # Set value YOU in hash PEOPLE withing hash %hash to "me"

    # Tie to hash within a Hash-o-hashes
    use Tie::TwoLevelHash:
    tie (%hash, 'Tie::TwoLevelHash', "$file, " 'rw'); # Open in read/write mode

    $hash{YOU} = "me"; # Set key YOU in hash (within HoH's) to "me"

    untie %hash;

    tie (%hash, 'Tie::TwoLevelHash', $file); # Defaults to read-only mode

    ...

    untie %hash;

    This is the Tie::TwoLevelHash module. It is a TIEHASH interface which lets you tie to a text file which is a multi-dimensional (two level) hash.
    To use it, tie a hash to a directory:

    tie(%hash, 'Tie::TwoLevelHash', $file, 'rw'); # Open in read/write mode

    If you pass 'rw' as the third parameter, you'll be in read/write mode, and any changes you make to the hash will create or modify the file. If you don't open in read/write mode you'll be in read-only mode, and any changes you make to the hash won't have any effect in the given file. It's actually useless to tie to the file in read mode and make write calls to it, or the hash you are tying to it. If you do, it may croak, depending on what you are trying. If you want to grab values and play with them, do that in your script, and get the values out of the hash name you are tying with, so you can write to a local hash, and not affect, or try to affect the hash you are tying with.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    multi-dimensional hash | tied interface | Perl module | multi-dimensional | hash | Perl

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM