Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Not sure how to handle this scope

by tybalt89 (Prior)
on Aug 18, 2021 at 19:12 UTC ( #11135939=note: print w/replies, xml ) Need Help??


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

    Itís silly and off topic but I am compelled to quote it for the tangent.

    Outside of a dog, a book is a manís best friend. Inside of a dog, itís too dark to read.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-05-24 20:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?