xref: /openbsd/gnu/usr.bin/perl/t/op/flip.t (revision 3d8817e4)
1#!./perl
2
3BEGIN {
4    require "test.pl";
5}
6
7plan(11);
8
9@a = (1,2,3,4,5,6,7,8,9,10,11,12);
10@b = ();
11while ($_ = shift(@a)) {
12    if ($x = /4/../8/) { $z = $x; push @b, $x + 0; }
13    $y .= /1/../2/;
14}
15is(join("*", @b), "1*2*3*4*5");
16
17is($z, '5E0');
18
19is($y, '12E0123E0');
20
21@a = ('a','b','c','d','e','f','g');
22
23{
24local $.;
25
26open(of,'harness') or die "Can't open harness: $!";
27while (<of>) {
28    (3 .. 5) && ($foo .= $_);
29}
30$x = ($foo =~ y/\n/\n/);
31
32is($x, 3);
33
34$x = 3.14;
35ok(($x...$x) eq "1");
36
37{
38    # coredump reported in bug 20001018.008
39    readline(UNKNOWN);
40    $. = 1;
41    $x = 1..10;
42    ok(1);
43}
44
45}
46
47ok(!defined $.);
48
49use warnings;
50my $warn='';
51$SIG{__WARN__} = sub { $warn .= join '', @_ };
52
53ok(scalar(0..2));
54
55like($warn, qr/uninitialized/);
56$warn = '';
57
58$x = "foo".."bar";
59
60ok((() = ($warn =~ /isn't numeric/g)) == 2);
61$warn = '';
62
63$. = 15;
64ok(scalar(15..0));
65