[Melbourne-pm] scope and gotos
Tim Connors
tconnors+pmmelb at astro.swin.edu.au
Mon Jan 8 17:24:39 PST 2007
I know gotos are bad, mmmkay (actual, Djikstra was going on about
unconditional gotos, not error handling gotos), but is this the desired
behaviour of goto jumping out of the scope of something that has been
declared, falling back into it, and the old value remaining?
###
#!/usr/bin/perl
use strict;
use warnings;
print "init\n";
init:
my @test;
push @test, int(@test);
print "test=@test\n";
goto init;
###
init
test=0
test=0 1
test=0 1 2
...
Sure, I *can* go and reinitialise all these arrays, but I thought a
declaration ought to be good enough.
--
Tim Connors
http://site.aao.gov.au/twc
More information about the Melbourne-pm
mailing list