On Thu, 22 Mar 2012 16:11:37 -0400
Michael Putch <mpu...@earthlink.net> wrote:

> On 3/22/2012 3:47 PM, Manfred Lotz wrote:
> > Hi all,
> > If I run the following small test snippet
> >
> > <--------------------------------------snip------------>
> > #! /usr/bin/perl
> >
> > use strict;
> > use warnings;
> >
> > use autodie;
> >
> >
> >
> > open my $hdl, ">", "fileio1.txt";
> > print $hdl "a line\n";
> > close $hdl;
> >
> > open HDL, ">", "fileio2.txt";
> > print HDL "a line\n";
> > close HDL;
> > <--------------------------------------snap------------>
> >
> >
> > I get the message:
> > Name "main::HDL" used only once: possible typo at ./fileio1.pl line
> > 16.
> >
> > Why? The same as with $hdl above I use HDL three times.
> >
> >
> >
>     You can't use "typeglob" style filehandles with autodie -- it
> only works with lexical filehandles (one reason that the latter are
> now preferred).   See the Bugs section of "perldoc autodie".
> 

Aaah, that is interesting. Didn't know that autodie was the cause of
the warning message.

I just wanted to know. I understand that the first version in my
example is the one I should prefer.

-- 
Thanks,
Manfred





-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to