Need help with checking string equalities - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need help with checking string equalities

ok I am a beginner.. this is my first day of learning perl.. I want to know how to check for strings that are equal.. I tried using == but I guess thats is only for numeric values



here is the part hat i need help with

if ($content == $line)

{

print "duplicate";

}



any help would be greatly appreciated


Comments

  • Ah, now here's one I can answer! For strings you merely need to substitute "eq" for "==", so it would be....

    if ($content eq $line)



    Vimm





    : ok I am a beginner.. this is my first day of learning perl.. I want to know how to check for strings that are equal.. I tried using == but I guess thats is only for numeric values

    :

    : here is the part hat i need help with

    : if ($content == $line)

    : {

    : print "duplicate";

    : }

    :

    : any help would be greatly appreciated

    :






Sign In or Register to comment.