use strict; use warnings; my $foo="Just another perl hacker"; print f("Just another perl hacker",11); print f("Just another perl hacker",12); sub f { ($a,$b)=@_;$b-=3;substr$a,$b++/2,-$b/2,"...";$a }