in reply to Re: Way to do a "scalar ref"?
in thread Way to do a "scalar ref"?
Hi,
Thanks for the reply. Ok, I'm working on a wiki (which can have VERY large articles in). The site also gets a lot of traffic (several million hits a month), so I need to make this code as optimized as possible. Now, lets say we have:
Does that make more sense?
TIA
Andy
Thanks for the reply. Ok, I'm working on a wiki (which can have VERY large articles in). The site also gets a lot of traffic (several million hits a month), so I need to make this code as optimized as possible. Now, lets say we have:
..so basically I wanna be able to pass along $article_contents to different functions, but not actually have it take up more memory (or require a "return", to assign it to a new variable).sub process_article { my $article = get_article_from_db($article_id); my $contents = process_article($article->{contents}); # now I need to access $article->{contents}, but the modified vers +ion from process_article } sub process_article { my $article_contents = $_[0]; # do some stuff to $article_contents here return $article_contents; }
Does that make more sense?
TIA
Andy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Way to do a "scalar ref"?
by moritz (Cardinal) on Sep 26, 2011 at 09:02 UTC | |
Re^3: Way to do a "scalar ref"?
by johngg (Canon) on Sep 26, 2011 at 09:13 UTC | |
Re^3: Way to do a "scalar ref"?
by AnomalousMonk (Archbishop) on Sep 26, 2011 at 18:45 UTC |
In Section
Seekers of Perl Wisdom