how to get verified the hash and its elements availability in perl?
Method 1:
%final=(9,5,8,1,4,7);
print "not empty string" if exists($final{"keys"});
Method 2:
%final=(9,5,8,1,4,7);
if(delete $final{9})
{
print "empty deleted";
}
else
{
print "not exits";
}
Method 3:
%final=(9,5,8,1,4,7);
if(%final)
{
print "string";
}
else
{
print "empty";
}
Method 4:
%final=(9,5,8,1,4,7);
if(!%final)
{
print "empty";
}
else
{
print "available";
}
kaavannan perl blogspot
%final=(9,5,8,1,4,7);
print "not empty string" if exists($final{"keys"});
Method 2:
%final=(9,5,8,1,4,7);
if(delete $final{9})
{
print "empty deleted";
}
else
{
print "not exits";
}
Method 3:
%final=(9,5,8,1,4,7);
if(%final)
{
print "string";
}
else
{
print "empty";
}
Method 4:
%final=(9,5,8,1,4,7);
if(!%final)
{
print "empty";
}
else
{
print "available";
}
kaavannan perl blogspot
Labels: How can I verify that a value is present in an array (list) in Perl?, kaavannan perl blogspot
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home