next up previous
Next: 4. What can Perl Up: 3. Why you should Previous: 1. Perl saves you

2. Perl is fun to use

Perl is a very creative language. Originally devised by a linguist, it lets you say things in many different ways. Most of these are shortcuts which make your life, as a programmer, easier.

print "TGIF!\n" if $friday;
print "Bummer.\n" unless $friday;

Most of Perl's functions and operators have default arguments, to save your typing in the most common situations.

while (<>) {		# default for <> all lines of all files mentioned 
			# on the command line, or STDIN 
	s/foo/bar/;	# default for substitutions is the special variable
			# $_, in this case the current line
	print;		# default for print() is also $_

Kirrily Robert