Re: test value



Josef Moellers <josef.moellers@xxxxxxxxxxxxxxxxxxx> wrote:

John Bokma wrote:
Shane <shane@xxxxxxxxxxxxxxxxxxxx> wrote:


I have some nasty code, that I want to check the value of something
held in a scalar, but there is 'no' value held in there

Data::Dumper tells me the $val = []


$val contains a reference to an empty array, like:

my @array = ();
my $val = \@array;

if (@$val == 0) {
print "Empty\n";
}

@$val or print "Empty\n";

--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
.



Relevant Pages

  • Re: test value
    ... Shane wrote: ... held in a scalar, but there is 'no' value held in there ... $val contains a reference to an empty array, ...
    (comp.lang.perl.misc)
  • Re: test value
    ... $val contains a reference to an empty array, ... Scalar found where operator expected at ./attempt3.pl line 254, ... (Missing operator before $hash?) ... syntax error at ./attempt3.pl line 260, ...
    (comp.lang.perl.misc)
  • Re: test value
    ... John Bokma wrote: ... held in a scalar, but there is 'no' value held in there ... $val contains a reference to an empty array, ...
    (comp.lang.perl.misc)
  • Re: test value
    ... Shane wrote: ... held in a scalar, but there is 'no' value held in there ... $val contains a reference to an empty array, ...
    (comp.lang.perl.misc)
  • Re: How much memory do managed code objects take, really?
    ... >> empty array of hundreds of thousands of references, ... So you're saying that all reference types have an 8-byte overhead, ...
    (microsoft.public.dotnet.framework.performance)