or download this
open my $ct_in, '-|', 'crontab -l' or die "Can't read crontab: $!";
my $crontab_contents = do { undef $/; <$ct_in> };
...
print $ct_out "\n";
print $ct_out "*/5 * * * * /every/five/minutes\n";
close $ct_out or die "Can't close crontab after write: $!";