in reply to Re: Detecting constant arguments passed to subroutines
in thread Detecting constant arguments passed to subroutines
but it too doesn't catch undef being passed it. For what I'm doing now, I don't think I'll encounter this condition. I think that japhy's is_const is 'better' than the flags code that I came across - at least it's easier to read.sub is_const {use B;B::SVf_READONLY & B::svref_2object(\$_[0])->FLAGS} my $m="va"; our $n=3; my $u=undef; our $u2=undef; for $x ($m, $n, $u, $u2, 4, "a", undef) { print "$x ";$x="VAR" unless is_const($x); print $x,"\n\n" }
What do you think?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Detecting constant arguments passed to subroutines
by dcd (Scribe) on May 29, 2001 at 10:30 UTC | |
by Anonymous Monk on Sep 14, 2005 at 00:24 UTC |