Help for this page

Select Code to Download


  1. or download this
    my @data = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
    my %h;
    @h{1..12} = @data;
    my $x = \%h;
    
  2. or download this
    # This gets me a hash...
    my %x = map { $_ + 1 => (qw/Jan Feb .../)[$_] } 0 .. 11;
    
    # ...but this does not get me a hashref :-\
    my $x = \%{ map { $_ + 1 => (qw/Jan Feb .../)[$_] } 0 .. 11 };