* Graham Knop <haarg@haarg.org> [2016-07-11 23:48]: > - no if $] < 5.011, warnings => 'deprecated'; > - is(scalar(split("\n" => $dumpstr{ar_indent_2})) + 2, > - scalar(split("\n" => $dumpstr{ar_indent_3})), > + is(scalar(() = $dumpstr{ar_indent_2} =~ /\n/g) + 2, > + scalar(() = $dumpstr{ar_indent_3} =~ /\n/g), These are subtly different. The ()=/\n/g formulation will miss the last line unless it’s terminated by a newline. Using split/\n/ ignores that, it counts "a\nb" as 2 lines same as "a\nb\n". If that difference matters, ()=split can be used to silence the warning on old perls while still using split. If the difference does not matter then why not use tr/// instead? That would simplify the code, since tr/// doesn’t require scalar context: is($dumpstr{ar_indent_2} =~ y/\n// + 2, $dumpstr{ar_indent_3} =~ y/\n//, "Indent(3) runs 2 lines longer than Indent(2)"); Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>Thread Previous