Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    %couples = (
    ...
        Peter=>"Lois"
    );
    print "$_ is married to $couples{$_}\n" for (sort keys %couples);
    
  2. or download this
    foreach $key (sort keys %couples) {print "$key is married to $couples{
    +$key}\n"};
    
  3. or download this
    foreach (sort keys %couples) {print "$_ is married to $couples{$_}\n"}
    +;
    
  4. or download this
    for (sort keys %couples) {print "$_ is married to $couples{$_}\n"};
    
  5. or download this
    print "$_ is married to $couples{$_}\n" for (sort keys %couples);