Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Mixing tied variables with goto label

by jeffa (Bishop)
on Nov 15, 2005 at 21:32 UTC ( #508802=note: print w/replies, xml ) Need Help??


in reply to Mixing tied variables with goto label

Try this:

sub FETCH { 'END' }
This is kinda neat. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Mixing tied variables with goto label
by Limbic~Region (Chancellor) on Nov 16, 2005 at 00:07 UTC
    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://508802]
help
Chatterbox?
[Discipulus]: hdb sorry i profit; is known that a prime number is never a figurate one nor the sumattion of two adjacent figurates of the same order? like 3th triangular+3th tetrahedric
[Discipulus]: if known where i can read about the matter?
[choroba]: he's not really sick, we just got nobody to look after him today
[Discipulus]: create an account for him; we are funny baby sitters ;=) come here child, want to listen the typeglob tale?
[vrk]: choroba Oh, that's good.
[vrk]: Discipulus I don't know much about prime numbers, but wouldn't that kind of an answer be in a graduate-level number theory book?
[Discipulus]: my 8 yo daughter has two weeks of sleep disturbs.. we are gonna be crazy..

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-04-27 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (501 votes). Check out past polls.