in reply to Re^4: How to extract the first elemnet from an integer type value ???
in thread How to extract the first elemnet from an integer type value ???

chop $num while $num > 9;

DWIM is Perl's answer to Gödel
  • Comment on Re^5: How to extract the first elemnet from an integer type value ???
  • Download Code

Replies are listed 'Best First'.
Re^6: How to extract the first elemnet from an integer type value ???
by Not_a_Number (Prior) on Aug 31, 2006 at 10:44 UTC
    chop $num until length $num == 1;
      $digit = chop $num while $num;

      DWIM is Perl's answer to Gödel