Hi,

I thought that the code snip below should work but I am not getting 
my text into the the file. The file is created but it's empty.

Ideally I want to create the log file outside any sub routines so 
that $log to be available to any sub I have created and hence not 
scoped to any one sub routine.  

Is my understanding not correct here? Should I be doing this in 
another way?

Thanx,
Dp.



#!/bin/perl

package Images;

 use strict;
 use warnings;
 use vars qw($log);

 $| = 1;
 our $log;
 my $logpath = 'mylog.txt';
 open($log,">>$logpath") or die "Can't append to $logpath: $!\n";


sub mysub {

my $var = 'Hello';
print $log "Starting mysub with val\n";

}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to