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.