On 6/5/05, Siegfried Heintze wrote:
> 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?
> 

You can pass strings without a problem.
For effeciency, you can use the qr// operator. See "perldoc perlop":
http://perldoc.perl.org/perlop.html#qr%2fSTRING%2fimosx

Please note however that the second part in the s/// operator is *not*
treated as an RE, only the first part:
s/PATTERN/REPLACEMENT/
PATTERN is a regexp.
REPLACEMENT is treated as double-quoted text (delimiter dependent)
unless you use the "e" modifier, in which case REPLACEMENT will be
eval'ed as a Perl expression.

HTH,
-- 
Offer Kaye

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to