Re: comments in the middle of a hash variable ?
- From: Thomas Kratz <ThomasKratz@xxxxxxxxxxxxxxxx>
- Date: Fri, 22 Jul 2005 11:24:30 +0200
Joe Smith wrote:
nadsinoz wrote:
I have a hash variable that I would like to modify each time the script is run
That's reasonable.
by commenting out fields that I am not interesed in.
But that is not.
How can I make this work? %fields = ( lastname => $fieldnum++, firstname => $fieldnum++, # middlename => $fieldnum++, userid => $fieldnum++, rscname => $fieldnum++, email => $fieldnum++, roleid => $fieldnum++, )
Remove the '#' and add some code to remove the keys you don't want. That is, change the hash dynamically at runtime instead of constantly editing the source code.
delete $fields{middlename} if $ignore_middle_name;
Wouldn't it be easier not to create the value in the first place?
%fields = (
$do_lastname ? (lastname => $fieldnum++) : (),
$do_firstname ? (firstname => $fieldnum++) : (),
...
)Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
.- References:
- comments in the middle of a hash variable ?
- From: nadsinoz
- Re: comments in the middle of a hash variable ?
- From: Joe Smith
- comments in the middle of a hash variable ?
- Prev by Date: Re: installing Lingua::LinkParser on Win32
- Next by Date: Re: Strange speed-increase by separating "if"s
- Previous by thread: Re: comments in the middle of a hash variable ?
- Next by thread: Math::Pari Help Needed, badly.
- Index(es):
Relevant Pages
|