On Thu, Jun 27, 2013 at 11:22 AM, Rob Dixon <rob.di...@gmx.com> wrote:

> Something like this may help you
>
>     use strict;
>     use warnings;
>
>     do_something({ title => 'TEST', value => 42 });
>
>     sub do_something {
>       my ($params) = @_;
>       print $params->{title}, "\n";
>       do_something_else($params) for 1 .. 3;
>     }
>
>
>     sub do_something_else {
>       my ($params) = @_;
>       print $params->{value}, "\n";
>     }
>


And along the reference suggestion (and in keeping with Tom Tiddy [1])
my %data_points = (
             title => 'TEST',
             value => 42,
             );

do_something(\%data_points);

instead of an anonymous hash as the sub argument.  Getting deeper, you
might start looking at the OOP side of Perl, where your data becomes object
attributes and your subs become methods.

via perldoc
           perlboot            Perl OO tutorial for beginners
           perltoot            Perl OO tutorial, part 1
           perltooc            Perl OO tutorial, part 2
           perlbot             Perl OO tricks and examples


a

[1]
TMTOWTDI


Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to