www.webdeveloper.com
Results 1 to 3 of 3

Thread: perl hashes

  1. #1
    Join Date
    Feb 2003
    Posts
    1

    Question perl hashes

    I am struggling with hashes in perl. I am trying to declare a hash, but with no keys and values(empty one). Then I want to populate keys and values from a certain file with some structure(simple text file). I have ActiveState's perl 5.8.

    Example:
    %glMap ();


    the file looks like:
    key1|val1
    key2|val2
    ...
    How can I do it?

  2. #2
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Code:
    my %hash;
    
    while (<DATA>) {
        chomp;
        my($key, $val) = split /\|/, $_, 2;
        $hash{$key} = $val;
    }
    
    __DATA__
    key1|val1
    key2|val2
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  3. #3
    celebguy_dv Guest

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles