Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Mixing tied variables with goto label

by Limbic~Region (Chancellor)
on Nov 16, 2005 at 00:07 UTC ( #508849=note: print w/ replies, xml ) Need Help??


in reply to Re: Mixing tied variables with goto label
in thread Mixing tied variables with goto label

jeffa,
Try this:

Yeah, but there is nothing special about that behavior. goto $var treats $var as the label as I showed in my first example. What I am trying to do is a little misdirection. Imagine that I could make you forget that I had a tied variable and that storing a value didn't appear to do anything abnormal:

my $label = 'START'; goto $label; START: print "Hello, world\n"; END: print "Goodbye, cruel world\n";

When you run the code, instead of going to START it actually goes to END. The trouble is that the label goes away inside the tied FETCH sub with no explanation I can find.

Cheers - L~R

Added a code example to make it clearer what is being attempted.


Comment on Re^2: Mixing tied variables with goto label
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-07-12 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls