in reply to Retain first 4 characters of a string
perlnoobster,
I just added flavors to your dish so that it is eatable and delicious!
$phn = "Apple iPhone 4 Black Cover"; print $trim = join '-', (map { substr($_, 0, 4) } split /\s+/, $phn);
In Section
Seekers of Perl Wisdom