On 09/11/2013 13:33, Unknown User wrote:
I have a variable that has a function in it, e.g.
my $newtime = "time() + 30";
How can i use it in code so that it always returns time() + 30 when it
is called?
Does it *have* to be in a string like this? Where has the string come from?
Rob
--
On Sat, 9 Nov 2013 16:27:24 +0200
Shlomi Fish wrote:
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $sub_ref = sub { return time() + 30 };
>
> print "Sub-ref call is: ", scalar( $sub_ref->() ), "\n";
Why not just use a sub?
sub time_delay {
my $delay = shift @_;
return tim
Hi all,
On Sat, 9 Nov 2013 08:45:42 -0500
Shawn H Corey wrote:
> On Sat, 9 Nov 2013 19:03:00 +0530
> Unknown User wrote:
>
> > Hi,
> >
> > I have a variable that has a function in it, eg: my $newtime =
> > "time() + 30";
> > How can i use it in code so that it always returns time() + 30 when
On Sat, 9 Nov 2013 19:03:00 +0530
Unknown User wrote:
> Hi,
>
> I have a variable that has a function in it, eg: my $newtime =
> "time() + 30";
> How can i use it in code so that it always returns time() + 30 when
> it is called?
See `perldoc -f eval`
Note that using strings with eval could l