Mega Code Archive

 
Categories / Perl / Subroutine
 

Define subroutine and call it with using global variable

sub printifOK {     if ($value > 10 ) {         print "Value is $value.\n";     } else {         print "Value is too small.\n";     } } $value = 10; printifOK; $value = 12; printifOK;