CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
print command gives no output

 



urello
New User

Jan 13, 2015, 8:59 AM

Post #1 of 2 (2350 views)
print command gives no output Can't Post

Hi!
Could anyone advise why print gives no output.
This gives no output:

Code
#!/usr/bin/perl 
use warnings;
use strict;
print "TEST";

Running this from shell also gives no output

Code
perl -e "print  'TEST'"

But this works as usual

Code
perl -e 'system("echo TEST")'

perl: v5.10.1
shell: bash 4.1.5
OS: Debian 6.0.9


Laurent_R
Veteran / Moderator

Jan 13, 2015, 10:05 AM

Post #2 of 2 (2343 views)
Re: [urello] print command gives no output [In reply to] Can't Post

Hi,

it should work, but the output maybe buffered. Try to add a new ligne character to your print command, like this


Code
#!/usr/bin/perl  
use warnings;
use strict;
print "TEST\n";


Similarly, try to change your one-liner to:


Code
perl -e 'print  "TEST \n;" '


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives