in reply to Not sure how to handle this scope
Something like this? (simplified...)
#!/usr/bin/perl use strict; use warnings; my $self = 'cat'; print "outside $self\n"; { my $self = $self; print " inside $self\n"; $self = 'dog' if not defined $ARGV[0]; print " inside $self\n"; } print "outside $self\n";
Outputs:
outside cat inside cat inside dog outside cat
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Not sure how to handle this scope
by Your Mother (Archbishop) on Aug 18, 2021 at 20:42 UTC |
In Section
Seekers of Perl Wisdom