Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a variable, I need to access sometimes as a string and sometimes doing more sophistaced things as a module, The following, well simplified example, shoud then print out two times a date - which not have to be the same.
my $a = dualvar(DateTime->now, "2011/07/17"); print "$a\n".$a->mdy("/")."\n";
Using Scalar::Util's dualvar it is possible to store a string and a number in one var. According to the documentation, this should be possible for storing a string and a reference, too.
So, before getting the hands dirty on writing another module, is there a current implementation for this?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: dualvar for a reference-string combination
by Corion (Patriarch) on Jul 17, 2011 at 18:37 UTC | |
Re: dualvar for a reference-string combination
by dave_the_m (Monsignor) on Jul 17, 2011 at 20:59 UTC | |
Re: dualvar for a reference-string combination
by james2vegas (Chaplain) on Jul 17, 2011 at 19:01 UTC | |
Re: dualvar for a reference-string combination
by Anonymous Monk on Jul 17, 2011 at 18:40 UTC | |
Re: dualvar for a reference-string combination
by Anonymous Monk on Jul 17, 2011 at 19:09 UTC |
Back to
Seekers of Perl Wisdom