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:
printing statements during iteration

 



nibalan
Novice

Jun 6, 2011, 11:45 PM

Post #1 of 5 (670 views)
printing statements during iteration Can't Post

In a perl script I have the code
system("sh /ws/nibalan-bgl/sourcing.sh");

Sourcing.sh contains
Some processing statements
-
-
perl /ws/nibalan-bgl/subsub.pl;

Subsub.pl conatins:
use subrou.pm
require 'manualans.pl';
($reff)=subrou::iosviewinfo(\@options,\%hash);
chop(%$reff);
for($i=0;$i<($num-1);$i++)
{
@val=$$reff{$options[$i]};
$value="value"."_$i";

if(@val eq @$value)
{
print "TESTING $options[$i]";
}
else
{
print "failure";
}


manualans.pl contains:
@value_0="hi";
@value_1="hello";

In subsub.pl two values are compared and result is produced. When I execute the main script all works fine. Since it takes a long time to execute I put print statements inside the if loop so that during start of each comparison it will print the statements.

But it doesnt happen, it completes the comparison and then prints all the TESTING statement at once.

Can you help me out. It is realy urgent for me


miller
User

Jun 7, 2011, 12:26 AM

Post #2 of 5 (667 views)
Re: [nibalan] printing statements during iteration [In reply to] Can't Post

Did you make this code, or did someone else?

- M


BillKSmith
Veteran

Jun 7, 2011, 4:54 AM

Post #3 of 5 (661 views)
Re: [nibalan] printing statements during iteration [In reply to] Can't Post

Refer to AUTOFLUSH in perldoc perlvar.
Good Luck,
Bill


nibalan
Novice

Jun 7, 2011, 6:28 AM

Post #4 of 5 (656 views)
Re: [miller] printing statements during iteration [In reply to] Can't Post

I did the coding. Actually I have posted only snippets of code. There are large chunks. Why do u have such doubt?


(This post was edited by nibalan on Jun 7, 2011, 6:29 AM)


nibalan
Novice

Jun 7, 2011, 6:31 AM

Post #5 of 5 (654 views)
Re: [BillKSmith] printing statements during iteration [In reply to] Can't Post

Thanks Bill. Actually I am new to perl and I am doing an enhancement with perl which is my first script. I am just referring in Google for certain functions that the script should do and then importing it in my script and learning side by side. I will check out AUTOFLUSH.


(This post was edited by nibalan on Jun 7, 2011, 6:33 AM)

 
 


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

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