I wrote code (about 100 lines) that works fine on version 5.12.1. Unfortunately, my client uses version 5.10.0. So I tested the code on 5.10.0 and found that it does not work!
Where can I find a list of differences between 5.10 and 5.12?
Edit:
I think the best answer to the question “Where can I find a list of differences between 5.10 and 5.12” is plusplus ' comment according to the “accepted answer”. For an explanation of the code below, please read Michael Carman's answer .
Code that works since 5.12.1 but does not work on 5.10.0 ( $contents still remains an empty line after running the code)
# read in the first 10 lines. my $contents = ''; for (my $i = 0; $i < 10 && ! eof; $i++) { $contents .= <FILE>; }
Improved code that works in both versions.
# read in the first 10 lines. my $contents = ''; my $i = 0; while (<FILE>) { last if $i >= 10; $contents .= $_; $i++; }
source share