in reply to Re: looping efficiency
in thread looping efficiency

my($i,$j,$k,$l) = split (//,$num_string);

I haven't done any Benchmark-ing (and won't), but unpack might be faster than split:
    my($i,$j,$k,$l) = unpack '(a)4', $num_string;


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: looping efficiency
by Marshall (Canon) on Dec 30, 2020 at 01:31 UTC
    Yes, I also suspect that unpack is faster. However, I have doubts that would make a difference. Of more importance perhaps is why these individual digits need to be known in the first place? I have no idea. Maybe the OP can clue us in to what this exercise is for?
Re^3: looping efficiency
by QM (Parson) on Dec 30, 2020 at 23:00 UTC
    Considering it's Perl, split vs unpack seems irrelevant.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of