apl logo

A.P. Lawrence

Information and Resources for Unix and Linux Systems
Bloggers and the self-employed
RSS FeedsGet APLawrence.com by RSS




Perl Skills Test

© 2005 A.P. Lawrence

Next
Previous
Return to Start Page

Medium

How many "foo "'s will be printed by this code?

#!/usr/bin/perl
my $a;

print "foo " if (defined($a) == defined($b)) ;
my $b="";
print "foo " if (defined($a) == defined($b)) ;
print "foo " if ($a == $b) ;
print "foo " if ($a eq $b) ;

Answer


Related Articles

Have you tried Searching this site?

Please read this disclaimer

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

/Tests/Perl/q0032.html copyright Tony Lawrence All Rights Reserved

Views for this page
Today  This Week  This Month  This Year   Overall
131116714
Paid Advertisers

Cingular cell phones  -  Advanced Cisco Networking and Security by Vinci Consulting  
Data Recovery Software  -  Internet Advertising  -