print 1+2+3;       # Prints 6.
print(1+2) + 3;    # Prints 3.
print (1+2)+3;     # Also prints 3!
print +(1+2)+3;    # Prints 6.
print ((1+2)+3);   # Prints 6.
*****
unshift @array,0644;
chmod @array;
*****
chmod 0644, @array;
*****
unless ($peer = accept NS, S) {
    die "Can't accept a connection: $!\n";
}
*****
$pi = atan2(1,1) * 4;
*****
sub tan { sin($_[0]) / cos($_[0])  }
*****
bind S, $sockaddr or die "Can't bind address: $!\n";
*****
open WP, "$file.wp" or die "Can't open $file.wp: $!\n";
binmode WP;
while (read WP, $buf, 1024) {...}
*****
($package, $filename, $line) = caller;
*****
$i = 0;
while (($pack, $file, $line, $subname, $hasargs, $wantarray)
  = caller($i++)) {
    ...
}
*****
chdir "$prefix/lib" or die "Can't cd to $prefix/lib: $!\n";
*****
$ok = chdir($ENV{"HOME"} || $ENV{"LOGDIR"} || (getpwuid($<))[7]);
*****
$ok = chdir() || chdir((getpwuid($<))[7]);
*****
$cnt = chmod 0755, 'file1', 'file2';
*****
chmod 0755, @executables;
*****
@cannot = grep {not chmod 0755, $_} 'file1', 'file2', 'file3';
die "$0: could not chmod @cannot\n" if @cannot;
*****
while (<PASSWD>) {
    chop;   # avoid \n on last field
    @array = split /:/;
    ...
}
*****
@lines = `cat myfile`;
chop @lines;
*****
chop($cwd = `pwd`);
chop($answer = <STDIN>);
*****
$answer = chop($tmp = <STDIN>);  # WRONG
*****
$answer = substr <STDIN>, 0, -1;
*****
chop($answer = <STDIN>);
*****
substr($caravan, -5) = '';
*****
$cnt = chown $uid, $gid, 'file1', 'file2';
*****
chown $uid, $gid, @filenames;
*****
sub chown_by_name {
    local($user, $pattern) = @_;
    chown((getpwnam($user))[2,3], glob($pattern));
}

&chown_by_name("fred", "*.c");
*****
chroot +(getpwnam('ftp'))[7]
    or die "Can't do anonymous ftp: $!\n";
*****
open OUTPUT, '|sort >foo';     # pipe to sort
...                            # print stuff to output
close OUTPUT;                  # wait for sort to finish
die "sort failed" if $?;       # check for sordid sort
open INPUT, 'foo';             # get sort's results
*****
connect S, $destadd
    or die "Can't connect to $hostname: $!\n";
*****
dbmopen %ALIASES, "/etc/aliases", 0666
    or die "Can't open aliases: $!\n";

while (($key,$val) = each %ALIASES) {
    print $key, ' = ', $val, "\n";
}
dbmclose %ALIASES;
*****
print if defined $switch{'D'};
*****
print "$val\n" while defined($val = pop(@ary));
*****
die "Can't readlink $sym: $!"
    unless defined($value = readlink $sym);
*****
die "No XYZ package defined" unless defined %XYZ::;
*****
sub saymaybe {
   if (defined &say) {
       say(@_);
   }
   else {
       warn "Can't say";
   }
}
*****
foreach $key (keys %ARRAY) {
    delete $ARRAY{$key};
}
*****
delete $ref->[$x][$y]{$key};
*****
die "Can't cd to spool: $!\n" unless chdir '/usr/spool/news';

chdir '/usr/spool/news' or die "Can't cd to spool: $!\n" 
*****
die "/etc/games is no good";
die "/etc/games is no good, stopped";
*****
/etc/games is no good at canasta line 123.
/etc/games is no good, stopped at canasta line 123.
*****
die '"', __FILE__, '", line ', __LINE__, ", phooey on you!\n";
*****
do 'stat.pl';
*****
eval `cat stat.pl`;
*****
#!/usr/bin/perl
use Getopt::Std;
use MyHorridModule;
%days = (
    Sun => 1,
    Mon => 2,
    Tue => 3,
    Wed => 4,
    Thu => 5,
    Fri => 6,
    Sat => 7,
);

dump QUICKSTART if $ARGV[0] eq '-d';

QUICKSTART:
Getopts('f:');
...
*****
while (($key,$value) = each %ENV) {
    print "$key=$value\n";
}
*****
while (<>) {
    if (eof()) {
        print "-" x 30, "\n";
    }
    print;
}
*****
while (<>) {
    print "$.\t$_";
    if (eof) {       # Not eof().
        close ARGV;  # reset $.
    }
}
*****
while (<>) {
    print if /pattern/ .. eof;
}
*****
exec 'echo', 'Your arguments are: ', @ARGV;
*****
exec "sort $outfile | uniq"
  or die "Can't do sort/uniq: $!\n";
*****
$shell = '/bin/csh';
exec $shell '-sh', @args;      # pretend it's a login shell
die "Couldn't execute csh: $!\n";
*****
exec {'/bin/csh'} '-sh', @args; # pretend it's a login shell
*****
print "Exists\n" if exists $hash{$key};
print "Defined\n" if defined $hash{$key};
print "True\n" if $hash{$key};
*****
if (exists $ref->[$x][$y]{$key}) { ... }
*****
$ans = <STDIN>;
exit 0 if $ans =~ /^[Xx]/;
*****
use Fcntl;
$retval = fcntl(...) or $retval = -1;
printf "System returned %d\n", $retval;
*****
use Fcntl;
open TTY,"+>/dev/tty" or die "Can't open /dev/tty: $!\n";
fileno TTY == 3 or die "Internal error: fd mixup";
fcntl TTY, &F_SETFL, 0
    or die "Can't clear the close-on-exec flag: $!\n";
*****
format NAME =
    picture line
    value list
    ...
\s+2.\s0
*****
my $str = "widget";               # A lexically scoped variable.

format Nice_Output =
Test: @<<<<<<<< @||||| @>>>>>
      $str,     $%,    '$' . int($num)
\s+2.\s0

$~ = "Nice_Output";               # Select our format.
local $num = $cost * $quantity;   # Dynamically scoped variable.

write;
*****
while (($name, $passwd, $gid) = getgrent) {
    $gid{$name} = $gid;
}
*****
($a, $b, $c, $d) = unpack('C4', $addrs[0]);
*****
$login = getlogin || (getpwuid($<))[0] || "Intruder!!";
*****
use Socket;
$hersockaddr = getpeername SOCK;
($port, $heraddr) = unpack_sockaddr_in($hersockaddr);
$herhostname = gethostbyaddr($heraddr, AF_INET);
$herstraddr = inet_ntoa($heraddr);
*****
$curprio = getpriority(0, 0);
*****
while (($name, $passwd, $uid) = getpwent) {
    $uid{$name} = $uid;
}
*****
use Socket;
$mysockaddr = getsockname(SOCK);
($port, $myaddr) = unpack_sockaddr_in($mysockaddr);
*****
@result = map { glob($_) } "*.c", "*.c,v";

@result = map <${_}>, "*.c", "*.c,v";
*****
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
        gmtime(time);
*****
$london_month = (qw(Jan Feb Mar Apr May Jun
        Jul Aug Sep Oct Nov Dec))[(gmtime)[4]];
*****
goto +("FOO", "BAR", "GLARCH")[$i];
*****
@code_lines = grep !/^#/, @all_lines;
*****
@list = qw(barney fred dino wilma);
@greplist = grep { s/^[bfd]// } @list;
*****
@out = grep { EXPR } @in;
@out = map { EXPR ? $_ : () } @in
*****
$number = hex("ffff12c0");
*****
sprintf "%lx", $number;         # (That's an ell, not a one.)
*****
$pos = -1;
while (($pos = index($string, $lookfor, $pos)) > -1) {
    print "Found at $pos\n";
    $pos++;
}
*****
$average_age = 939/16;      # yields 58.6875 (58 in C)
$average_age = int 939/16;  # yields 58
*****
$retval = ioctl(...) or $retval = -1;
printf "System returned %d\n", $retval;
*****
system "stty -echo";   # Works on most UNIX boxen.
*****
$_ = join ':', $login,$passwd,$uid,$gid,$gcos,$home,$shell;
*****
@keys = keys %ENV;
@values = values %ENV;
while (@keys) {
    print pop(@keys), '=', pop(@values), "\n";
}
*****
foreach $key (sort keys %ENV) {
    print $key, '=', $ENV{$key}, "\n";
}
*****
foreach $key (sort { $hash{$b} <=> $hash{$a} } keys %hash)) {
    printf "%4d %s\n", $hash{$key}, $key;
}
*****
$cnt = kill 1, $child1, $child2;
kill 9, @goners;
kill 'STOP', getppid;  # Can *so* suspend my login shell...
*****
LINE: while (<STDIN>) {
    last LINE if /^$/; # exit when done with header
    # rest of loop here
}
*****
&RANGEVAL(20, 30, '$foo[$i] = $i');

sub RANGEVAL {
    local($min, $max, $thunk) = @_;
    local $result = '';
    local $i;

    # Presumably $thunk makes reference to $i

    for ($i = $min; $i < $max; $i++) {
        $result .= eval $thunk;
    }

    $result;
}
*****
if ($sw eq '-v') {
    # init local array with global array
    local @ARGV = @ARGV;
    unshift @ARGV, 'echo';
    system @ARGV;
}
# @ARGV restored
*****
# temporarily add a couple of entries to the %digits hash
if ($base12) {
    # (NOTE: not claiming this is efficient!)
    local(%digits) = (%digits, T => 10, E => 11);
    parse_num();
}
*****
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
        localtime(time);
*****
$thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]];
*****
perl -e 'print scalar localtime'
*****
@words = map { split ' ' } @lines;
*****
@chars = map chr, @nums;
*****
%hash = map { genkey($_), $_ } @array;
*****
%hash = ();
foreach $_ (@array) {
    $hash{genkey($_)} = $_;
}
*****
require "ipc.ph";
require "msg.ph";
$msg = pack "L a*", $type, $text_of_message;
*****
my ($friends, $romans, $countrymen) = @_;
*****
my $country = @_;  # right or wrong?
*****
sub simple_as {
    my $self = shift;   # scalar assignment
    my ($a,$b,$c) = @_; # list assignment
    ...
}
*****
LINE: while (<STDIN>) {
    next LINE if /^#/;     # discard comments
    ...
}
*****
$val = oct $val if $val =~ /^0/;
*****
$oct_string = sprintf "%lo", $number;
*****
$ARTICLE = "/usr/spool/news/comp/lang/perl/misc/38245";
open ARTICLE or die "Can't find article $ARTICLE: $!\n";
while (<ARTICLE>) {...
*****
open LOG, '>>/usr/spool/news/twitlog'; # (`log' is reserved)
*****
open ARTICLE, "caesar <$articl                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       