in reply to What's your programming style?
Hello harangzsolt33,
Since the value of $^O can’t change at runtime, SEPARATOR should be evaluated at compile time. Also, why use index and uc and a comparison, when a simple regex will do?
use strict; use warnings; use constant SEPARATOR => $^O =~ /MACOS/i ? ':' : $^O =~ /WIN/i ? '\\' : '/'; print 'SEPARATOR is "' . SEPARATOR . "\"\n";
Hope that helps,
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What's your programming style?
by Anonymous Monk on Dec 08, 2018 at 05:07 UTC | |
by harangzsolt33 (Deacon) on Dec 08, 2018 at 05:09 UTC |