[tpm] Split a string in half

Uri Guttman uri at stemsystems.com
Sun Mar 15 08:53:50 PDT 2009


>>>>> "AC" == Abuzar Chaudhary <abuzarchaudhary at yahoo.com> writes:

  AC> my $s1 = substr($s, 0, int(length($s)/2));
  AC> my $s2 = substr($s, int(length($s)/2)+1);

no need for the int() calls as those args to substr require integers and
thus provide integer context.

uri

-- 
Uri Guttman  ------  uri at stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


More information about the toronto-pm mailing list