I am new to working with perl on teamsite. I am trying to test my perl code through command line on the teamsite server but am not able to get my code to work using the Tie::File module. My code is supposed to parse the test.txt file and print the content to the log file but the log file just shows a blank entry when i try to print
@data in the log file. I am able to get it to work in my windows environment (not teamsite) . I checked to see if this perl module exists on the teamsite server using
perl -Tie::File -e 1
and it looks like this module already exists since I did not get any error message.
I am trying to run this code using the following command-
/apps/intrwvn/iw-home/iw-perl/bin/iwperl test.ipl
#!/apps/intrwvn/iw-home/iw-perl/bin/iwperl
use TeamSite::Config;
use Tie::File;
my $file = 'test.txt' ;
my $logfile = 'log.txt' ;
sub log {
$logentry = shift
@_;
$status = shift
@_;
$time = localtime;
open(LOG, ">>log.txt") || die "$log can't be appended to: $!\n";
print LOG "$time: $logentry\n";
close LOG;
if ($status eq "exit") {
exit;
}
}
tie my
@data, 'Tie::File', $file ;
&log(
@data);
untie
@data ;
Any pointers/tips appreciated.