Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9088129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:51:11+00:00 2026-06-16T21:51:11+00:00

program : testblocks.pl #!/usr/bin/perl use strict; use warnings; print Hi; BEGIN { warn BEGIN;

  • 0

program : testblocks.pl

#!/usr/bin/perl
use strict;
use warnings;

print "Hi";

BEGIN {
        warn "BEGIN";
}
END {
        warn "END";
}
INIT {
        warn "INIT";
}
CHECK {
        warn "CHECK";
}
UNITCHECK {
        warn "UNITCHECK";
}

print "Hello";

Output:

BEGIN at testblocks.pl line 8. 
CHECK at testblocks.pl line 17. 
INIT at testblocks.pl line 14. 
UNITCHECK at testblocks.pl line 20. 
END at testblocks.pl line 11. 
HiHello

Now if I use, \n in print statements like below

print "Hi\n";
...
print "Hello\n";

Output is:

BEGIN at testblocks.pl line 8.
CHECK at testblocks.pl line 17.
INIT at testblocks.pl line 14.
Hi 
UNITCHECK at testblocks.pl line 20.
Hello 
END at testblocks.pl line 11.

I am unable to understand the issue here. Any inputs or suggestions appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:51:12+00:00Added an answer on June 16, 2026 at 9:51 pm

    It looks like a print buffer issue. When you include a newline in your print, buffers get flushed right away. In your first case, without a newline, they get flushed when they are full, or when your program exits.

    As dgw comments, since warn goes to STDERR and print to STDOUT, they are also not in the same buffer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Program.cs class Program { public static void He(string v) { Console.WriteLine(v); Console.WriteLine(End?); } public
Program that calculates and shows the value of (2 to the 10th power) This
program to output all 4 digit numbers where no prior digit is greater than
Program returns an error of, expected PWideChar instead of string procedure TForm1.Button1Click(Sender: TObject); var
Program runs once and it both throws data to the pipe and gets it
This program builds a dictionary out of a list based on what two index
My program is showing it is a leap year for every output. Please let
This program returns: package main import ( flag fmt ) func main() { num_agents
This program runs just fine, but for some reason when I ask for an
I program in Java, C and Python. The rule for automatic coercions among arithmetic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.