>>>>> "JR" == Jerry Rocteur <p...@rocteur.cc> writes:
JR> my %sib_master_hoa = ( JR> XXXX => [ 'XXXX <type>' ] , JR> XXXX_ERSALL => [ 'XXXX <type>', 'ERS CRCODOSS <type>', 'ERS ENVDOSS <type>', 'ERS ENVVAL <type>' ], JR> XXXX_ERSOTHERS => [ 'XXXX <type>', 'ERS CRCODOSS <type>', 'ERS ENVVAL <type>' ], JR> ); this is a good place to show how to better format nested structures like that. EVERYONE here should note this: :) my %sib_master_hoa = ( XXXX => [ 'XXXX <type>' ], XXXX_ERSALL => [ 'XXXX <type>', 'ERS CRCODOSS <type>', 'ERS ENVDOSS <type>', 'ERS ENVVAL <type>', ], XXXX_ERSOTHERS => [ 'XXXX <type>', 'ERS CRCODOSS <type>', 'ERS ENVVAL <type>', ], ); nested data should be indented and arrays listed in columns (unless they are very short). note that each element ends in a comma as perl allows it. it makes for easier cut/pasting of data lines so you don't have to worry about which data ends in commas or not. JR> sub AddGroup { JR> my ($sib_user, $sib_profile, $sib_sibprofx) = @_; JR> # JR> for my $profile ( @{ $sib_master_hoa{$sib_profile} } ) { $profile is aliased to each element of the list, not a copy. JR> $profile =~ s/<type>/$sib_sibprofx/g; so that line modifies the elements of the list in the original hash. JR> print "-A $sib_user -g $profile\n"; JR> } the solution is to either copy the list or the element. my @profiles = @{ $sib_master_hoa{$sib_profile} } ; for my $profile ( @profiles ) { or (my $new_prof = $profile ) =~ s/<type>/$sib_sibprofx/g; and print $new_prof. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/