in reply to Re^2: To test empty array in perl
in thread To test empty array in perl
Using defined on an aggregate's been out of fashion for a good while now.
$ perl -e 'use strict;use warnings;my @foo;if( defined @foo ) { print +"foo" }' |& splain defined(@array) is deprecated at -e line 1 (#1) (D deprecated) defined() is not usually useful on arrays because i +t checks for an undefined scalar value. If you want to see if the array is empty, just use if (@array) { # not empty } for example. (Maybe you should just omit the defined()?)
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: To test empty array in perl
by JavaFan (Canon) on Apr 26, 2010 at 16:23 UTC |