Strange Output
From: Mallik (mkodiche_at_cisco.com)
Date: 12/24/04
- Next message: Anish Kumar K.: "How to map IP address with country"
- Previous message: Chris Devers: "Re: Recommend"
- Next in thread: Oliver Schnarchendorf: "Re: Strange Output"
- Reply: Oliver Schnarchendorf: "Re: Strange Output"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: <beginners@perl.org> Date: Fri, 24 Dec 2004 12:06:00 +0530
Hi Friends,
I have the below code.
#!/usr/local/perl5.6.1/bin/perl
print STDOUT "===============================Before system
call===========================\n\n";
system("ls -al");
print STDOUT "\n\n===========================After System
Call============================\n\n";
When I execute the code from command prompt, the output is,
===============================Before system
call===========================
total 8
drwxr-xr-x 2 mkodiche cisco 96 Dec 23 21:54 .
drwxr-xr-x 4 mkodiche cisco 1024 Dec 23 19:36 ..
-rw-r--r-- 1 mkodiche cisco 465 Dec 23 22:00 a.txt
-rwxrwxr-x 1 mkodiche cisco 279 Dec 23 22:00 background.pl
-rwxrwxr-x 1 mkodiche cisco 92 Dec 23 21:53 loop.pl
===========================After System Call============================
But, when I redirect the output to a file, the contents of the file are
total 6
drwxr-xr-x 2 mkodiche cisco 96 Dec 23 21:54 .
drwxr-xr-x 4 mkodiche cisco 1024 Dec 23 19:36 ..
-rw-r--r-- 1 mkodiche cisco 0 Dec 23 22:34 a.txt
-rwxrwxr-x 1 mkodiche cisco 279 Dec 23 22:00 background.pl
-rwxrwxr-x 1 mkodiche cisco 92 Dec 23 21:53 loop.pl
===============================Before system
call===========================
===========================After System Call============================
As seen above, the system call output is displayed first and then the
print statement.
Why it is behaving strangely? Any idea?
Thanks is advance,
Mallik.
- Next message: Anish Kumar K.: "How to map IP address with country"
- Previous message: Chris Devers: "Re: Recommend"
- Next in thread: Oliver Schnarchendorf: "Re: Strange Output"
- Reply: Oliver Schnarchendorf: "Re: Strange Output"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|