http://qs1969.pair.com?node_id=1076947


in reply to Re: Using the Substr
in thread Using the Substr

and assuming they're not always digits but a colon is always the separator, a combination of split, array slicing, and join:

$result = join( ':', (split( /:/, $string))[0..2]);

-derby

update: I like hdb's better ... less parens.