CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: How to check for an empty array in perl?: Edit Log



iphone
User

Dec 20, 2010, 11:20 PM


Views: 4029
How to check for an empty array in perl?

Does the following work or is there a better way?

Code
		@array = {1,2,3}; 
#print "ARRAY @array";
if (!@array) {


}
foreach my $base_p4path (@array)#I want this for loop
to get executed only when @array has elements.
{
}



(This post was edited by iphone on Dec 21, 2010, 12:21 AM)


Edit Log:
Post edited by iphone (User) on Dec 20, 2010, 11:20 PM
Post edited by iphone (User) on Dec 21, 2010, 12:21 AM
Post edited by iphone (User) on Dec 21, 2010, 12:21 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives