By default, all variables in Perl are global variables; that is, they are accessible from every part of the program, unless you declare with "my" to create a "lexical" (local) varable.
Answer: Hey!! Kindly finds your solution below. Let me know if any issue.Thanks.
It’s a TRUE statement. In Perl, we use keyword my to create a lexical or local variable that we can use within a block.
my $score = 50; #local variable declaration with my keyword
Without declaration using variable are global variables by default in Perl, they can be used anywhere in program. (my keyword is not used to declare)
$score = 50; #no declaration with my keyword
print “$Score\n”; #accessible outside the block
Get Answers For Free
Most questions answered within 1 hours.