As an exercise here I want to play with this for a few minutes,
and have a few basic questions

#!/usr/bin/perl

# First question  do I use 
# ( .... )  OR { ... }
@lines = qq{dave john mike drew};
# First error, should be qw( ... )
# qq is garbage, right?


# is the  ','  correct in my($a,$b) can you use a space my($a $b @c)

my (%sortKeys,$i);


foreach ( @lines ) {
    print"$_$i\n";
    
    my $sortKey = $i++; # do something to create the sort key,
                      # using %idToName to map the ID to the name
    $sortKeys{$_} = $sortKey;
 
   }

# Then create a sub to pass to sort:

print "@lines $i\n";

# Could you elaborate on this
# $a $b are not passed any values -- don't understand 

sub bySortKey {
    $sortKey{$a} cmp $sortKey{$b}
}

 print &bySortKey; 

exit(0);  # If script executes successfully do you  exit(1)  OR  exit(0);

Thanks 
Dave G.

Reply via email to