you should do print {$hdl} "a line\n";
instead of print $hdl "a line\n"; On Thu, Mar 22, 2012 at 1:06 PM, Chris Stinemetz <chrisstinem...@gmail.com> wrote: > On Thu, Mar 22, 2012 at 2:47 PM, Manfred Lotz <manfred.l...@arcor.de> 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. >> > > It looks like you are tyring to open two different filehandles. You > need to delcare HDL. > open my $HDL, '>', "fileio2.txt"; > > should fix it. > > HTH, > > Chris > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/