Urgent help for perl script

I am having the autosys script for the perl as follows

#!/usr/bin/perl
print "Welcome to Autosys Ice Script\n";
print "Please enter the Environment (UAT PRD TRN ST DEV ALL):\n";
$environment = <STDIN>;
chomp($environment);
print "Please enter the Action (ON_ICE OFF_ICE):\n";
$action = <STDIN>;
#$action = "ON_ICE";
chomp($action);

if($environment eq "UAT")
{
$environment_symbol = U;
}
elsif($environment eq "PRD")
{
$environment_symbol = P;
}
elsif($environment eq "TRN")
{
$environment_symbol = T;
}
elsif($environment eq "ST")
{
$environment_symbol = S;
}
elsif($environment eq "DEV")
{
$environment_symbol = D;
}
elsif($environment eq "ALL")
{
$environment_symbol = "";
}
else
{
print "ERROR: Invalid Environment";
die();
}

system("rm autosys_list.txt");
#$command="ps -ef | grep $environment_symbol" ;
$command="autorep -J ALL | grep '^'$environment_symbol | awk '{print \$1}' > autosys_list.txt" ;
system($command);

open(MYINPUTFILE, "<autosys_list.txt");
while(<MYINPUTFILE>)
{
my($line) = $_;
chomp($line);
#print "$line\n";
if($line ne "")
{
if($action eq "ON_ICE")
{
put_job_on_ice($line);
}
elsif($action eq "OFF_ICE")
{
put_job_off_ice($line);
}
else
{
print "ERROR: Invalid Action";
die();
}
}
}

if($action eq "ON_ICE")
{
verify_jobs_on_ice();
}
elsif($action eq "OFF_ICE")
{
verify_jobs_off_ice();
}
else
{
print "ERROR: Invalid Action";
die();
}

sub put_job_on_ice
{
my $job_name = $_[0];
$kill_command="sendevent -E KILLJOB -J ".$job_name;
$ice_command="sendevent -E JOB_ON_ICE -J ".$job_name;
print "kill:".$kill_command."\n";
print "ice:".$ice_command."\n";
system($kill_command);
system($ice_command);
}

sub verify_jobs_on_ice
{
$command="autorep -J ALL | grep '^'$environment_symbol | egrep 'RU|AC'" ;
print "WARNING: The following jobs are still Running: (Make sure nothing is returned after this line)\n";
system($command);
}

sub verify_jobs_off_ice
{
$command="autorep -J ALL | grep '^'$environment_symbol | egrep 'OI'" ;
print "WARNING: The following jobs are still On Ice: (Make sure nothing is returned after this line)\n";
system($command);
}
sub put_job_off_ice
{
my $job_name = $_[0];
$ice_command="sendevent -E JOB_OFF_ICE -J ".$job_name;
print "action:".$ice_command."\n";
system($ice_command);
}

========================================

Note i want to find out that when i run the above script it should show me that the following autosys jobs are ON_ICE or OFF_ICE.

UAP_ADV_AribaReqDelMaint_B
UAP_ADV_BeginDay_B
UAP_ADV_AMDailyMaint_B
UAP_ADV_PMDailyMaint_B
UAP_ADV_LinkedJobs_B

Please help on urgent basis with detailed procedure

Thanks
samir