in reply to Re^2: Running Perl scripts from ssh
in thread Running Perl scripts from ssh

#!/usr/bin/perl -w #exec /usr/bin/perl /research-sar/sarexec.pl use strict;

Good! Just as a suggestion on a minor point, try

#!/usr/bin/perl use strict; use warnings;

if($ARGV[0] eq 'start') { # Checking for correct parameters.. if (exists $ARGV[1] && exists $ARGV[2] && exists $ARGV[3]) { #print "present all things\n"; } else { #print "Missing parameters..cant continue..\n"; exit; }
In Perl you don't need all those nested conditionals and there are alternatives that may increase readability. In this case you may want to create a start() and a stop() sub, then I'd do:
my %action=(start => \&start, stop => \&stop); my $todo=shift || ''; die "Wrong parameters\n" unless $action{$todo}; goto $action{$todo}; # a "good" goto; # # ... # sub $start () { die "Missing parameters, can't continue!\n" unless @ARGV==3; my ($file_param,$file_location,$interval)=@ARGV; # ... }

open(FH,"> fileloc") or die"cant open the file";
open my $fh, '>', 'fileloc' or die "Can't open `fileloc': $!\n";

my $pid = fork();

Aha! => fork.