Changeset 27013 in project


Ignore:
Timestamp:
07/07/12 20:28:18 (9 years ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [78.143.161.67]: Simpler perl for printing the keys of a hash.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/language-comparison

    r24723 r27013  
    243243==== Perl
    244244
    245 <enscript highlight=perl>for my $key ( keys %my_hash ) {
    246   print "$key\n";
    247 }</enscript>
     245<enscript highlight=perl>
     246$"="\n"; #Change default list separator from space to newline.
     247print "@{[keys %my_hash]}";
     248</enscript>
    248249
    249250=== Getting the number of items in a hash
Note: See TracChangeset for help on using the changeset viewer.