#!/usr/bin/perl
#
# p2.pl
#
use strict;
use warnings;
# disable buffering of STDOUT; see the already mentioned "Suffering from Buffering"
$| = 1;
my $string = "Hello World!";
for ( split //, $string ) {
print $_;
sleep 1;
}
print "\n";
__END__
####
#! /usr/bin/perl
#
# p1.pl
#
use strict;
use warnings;
my $cmd = '/path/to/p2.pl';
die "(E) '$cmd' does not exist!\n" if !-e $cmd;
print "(I) Executing: $cmd\n";
if ( system( $cmd ) == 0 ) {
print "(I) '$cmd' completed successfully.\n";
}
else {
my $err_msg = "(E) failed to execute: $cmd\n";
warn $err_msg;
killBuild( $err_msg );
exit 1;
}
__END__
####
(I) Executing: /tmp/p2.pl
Hello World!
(I) '/tmp/p2.pl' completed successfully.