#!/usr/bin/perl
$what = "brontosaurus steak";
$n = 3;
print "fred ate $n $whats.\n"; # not the steaks, but the value of $what
print "fred ate $n ${what}s.\n; # now uses $what
print "fred ate $n $what " . "s.\n"; # another way to do it
print 'fred ate ' . $n . ' ' . $what . "s.\n"; # an especially difficult way
Bareword found where operator expected at ./brontosaurus_steak line 7, near "print "fred"
(Might be a runaway multi-line "" string starting on line 6)
(Do you need to predeclare print?)
Scalar found where operator expected at ./brontosaurus_steak line 7, near "$n $what"
(Missing operator before $what?)
String found where operator expected at ./brontosaurus_steak line 7, near "$what " . ""
(Missing operator before " . "?)
String found where operator expected at ./brontosaurus_steak line 8, near "print 'fred ate ' . $n . ' '"
(Do you need to predeclare print?)
syntax error at ./brontosaurus_steak line 7, near "print "fred ate "
Execution of ./brontosaurus_steak aborted due to compilation errors.