i am trying to call another script from within a script, which opens up an outlook email if a file is empty,This all works fine. i have tested it in other scripts.
unless ( -z "$Temp" ) { print "File has something in it\n"; exec "c://testscripts//email.pl" or die "problem with email.pl"; }
But it will not work in this script, i get no warnings.
#!/usr/local/bin/perl use warnings; use strict; use POSIX 'mktime'; use POSIX 'strftime'; my @now = localtime(); my $todaysday = strftime("%d" , localtime()); my $thismonth = strftime("%b" , localtime()); my $year = strftime("%Y" , localtime()); my $SERVICEDESK="servicedesk"; my $CLIENTFILE = strftime("%Y_backup_report.csv" , localtime()); my $Temp = strftime("C:\\temp\\Unknown_servers%d%b.txt" , localtime()) +; my $already_there = 0; open my $mon, '<', "c:\\DBR_$year\\$thismonth\\Monthly_backup_report\\ +$thismonth$CLIENTFILE" or die "read file $!\n"; while ( defined ( my $line = <$mon> ) ) { my ( $date ) = split ',', $line; if ( $date eq "$todaysday $thismonth $year" ) { print "\ file has already been updated today"; $already_there++; last; } } close $mon; if ( ! $already_there ) { open my $day, "c:\\DBR_$year\\$thismonth\\Failures_output\\$todays +day$thismonth$SERVICEDESK.csv" or die " 22read file $!\n"; open $mon, '>>', "c:\\DBR_$year\\$thismonth\\Monthly_backup_report +\\$thismonth$CLIENTFILE" or die "33 write to file $!\n"; <$day>; # get past header while ( <$day> ) { print { $mon } $_; print " $thismonth$CLIENTFILE\n"; print " Has also been updated with today's failures \ +n"; print " Please update the Resolutions when they are received + \n\n"; print " ********************************************************** +***\n"; } close $day or die "Could not complete writing to monthly file: $!\ +n"; close $mon or die "Could not complete writing to monthly file: $!\ +n"; } exit $already_there; ### call email perl #################### unless ( -z "$Temp" ) { print "File has something in it\n"; exec "c://testscripts//email.pl" or die "problem with email.pl"; } #########################################

In reply to when i try to execute another scripts if fails by john.tm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.