5 print "1..0 # skip - Bytecode/ByteLoader doesn't work on VMS\n";
11 if ($Config{ccflags} =~ /-DPERL_COPY_ON_WRITE/) {
12 print "1..0 # skip - no COW for now\n";
15 require './test.pl'; # for run_perl()
19 my $test = 'bytecode.pl';
20 END { 1 while unlink $test, "${test}c" }
23 my @tests = split /\n###+\n/, <DATA>;
25 print "1..".($#tests+1)."\n";
31 my ($script, $expect) = split />>>+\n/;
33 open T, ">$test"; print T $script; close T;
34 $got = run_perl(switches => [ "-MO=Bytecode,-H,-o${test}c" ],
35 verbose => 0, # for debugging
36 stderr => 1, # to capture the "bytecode.pl syntax ok"
39 1 while unlink($test); # nuke the .pl
40 $got = run_perl(progfile => "${test}c"); # run the .plc
42 if ($got =~ /^$expect$/) {
75 ############################################################
76 for (1,2,3) { print if /\d/ }
79 ############################################################
80 $_ = "xyxyx"; %j=(1,2); s/x/$j{print('z')}/ge; print $_
83 ############################################################
84 $_ = "xyxyx"; %j=(1,2); s/x/$j{print('z')}/g; print $_
87 ############################################################
88 split /a/,"bananarama"; print @_
91 ############################################################
92 { package P; sub x { print 'ya' } x }
95 ############################################################
96 @z = split /:/,"b:r:n:f:g"; print @z
99 ############################################################
100 sub AUTOLOAD { print 1 } &{"a"}()
103 ############################################################
104 my $l = 3; $x = sub { print $l }; &$x
107 ############################################################
109 my $foo = sub {$i = shift if @_};
111 ############################################################
112 $x="Cannot use"; print index $x, "Can"
115 ############################################################
116 my $i=6; eval "print \$i\n"
119 ############################################################
120 BEGIN { %h=(1=>2,3=>4) } print $h{3}
123 ############################################################
125 ############################################################
133 ############################################################
134 BEGIN { tie @a, __PACKAGE__; sub TIEARRAY { bless{} } sub FETCH { 1 } }
138 ############################################################
139 my $i=3; print 1 .. $i
142 ############################################################
143 my $h = { a=>3, b=>1 }; print sort {$h->{$a} <=> $h->{$b}} keys %$h
146 ############################################################
147 print sort { my $p; $b <=> $a } 1,4,3