Solution: Hello World part 2 (what is the difference between comment and POD?) - video

perldoc pod2html lynx

First exercise, second part

Write a simple script that prints Hello world

print "hello world\n";
$ perl hello.pl
use strict;
use warnings;

print "hello world\n";

Add comments to your code

use strict;
use warnings;

print "hello world\n";  #comment

# some comment

Add user documentation to your code

use strict;
use warnings;

print "hello world\n";  #comment

# some comment
=pod
=head1 Title
text
=cut
$ perl hello.pl
$ perldoc hello.pl

But that does not look really good and perldoc reported about some error too.

That's because POD requires empty rows around its tags:

use strict;
use warnings;

print "hello world\n";  #comment

# some comment

=pod

=head1 Title

text

=cut
$ perldoc hello.pl

$ pod2html hello.pl > hello.html

$ lynx hello.html

Other pages

Beginner Perl Maven video course - video

Author

Gabor Szabo (szabgab) Gabor Szabo