This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #87708] $tied / $tied under use integer
[perl5.git] / t / op / flip.t
1 #!./perl
2
3 BEGIN {
4     require "test.pl";
5 }
6
7 plan(11);
8
9 @a = (1,2,3,4,5,6,7,8,9,10,11,12);
10 @b = ();
11 while ($_ = shift(@a)) {
12     if ($x = /4/../8/) { $z = $x; push @b, $x + 0; }
13     $y .= /1/../2/;
14 }
15 is(join("*", @b), "1*2*3*4*5");
16
17 is($z, '5E0');
18
19 is($y, '12E0123E0');
20
21 @a = ('a','b','c','d','e','f','g');
22
23 {
24 local $.;
25
26 open(of,'harness') or die "Can't open harness: $!";
27 while (<of>) {
28     (3 .. 5) && ($foo .= $_);
29 }
30 $x = ($foo =~ y/\n/\n/);
31
32 is($x, 3);
33
34 $x = 3.14;
35 ok(($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
47 ok(!defined $.);
48
49 use warnings;
50 my $warn='';
51 $SIG{__WARN__} = sub { $warn .= join '', @_ };
52
53 ok(scalar(0..2));
54
55 like($warn, qr/uninitialized/);
56 $warn = '';
57
58 $x = "foo".."bar";
59
60 ok((() = ($warn =~ /isn't numeric/g)) == 2);
61 $warn = '';
62
63 $. = 15;
64 ok(scalar(15..0));