Re: regex to clean path
From: Uri Guttman (uguttman_at_athenahealth.com)
Date: 10/21/04
- Next message: Ben Morrow: "Re: Perl XML Parser DOM Tag Handler sample code ...."
- Previous message: Tassilo v. Parseval: "Re: perl to english"
- In reply to: parv: "Re: regex to clean path"
- Next in thread: parv: "Re: regex to clean path"
- Reply: parv: "Re: regex to clean path"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 21 Oct 2004 16:08:11 -0400
>>>>> "p" == parv <parv_@yahooWhereElse.com> writes:
>> the overall impression is that you have the tendency to abuse
>> printf() and referencing-dereferencing
p> I do not agree about printf() at all, but do agree in some limited
p> ways about references.
printf is so rarely needed in perl. you can usually use interpolation,
sprintf, or formats (which i have never used in 11 years of perl
hacking). and i would prefer sprintf as then you can easily control
where the output goes rather than always going to a single handle. think
about the cases where you want output to be returned instead of printed,
or sent to two places like stdout and a log, etc. my rule for this is:
print rarely, print late.
print rarely means don't call print so often as it is slow. use .= to
build strings as that is fast.
print late means don't print until you have all the text you want in one
string. that way you can easily decide to print to multiple places and
control the printing. my dump, status and other text generating routines
always build strings and return them. their caller can decide to print
or add other text to them and return to a higher caller, etc. if you
print in a low level sub, you can't prepend text or mung it or control
its output.
so printf falls under that rule but since sprintf does the same work but
returns the string, i never use printf.
uri
- Next message: Ben Morrow: "Re: Perl XML Parser DOM Tag Handler sample code ...."
- Previous message: Tassilo v. Parseval: "Re: perl to english"
- In reply to: parv: "Re: regex to clean path"
- Next in thread: parv: "Re: regex to clean path"
- Reply: parv: "Re: regex to clean path"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|