HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to PerlOperatorsStringsArrays (@)Hashes (%)Conditions (if)LoopsFunctions (sub)
REFERENCE
📖 Overview
🖥️ Output
print
📦 Variables
✍️ Text & Number
📋 Array & Hash
🔁 Condition & Loop
🧩 Function (sub)
Perl›REFERENCE›Output
🖥️

Output

Printing with print and embedding values into text.

CommandDescription
printPrints to the screen.

print

Try it yourself →

Prints to the screen.

Syntax

print "text\n";

Description

print writes the given text/value. Add \n for a new line (not automatic). Variables like $variable can be embedded directly into text.

Example

my $name = "Alex";
print "Hello $name\n";
print "Total: ", 3 + 4, "\n";

Expected output

Hello Alex
Total: 7

When to use?

Showing the result.

Common mistakes

  • ⚠️ Don't forget to add \n for the newline.
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code