in reply to Re^2: create clone script for utf8 encoding
in thread create clone script for utf8 encoding
"I don't even got how this code could run without a semi-colon after $winner ."
It's the last line of "sub highest_number { ... }". Technically, that is terminated by the final brace: while this is valid code, I wouldn't recommend it (certainly not for production code). The problem is that if more code is added you'll have a statement that is neither terminated by a brace nor a semicolon.
The same applies to arrays (and hashes) and commas. Consider this contrived example:
my @numbers = ( 'one', 'three', 'two' );
Oops! I'll just reorder those (a simple ddp sequence in vi):
my @numbers = ( 'one', 'two' 'three', );
Now you've got an even bigger "Oops!".
Having said that, the biggest, single improvement you could make to this code would be the use of consistent indentation. It took me some time, tracking back and forth between opening and closing braces, to see where the related blocks of code were. This type of code is highly error-prone. Perhaps look at perlstyle; and perltidy may prove useful.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: create clone script for utf8 encoding
by choroba (Cardinal) on Dec 20, 2018 at 15:59 UTC | |
by kcott (Archbishop) on Dec 21, 2018 at 03:12 UTC | |
by Aldebaran (Curate) on Jan 03, 2019 at 08:11 UTC | |
|
Re^4: create clone script for utf8 encoding
by ikegami (Patriarch) on Dec 20, 2018 at 18:08 UTC |