I have a fragment of code (consisting of a while loop) that removes all the
keywords in string and puts them at the end. I would like to extract this
while loop into it's own function and have patterns as function arguments.
What should I pass to the function? Strings?
Strategy A:
sub abc { my $s = shift; my $old = shift; my $new = shift; while ($s =~
s/$old/$new/g) { .... }
&abc(" long string here ", "here", "hear");
or
Strategy B
# not sure how to write the sub...
&abc(" long string here", /here/, /hear/);
Thanks again,
Siegfried
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>