>>>>> "DF" == David Filmer < XXXX@XXXXX.COM > writes:
DF> The fact that my last posting seems very clear to me but not to you is
DF> troubling. Either I have it right but am expressing it poorly, or I
DF> have it wrong. I believe I'm clearly expressing my understanding of
DF> the subject, so I wonder if my understanding is all wrong. Please
DF> allow me to briefly summarize my understanding, and prehaps you will
DF> be kind enough to point out where I've gone astray.
>>> show some code. your words are not conveying much useful info.
DF> The code is at the top of the post. You didn't like it. You were
DF> right. I don't have any better code to post, because, as I understand
DF> it, what I was trying to do cannot be done (and thus cannot be coded),
DF> and I need to do something else.
symrefs CAN be done but they are *** and evel and not needed for
general purpose data handling as you are doing.
DF> What I was trying to do was use a variable-as-a-variablename, and my
DF> original question was how I could properly scope it, because
DF> my $foo = 'bar';
DF> my @{$foo}; #ie, @bar
DF> doesn't work. I thought it was a syntax problem.
use strict rightly disallows that.
DF> What I believe you've said (and what I've concluded) is that it cannot
DF> be done at all (at least not without unleashing the demons of hell).
DF> It is flat-out impossible to scope a variable (with a 'my' statement)
DF> if the variable is not a hard reference. Is my understanding of this
DF> correct?
well, your wording is not perfect. my variables are not in the symbol
table so you can't get access to them via symrefs (even if they are allowed).
DF> You suggested using a hash INSTEAD of an array, correct? But I can't
DF> do that, because I'm trying to pass this object to a module
DF> (HTML::Template) which expects an array, ie:
i meant use a hash instead of a symref (which is really using the symbol
table as a hash).
DF> $template->param(THIS_LOOP => \@loop_data);
DF> So I need to rewrite a section of my code to use a hard reference
DF> (ie, @bar) instead of a symref (@{$foo} #where $foo eq 'bar'), and
DF> there's no way around that (without unleashing the demons). Is
DF> this correct?
i don't understand the problem. the param wants an array ref. the ref
could come from any array variable or be an anon array with []. this has
nothing to so with symrefs or hashes. you don't seem to understand perl
hard references. read perlreftut and perlref.
uri
--
Uri Guttman ------ XXXX@XXXXX.COM --------
http://www.yqcomputer.com/
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ----------------------------
http://www.yqcomputer.com/