5 $ENV{PERL5LIB} = "../lib";
10 @prgs = split "\n########\n", <DATA>;
11 print "1..", scalar @prgs, "\n";
13 $tmpfile = "misctmp000";
14 1 while -f ++$tmpfile;
15 END { unlink $tmpfile if $tmpfile; }
22 my($prog,$expected) = split(/\nEXPECT\n/, $_);
23 open TEST, "| sh -c './perl $switch' >$tmpfile 2>&1";
24 print TEST $prog, "\n";
27 $results = `cat $tmpfile`;
29 $expected =~ s/\n+$//;
30 if ( $results ne $expected){
31 print STDERR "PROG: $switch\n$prog\n";
32 print STDERR "EXPECTED:\n$expected\n";
33 print STDERR "GOT:\n$results\n";
36 print "ok ", ++$i, "\n";
40 $cusp = ~0 ^ (~0 >> 1);
42 print +($cusp - 1) % 8, $cusp % 8, -$cusp % 8, ($cusp + 1) % 8, "!\n";
48 Can't call method "go" without a package or object reference at - line 1.
57 $x=0x0eabcd; print $x->ref;
59 Can't call method "ref" without a package or object reference at - line 1.
61 chop ($str .= <STDIN>);
65 $x=2;$y=3;$x<$y ? $x : $y += 23;print $x;
69 eval {sub bar {print "In bar";}}
71 system "./perl -ne 'print if eof' /dev/null"
76 sub new {my ($obj,$n)=@_; bless \$n}
85 Can't coerce HASH to string in repeat at - line 1.
88 printf(STDOUT "%s\n", $_);
100 sub sub {local($_) = @_;
103 Modification of a read-only value attempted at - line 3.
105 package FOO;sub new {bless {FOO => BAR}};
119 print scalar ("foo","bar")
123 sub by_number { $a <=> $b; };# inline function for sort below
125 @ordered_array=sort by_number keys(%as_ary);
130 my($m2) = $#Shells++;
131 $Shells[$m2]{HOST} = $Host;
140 &ShowShell(&NewShell(beach,Work,"+0+0"));
141 &ShowShell(&NewShell(beach,Work,"+0+0"));
142 &ShowShell(&NewShell(beach,Work,"+0+0"));
148 { print "TIEARRAY @_\n";
149 die "bomb out\n" unless $count ++ ;
152 sub FETCH { print "fetch @_\n"; $_[0]->[$_[1]] }
153 sub STORE { print "store @_\n"; $_[0]->[$_[1]] = $_[2] }
154 sub DESTROY { print "DESTROY \n"; undef @{$_[0]}; }
157 eval 'tie @h, FAKEARRAY, fred' ;
158 tie @h, FAKEARRAY, fred ;
160 TIEARRAY FAKEARRAY fred
161 TIEARRAY FAKEARRAY fred
164 BEGIN { die "phooey\n" }
167 BEGIN failed--compilation aborted at - line 1.
171 Illegal division by zero at - line 1.
172 BEGIN failed--compilation aborted at - line 1.
176 Modification of a read-only value attempted at - line 1.
177 BEGIN failed--compilation aborted at - line 1.
183 print join(' ', reverse @_)."\n";
189 "Out of inspiration";
192 print "and destroyed as well\n";
198 print FOO "sentence.", "reversed", "a", "is", "This";
199 print "-- ", <FOO>, " --\n";
202 This is a reversed sentence.
203 -- Out of inspiration --
204 and destroyed as well