
Paul
Enthusiast
Feb 15, 2002, 5:11 AM
Views: 28071
|
|
Re: [fashimpaur] String Replacement Golf
|
|
|
I think you have it wrong..... $a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; # EXPR $b = 15; # OFFSET $c = "Perl_Is_Fun"; # REPLACEMENT $d = length $c; # LEN sub mysubstr{$s=shift,$s=~s/^(.{$_[0]})(.{$_[1]})(.*)/\1$_[2]\3/,return$s}; If $s is shift then $_[0] is 15 .....thats fine! However $_[1] is Perl_Is_Fun which cannot go inside curly braces. Whichever way you do it either $_[0] or $_[1] will be letters which is invalid.
(This post was edited by RedRum on Feb 15, 2002, 5:13 AM)
|