If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
Post a reply to the thread: Why isn't this compare function working in Perl?
Click here to log in
What is the sum of 36 and 12
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.
Why isn't this compare function working in Perl? I have this code http://ideone.com/QC0Ajw <script type="text/javascript" src="http://ideone.com/api/embed.js/link/QC0Ajw"></script> If the above didn't show up this is the code: print "Enter the word"; $keyword = <>; $zippy = 'the'; if (($zippy cmp $keyword) == 0) { print "yes we can\n"; } The keyword I enter is: the The if statement fails and the program does not print "yes we can" Why isn't this working? Isn't the keyword the same as 'the'? @analprogrammer The if statement still fails, using: if ($zippy eq $keyword) I have also tried using quotes " instead of apostrophes ' Makes no difference
Why isn't this compare function working in Perl?
Forum Rules