Brutha has asked for the wisdom of the Perl Monks concerning the following question:
testing is a great thing, especially if you find something like the following
my @y; print "Array is empty: ", (0 == scalar @y ? "yes" : "no"), "\n"; print "first element: ", ( $y[0] ? "defined" : "undefined"), "\n"; print "Array is empty: ", (0 == scalar @y ? "yes" : "no"), "\n"; print "Type of first element: ", ref \$y[0], "\n"; print "Array is empty: ", (0 == scalar @y ? "yes" : "no"), "\n";
It took me an hour to find why my array was not empty. Could anybody explain this a bit? Somwhow, I feel like a beginner again.
And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ref defines array element?
by broquaint (Abbot) on Oct 07, 2003 at 12:39 UTC | |
|
Re: ref defines array element?
by Abigail-II (Bishop) on Oct 07, 2003 at 13:00 UTC |