oryann9 am Montag, 18. Dezember 2006 16:55: > Hello... > I have thought about this one and tried various code changes but cannot > get what I want. > > My problem: mismatched UIDs in password files. > My solution: > > #1 store passwd files in a globbed array > #2 create array reference from globbed array > #3 open array ref, create hash with more than one value per key. Keys are > regexps from filenames #4 read in every line of passwd files from > reference. Values in hash need to be passwd entries For example: key => > servernames.platform (dubhpr01.hpux) > values => filelds from passwd file (name,uid,gid,comments) > #5 Once hash is built, traverse through searching for usernames that have > unlike UIDs from all files, then print these to an xls using > SpreadSheet::WriteExcel. > > In my code I have completed 1,2 and 3. Started 4 but I am printing the > array reference address as opposed to printing the actual values. What am I > doing wrong and any tips would be nice? > > _OUTPUT_ > > KEY dubhst14.hpux > ELEMENTS /home/dbsmith/passwd.dubhst14.hpux > DUB VALUES root > > KEY dubhdv05.hpux > ELEMENTS /home/dbsmith/passwd.dubhdv05.hpux > DUB VALUES root > > > dubhst14.hpux => ARRAY(0x4002b0f8) > dubhdv05.hpux => ARRAY(0x4059c9a4) > dubhadm3.hpux => ARRAY(0x4059c8f0) [snipped] > #!/usr/bin/perl > > ##-- Initialize environment --## > use strict; > use warnings; > use diagnostics; > use Spreadsheet::WriteExcel; [snipped] > print "$dub_key => $dub_values\n"; [snipped]
Derek, I guess the reason why you got no answer when you posted the identical question in a recent thread is because, at least - your question(s) is/are unclear - your code is not trimmed - even not from comments Anyway. When you print $dub_values and it shows up as an array ref as ARRAY(0x4002c164) and you want the values of this arrayref, you have to dereference it in some way. Start with printing out @$dub_values. Or assign it before if you want bigger freedom to format the values: my @[EMAIL PROTECTED]; # handle @dub_values_arr Hope this helps Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>