|
Posted by nolo contendere on March 20, 2008, 10:10 pm
Please log in for more thread options >
>
>
> > I have two simple scripts
>
> > ------- script1.pl--------
> > #!/usr/bin/perl
> > use strict;
> > open O,">> x.txt";
> > print O "111\n";
> > sleep 10;
> > print O "111\n";
> > close O;
> > ------- script1.pl--------
>
> > ------- script2.pl--------
> > #!/usr/bin/perl
> > use strict;
> > open O,">> x.txt";
> > print O "222\n";
> > sleep 10;
> > print O "222\n";
> > close O;
> > ------- script2.pl--------
>
> > I run script1.pl in time T and script2.pl in time T + 2 seconds. I expec=
t
> > result
>
> > 111
> > 222
> > 111
> > 222
>
> > but I get
>
> > 111
> > 111
> > 222
> > 222
>
> > Why? Can anybody explain me it? I run my scripts on WindowsXP and Active=
Perl
> > 5.6.1.
> > Will be result the same on Linux platform?
> > --
> > Petr Vileta, Czech republic
> > (My server rejects all messages from Yahoo and Hotmail. Send me your mai=
l from
> > another non-spammer site please.)
>
> > Please reply to <petr AT practisoft DOT cz>
>
> try turning on autoflush. after use strict;, enter the line '|++;' in
> each program.
sorry, i meant '$|++;'
|