my $foo="asdhflakjsdfhlaksjdfhlaksdjfhalks"; $foo =~ s/(.{20}).{3,}/$1../; print "-"x 20, "\n"; print $foo, "\n"; my $foo="asdhflakjsdfhlaksjdfh"; $foo =~ s/(.{20}).{3,}/$1../; print "-"x 20, "\n"; print $foo,"\n"; #### use integer; my $foo="Just another perl hacker"; print f2("Just another perl hacker",12); sub f2 { ($_,$l)=@_;$s=$l-3;$n=$s/2;$m=$n+($s&1);s/(.{$m}).*(.{$n})/$1...$2/;$_ }