On Thu, May 3, 2012 at 10:15 PM, James E Keenan via RT < perlbug-followup@perl.org> wrote: > On Wed Jun 27 13:00:57 2007, jsailor wrote: > > > > This is a bug report for perl from jsailor@jesnetplus.com, > > generated with the help of perlbug 1.35 running under perl v5.8.8. > > > > > > ----------------------------------------------------------------- > > [Please enter your report here] > > > > Attempting to declare a variable in a use statement does not make the > > variable > > visible later as it should. > > > > For example, > > > > perl -wMstrict -e 'use DirHandle my $var; print $var' > > # DirHandle chosen simply because it does not define an import > > method > > > > dies, even though the my declaration is not contained in a block or > > eval, which > > means, according to the documentation in perlfunc for my. > > > > > > I don't see any basis for believing that you can declare a variable in a > 'use' statement. 'perldoc -f use' starts out like this: > > use Module VERSION LIST > use Module VERSION > use Module LIST > use Module > use VERSION > > The syntax presented by the original poster satisfies none of these > formats. > Not true, it matches #3. There's no question that it's valid syntax. I think you're missing the point of the ticket. The problem is that a missing semi-colon results in a weird situation. $ perl -e' use strict; use warnings; use DirHandle my $var = 123; print $var; ' Global symbol "$var" requires explicit package name at -e line 7. Execution of -e aborted due to compilation errors. I don't know if anything should be done about that. --- > via perlbug: queue: perl5 status: open > https://rt.perl.org:443/rt3/Ticket/Display.html?id=43400 >Thread Previous | Thread Next