in reply to Re: how to split the string into two or three numbers based on certain value.
in thread how to split the string into two or three numbers based on certain value.

You'll get the same results if you replace 'length $string' with '$string'.
  • Comment on Re^2: how to split the string into two or three numbers based on certain value.

Replies are listed 'Best First'.
Re^3: how to split the string into two or three numbers based on certain value.
by choroba (Cardinal) on Feb 12, 2013 at 09:15 UTC
    Except for cases where you will not. Try 9049589370.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Ah yes. The string '0' is considered false in perl despite having a length of 1. So if $str = '0', then $str will be considered false in a boolean context where length($str) will be 1 and evaluate to true.

      I wonder what the op wants to output for the string '0'? Also, I wonder what the output should be for the string '0123'?