in reply to How can I avoid code repetition here
Or possiblymy $str = $change_in_place && $default_argument ? $_ : $_[0]; $str =~ s/^($lchompstr)*//; $_[0]; }
i.e. substituting either of the above for(my $str = $change_in_place && $default_argument ? $_ : $_[0]) =~ s/ +^($lchompstr)*//; $_[0]; }
. . . if($change_in_place && $default_argument) { s/^($lchompstr)*// } else { $_[0] =~ s/^($lchompstr)*//; } $_[0]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I avoid code repetition here
by rovf (Priest) on Oct 07, 2009 at 13:19 UTC | |
by JadeNB (Chaplain) on Oct 17, 2009 at 21:35 UTC |