Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: STDOUT qustion

by linuxer (Curate)
on Jun 14, 2009 at 11:44 UTC ( #771392=note: print w/replies, xml ) Need Help??

in reply to STDOUT qustion

What's that die print "..." statement? die already prints the string, no need for a dedicated print.

Your script dies, when exists although the message says the contrary.

This code worked fine for me:

#!/usr/bin/perl # # # use strict; use warnings; # disable buffering of STDOUT; see the already mentioned "Suffering fr +om Buffering" $| = 1; my $string = "Hello World!"; for ( split //, $string ) { print $_; sleep 1; } print "\n"; __END__
#! /usr/bin/perl # # # use strict; use warnings; my $cmd = '/path/to/'; 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__

My result:

(I) Executing: /tmp/ Hello World! (I) '/tmp/' completed successfully.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://771392]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-06-22 05:55 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (121 votes). Check out past polls.