Nathan Wiger wrote:
>
> "David L. Nicol" wrote:
> >
> > s/x/5/; # this is still going to replace
> > # all the eckses in $_ with fives.
>
> Why? This is an arbitrary decision if you've declared variables to be
> barewords.
Misstating my position, when I take one, is and will continue to be
a way to get a rise out of me. This may be a character flaw on my part.
Introspection is digression.
Regexes, unless set otherwise, interpolate
like double-quotes. Double-quotes explicitly recognizes $ to mean that
a variable starts here. A bareword inside doublequotes is not interpreted,
in Perl or C.
> Anyways, I'm done harping on this issue. I think a single, simple syntax
> is good. You and I will have to agree to disagree on this point.
I don't mind agreeing to disagree, but I won't do it until you can
correctly state my position, which you haven't done yet.
From my point of view it appears that you are confusing me with one of the
people (whose names I would have to look up to list) who want to remove
leading $ and @ from variables. I am not in their camp. I agree with you
that those are not workable proposals.
I do not say variables are barewords, I say that barewords may, in addition
to being function calls, be variables. Which is a behavior we can, in fact,
finess out of later versions of perl five that allow subroutines to return l-values,
although doing so requires an explicit declare($$) method, which would take its
arguments as barewords and set up the accessing method and add it to the symbol table.
sub Declare($$){
my ($type, $name) = @_;
my $atman; # a universal virtual base class
$Declared::VarRef{$name} = \$atman;
$Declared::VarType{$name} = $type;
eval <<ENDEVAL;
sub $name : lvalue { return \$\$Declared::VarRef{$name} };
ENDEVAL
};
And there it is, a bareword that quacks like a variable.
--
David Nicol 816.235.1187 nicold@umkc.edu
perl -e'@w=<>;for(;;){sleep print[rand@w]}' /usr/dict/words
Thread Previous
|
Thread Next