tadman has asked for the wisdom of the Perl Monks concerning the following question:
I'm kind of stumped. I spent a bit of time bouncing around between brackets with % to see if it was something capital-D Dumb, but no such luck.#!/usr/bin/perl -w use strict; my $foo = "foo"; my $bar = "bar"; my %hfoo1 = ( "$foo$bar" => "foobar", # Works $bar.$foo => "barfoo", # Works ); my $hfoo2 = { "$foo$bar" => "foobar", # Works $bar.$foo => "barfoo", # Works }; my %hfoo3 = ( map { $foo.$bar => "foobar" } 1, # Works ); my %hfoo4 = ( map { "$foo$bar" => "barfoo" } 1, # Syntax error? # ^^^ );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Magical Arrow Not So Magical?
by ChemBoy (Priest) on May 30, 2002 at 03:48 UTC | |
|
Re: Magical Arrow Not So Magical?
by Anonymous Monk on May 30, 2002 at 04:12 UTC |