Nested formats
Are nested formats a good idea? Probably not. But the only rea-
son they don’t work is that the parser becomes confused and loses
track of where it is.
And it would be nice to have some consistency. I can put sub defini-
tions inside a format:
format =
@
;sub foo {
bar
}
.
and:
format =
@
{
sub foo {
bar
}
}
.
so why not these?
format foo =
@
;format bar =
@
.
.
format foo =
@
{
format bar =
@
.
}
.
In perl 5.17.2 and earlier, you can nest formats, but, due to the
parser being confused, the outer format must be terminated with }
instead of a dot. That stopped working with commit
7c70caa5333.
format =
@<<<<<<<<<<<<<<<
"Just another"; format STDERR =
@<<<<<<<<<<<<<<<
"Perl hacker"
.
}
write; select STDERR;
write;