Using my if statement : my « Subroutine « Perl






Using my if statement

   

$testvalue = 10;

if ((my $variable1 = 10) > $testvalue ) {

    print "Value, $variable1, is greater than the test value.\n";

} elsif ($variable1 < $testvalue) {

    print "Value, $variable1, is less than the test value.\n";

} else {

    print "Value, $variable1, is equal to the test value.\n";

}

   
    
    
  








Related examples in the same category

1.Using my
2.Using my to declare the local variable in a subroutine
3.my ($program, $exitCode) = @_; creates two local variables, $program and $exitCode, from @_.
4.my variable
5.my variable is initialized each time
6.my, local and global variable
7.My value scope
8.Define local variable in subroutine by using my
9.The scope of my variables
10.Use my to declare local variable