Xiao Lan (??) wrote:
# cat t1.pl
use strict;
use warnings;
my $cfg = "1.txt";
my @x = qw/a b c 1 2 3/;
my $fd;
open $fd,">",$cfg or die $!;
print $fd for @x;
Perl doesn't know that $fd is a filehandle and so it thinks you mean:
print STDOUT $fd for @x;
Just remove the foreach statement modifier:
print $fd @x;
close $fd;
# perl t1.pl
GLOB(0x818ab84)GLOB(0x818ab84)GLOB(0x818ab84)GLOB(0x818ab84)GLOB(0x818ab84)GLOB(0x818ab84)
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/