Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Not sure how to handle this scope

by tybalt89 (Monsignor)
on Aug 18, 2021 at 19:12 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-18 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found