This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
$#array should be accepted as a lvalue sub return value.
[perl5.git] / t / op / flip.t
CommitLineData
8d063cd8
LW
1#!./perl
2
88587957
NC
3chdir 't' if -d 't';
4
4e3399f9 5print "1..15\n";
8d063cd8
LW
6
7@a = (1,2,3,4,5,6,7,8,9,10,11,12);
8
c6aa4a32 9while ($_ = shift(@a)) {
8d063cd8
LW
10 if ($x = /4/../8/) { $z = $x; print "ok ", $x + 0, "\n"; }
11 $y .= /1/../2/;
12}
13
14if ($z eq '5E0') {print "ok 6\n";} else {print "not ok 6\n";}
15
16if ($y eq '12E0123E0') {print "ok 7\n";} else {print "not ok 7\n";}
17
18@a = ('a','b','c','d','e','f','g');
19
4e3399f9
YST
20{
21local $.;
22
2eb25c99 23open(of,'harness') or die "Can't open harness: $!";
8d063cd8 24while (<of>) {
a0d0e21e 25 (3 .. 5) && ($foo .= $_);
8d063cd8
LW
26}
27$x = ($foo =~ y/\n/\n/);
28
29if ($x eq 3) {print "ok 8\n";} else {print "not ok 8 $x:$foo:\n";}
3e3baf6d
TB
30
31$x = 3.14;
32if (($x...$x) eq "1") {print "ok 9\n";} else {print "not ok 9\n";}
790090df
HS
33
34{
35 # coredump reported in bug 20001018.008
36 readline(UNKNOWN);
37 $. = 1;
4e3399f9
YST
38 $x = 1..10;
39 print "ok 10\n";
40}
41
790090df 42}
4e3399f9
YST
43
44if (!defined $.) { print "ok 11\n" } else { print "not ok 11 # $.\n" }
45
46use warnings;
47my $warn='';
48$SIG{__WARN__} = sub { $warn .= join '', @_ };
49
50if (0..2) { print "ok 12\n" } else { print "not ok 12\n" }
51
52if ($warn =~ /uninitialized/) { print "ok 13\n" } else { print "not ok 13\n" }
53$warn = '';
54
55$x = "foo".."bar";
56
57if ((() = ($warn =~ /isn't numeric/g)) == 2) {
58 print "ok 14\n"
59}
60else {
61 print "not ok 14\n"
62}
63$warn = '';
64
65$. = 15;
66if (15..0) { print "ok 15\n" } else { print "not ok 15\n" }