Chas. Owens wrote:
On Sun, Apr 13, 2008 at 2:32 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
 Or better, use the qr// operator to compile $start.

 perldoc -q /o
snip

I thought about suggesting qr//, but the source of $start is

my $start = time_this(scalar localtime( ( time() - (  60 * 60 ) ) ));

Which means he would have to allocate another variable (or do some
stupid interpolation tricks) to hold the regex.

$start = qr/^$start/;

In this case I think /o is the right choice.

If the subroutine is called a second (or third or fourth, etc.) time then the pattern in /^start/o will always have the same value as the first time it is called so it depends on how many times the OP calls this subroutine. Of course compiling the regular expression with qr// will always have the correct time when the subroutine is called.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

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


Reply via email to