in reply to Re: Cutting down a string (boo)
in thread Cutting down a string
For boo_radley's golf challenge, the Sidhekin takes jmcnamara's solution, fixes up the output to match the specs, and trims to 47 characters ... using no modules (other than optionally strict and warnings).
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 }
The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"
|
|---|