Use strict;
Use warnings;
# Compare the value and string size
My $ str1 = "1-the first Str ";
My $ str2 = "1-the second Str ";
If ($ str1 = $ str2)
{
Print "numerically equal \ n ";
}
If ($ str1 EQ $ str2)
{
Print "stringwise equal \ n ";
}
Print "A. B". "Haha"
Examples of useful tests:
Use Strict;
Use Warnings;
My $ X = 1 ;
If ( $ X )
{
Print " X: Yes \ n " ;
}
My $ Y = 0 ;
If ( $ Y )
{
Print " Y: Yes \ n " ;
}
My $ Z = 0.0 ;
If ( $ Z )
{
Print " Z: Yes \ n " ;
}
My $ = " 0 " ;
If ( $ )
{
Print " A: Yes \ n " ;
}
My $ B = ' 00 ' ;
If ( $ B )
{
Print " B: \ Yes \ n " ;
}
My $ C = " 0.0 " ;
If ( $ C )
{
Print " C: Yes \ n " ;
}
My $ D = "" ;
If ( $ D )
{
Print " D: Yes \ n " ;
}
My $ E = " " ;
If ( $ E )
{
Print " E: Yes \ n "
}
My $ G = " 0 " ;
If ( $ G = $ C )
{
Print " Numerically equal " ;
}
If ( $ G EQ $ C )
{
Print " String-wise equal " ;
}