programming-examples/perl/Subroutine/Use my to declare local variable.pl

13 lines
228 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
$record = 4;
print "We're at record ", $record, "\n";
{
my $record;
$record = 7;
print "Inside the block: ", $record, "\n";
}
print "Outside, we're still at record ", $record, "\n";