Results 1 to 2 of 2

Thread: Perl hash

  1. #1
    Join Date
    Jul 2006
    Posts
    142
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Perl hash

    Stupid question but I want to add multiple elements into a hast not just a pair:

    So,

    Code:
    chomp($fill{1} = ("Host_1","hostname_1"));
    if I do this and then try to print with
    Code:
    foreach $key (sort keys %fill) {
    
        print "\n".$key."\t".$fill{$key}.$fill{$value}."\n\n";
    
        }
    I get :

    Code:
    1  hostname1
    I am trying to associate two elements into one key. What am I doing wrong?

    I want :


    Code:
    1  Host_1     hostname1


    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    You will probably have better luck with PERL questions in another forum somewhere... I still have a PERL question which never got answered in these forums. I think there aren't many people here who know PERL. I gave up and used PHP instead.
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

Bookmarks

Posting Permissions

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