doubledecker has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I'm trying to figure out what exactly is the problem with my code. am trying to open a file, print and close it using the module FileHandle. But I'm encountering the following error
Can't call method "close" on an undefined value at ...... line ......
Here is the code snippet
use strict; use FileHandle; my $LOG = "/tmp/log.txt"; my $fh = FileHandle->new(">> $LOG"); print $fh "this is a test"; $fh->close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: error using FileHandle Module
by cjb (Friar) on Dec 16, 2010 at 09:29 UTC | |
by apl (Monsignor) on Dec 16, 2010 at 11:17 UTC | |
by doubledecker (Scribe) on Dec 17, 2010 at 12:31 UTC | |
|
Re: error using FileHandle Module
by Anonymous Monk on Dec 16, 2010 at 07:24 UTC | |
by atanug (Initiate) on Dec 16, 2010 at 11:15 UTC | |
|
Re: error using FileHandle Module
by Khen1950fx (Canon) on Dec 16, 2010 at 09:28 UTC |