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
<[email protected]> wrote:
> On Thu, Mar 22, 2012 at 2:47 PM, Manfred Lotz <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/