Perl v5.26 can now detect and warn you about version control conflict markers in your code. In prior versions, the compiler would try to interpret those as code and would complain about a syntax error. You program still fails to compile but you get a better error message. Maybe some future Perl will bifurcate the program, run both versions, and compare the results (don't hold your breath).
To demonstrate this, set up a new git repository, create a simple "Hello World" program, and commit it:
$ mkdir test-repo; cd test_repo; git init
Initialized empty Git repository in /Users/buster/test_repo/.git/
$ cat > hello.pl
#!/usr/bin/perl
use v5.10;
say "Hello World!";
^D
$ git add hello.pl
$ git commit -a -m 'initial program'
[master (root-commit) 0665c2b] initial program
1 file changed, 3 insertions(+)
create mode 100755 hello.pl
Now that you have the file you need to create a conflict that Perl can detect. One way is to edit in a new branch and the master branch at the same time.
$ git checkout -b new_feature
Switched to a new branch 'new_feature'
$ cat > hello.pl
#!/usr/bin/perl
use v5.10;
say "Hello Perl 5.26!";
$ git commit -a -m 'Greet the new perl'
[new_feature 9ed328a] Greet the new perl
1 file changed, 1 insertion(+), 1 deletion(-)
$ git checkout master
Switched to branch 'master'
$ cat > hello.pl
#!/usr/bin/perl
use v5.10;
say "Hello new Perl!";
$ git commit -a -m 'Greet the new Perl'
[master 15dd6ac] Greet the new Perl
1 file changed, 1 insertion(+), 1 deletion(-)
Both of these programs change the message in the say statement. Both commits have a similar message (that's not important). You can pull from a branch to try to merge it into your current branch. You may get the same thing by pulling from a remote where someone else was working on the same file as you. The merge gives you a warning:
$ git pull . new_feature
From .
* branch new_feature -> FETCH_HEAD
Auto-merging hello.pl
CONFLICT (content): Merge conflict in hello.pl
Automatic merge failed; fix conflicts and then commit the result.
The file now has both versions of the file. A git conflict marker starts with <<<<<<<. That's followed by the version for the file as it exists in the current branch. That ends with =======, after which is the content for the incoming version. Finally, the end of the conflict is denoted with >>>>>>> and the commit digest for the incoming commit marked as HEAD (you know the current commit because, well, it's the current commit: git show -s --format=%H):
$ cat hello.pl
#!/usr/bin/perl
use v5.10;
<<<<<<< HEAD
say "Hello new Perl!";
=======
say "Hello Perl 5.26!";
>>>>>>> 9ed328a5468aeab03098a4ded7a6bbc6daf8ac61
Versions prior to v5.26 give an odd error that doesn't seem to relate to anything going on in the program. Earlier Perls think you are trying to use a heredoc:
$ perl5.24 hello.pl
Use of bare << to mean <<"" is deprecated at hello.pl line 3.
Now the error message better detects what's going on:
$ perl5.26 hello.pl
Version control conflict marker at hello.pl line 3, near "<<<<<<<"
Version control conflict marker at hello.pl line 5, near "======="
Version control conflict marker at hello.pl line 7, near ">>>>>>>"
Execution of hello.pl aborted due to compilation errors.
Running it under diagnostics gives extra information (although it's not always much more helpful):
$ perl -Mdiagnostics hello.pl
Version control conflict marker at hello.pl line 3, near "<<<<<<<"
Version control conflict marker at hello.pl line 5, near "======="
Version control conflict marker at hello.pl line 7, near ">>>>>>>"
Execution of hello.pl aborted due to compilation errors (#1)
(F) The parser found a line starting with <<<<<<<,
>>>>>>>, or =======. These may be left by a
version control system to mark conflicts after a failed merge operation.
Uncaught exception from user code:
Version control conflict marker at hello.pl line 3, near "<<<<<<<"
Version control conflict marker at hello.pl line 5, near "======="
Version control conflict marker at hello.pl line 7, near ">>>>>>>"
Execution of hello.pl aborted due to compilation errors.