Perl – teroref
Hello world – compiling
Save your program as hello.pl.
#!/usr/bin/perl
print "Hello teroref world!nn";
Make it executable, chmod a+x hello.pl and
run ./hello.pl.
Troubleshooting
“bad interpreter” – The first line with #! is
wrong. Change the path according to which perl or locate perl. Install perl if needed.
Nothing is printed, not even an error. – If you omit the newline n
the prompt is instantaneously written over program output. Note that backslash is not /.
Comments
# Shell-script like comments..
/* wrong. c-style comments don't work. */ // wrong. c++ style comments don't work.
Comment what a function does. Do not explain how commands work, manuals are
for that.
Variables
Variables are not declared.
$
Functions
sub.perl
See perlsub
Hello XHTML Basic World!
Copyright 2003 Tero Karvinen. All rights reserved.
XHTML Basic 1.0