Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm pretty new to perl, so sorry for the stupid question.
I want to do a "mass initialization" of a hash. I will have several keys with the same value :
${a}="toto" ... ${g}="toto" ${h}="titi" ...
and so on.
Is there a way to initialize multiple keys with the same value on one line ? for example smtg like:
${a,b,c,f,t,u}='toto'; ${b,g,k,p}='titi';
I can't find an easy way to do this.
Thank you all. /David
Code tags and other markup added by GrandFather
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash multiple initialization
by ikegami (Patriarch) on Oct 08, 2008 at 11:00 UTC | |
by AnomalousMonk (Archbishop) on Oct 08, 2008 at 20:13 UTC | |
by ikegami (Patriarch) on Oct 09, 2008 at 01:13 UTC | |
|
Re: Hash multiple initialization
by JavaFan (Canon) on Oct 08, 2008 at 10:56 UTC | |
|
Re: Hash multiple initialization
by BrowserUk (Patriarch) on Oct 08, 2008 at 11:06 UTC | |
by cdarke (Prior) on Oct 08, 2008 at 11:13 UTC |