Re: code line of the day
Chris Dolan <[email protected]> Fri, 8 Sep 2006 10:09:15 -0500
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
On Sep 8, 2006, at 9:42 AM, A. Pagaltzis wrote:
[ ... ]
> sub flatten_copy {
> local $_ = shift;
> ref $_ eq 'SCALAR' ? "$$_" : "$_";
> }
>
> my $t = $self->{templates};
> @{$t}{ keys %$tmpls } = map \( flatten_copy $_ ), values %$tmpls;
>
> I think I like that.
Why did you use "local"? Shouldn't the following work?
sub flatten_copy {
my $s = shift;
ref $s eq 'SCALAR' ? "$$s" : "$s";
}
Chris
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703
vCard: http://www.chrisdolan.net/ChrisDolan.vcf
Clotho Advanced Media, Inc. - Creators of MediaLandscape Software
(http://www.media-landscape.com/) and partners in the revolutionary
Croquet project (http://www.opencroquet.org/)